Skip to content

Commit 83365b2

Browse files
qukhanxnnpack-bot
authored andcommitted
Remove RTTI from the Tensor API. Refactor operation handling in the graph.
Remove virtual inheritance from the operation implementations and stop using side-casting using `dynamic_cast` to find out if an operation is implemented by a backend. Add a list of "graph::BackendExtension" elements that can be grafted onto an operation. Backends implementation of every operation are now implemented by deriving from this new class. When lowering to a specific backend, we go through the list of extensions attached to an operation to find a matching backend. Backend identification is done by calling `BackendExtension::GetTypeId()`. As a result of the above changes, operation node implementations don't need to be defined as templates anymore. PiperOrigin-RevId: 914983314
1 parent ace56b6 commit 83365b2

15 files changed

Lines changed: 932 additions & 776 deletions

File tree

BUILD.gn

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,20 @@ xnnpack_source_set("operators") {
360360
}
361361
}
362362

363+
xnnpack_source_set("subgraph_matchers") {
364+
sources = [
365+
"test/subgraph/rewrites/subgraph_matcher.cc",
366+
"test/subgraph/rewrites/subgraph_matcher.h",
367+
]
368+
369+
public_deps = [
370+
":xnnpack_headers",
371+
"//third_party/googletest:gtest",
372+
]
373+
374+
testonly = true
375+
}
376+
363377
xnnpack_source_set("subgraph") {
364378
deps = [
365379
":microkernel_headers",

litert/tensor/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ cc_library(
4747
# copybara:uncomment includes = ["utils"],
4848
deps = [
4949
"//litert/tensor:datatypes",
50+
"//litert/tensor/internal:type_id",
5051
"@abseil-cpp//absl/status",
5152
"@abseil-cpp//absl/status:statusor",
5253
"@abseil-cpp//absl/types:span",
@@ -89,7 +90,6 @@ cc_library(
8990
deps = [
9091
"//litert/tensor:datatypes",
9192
"//litert/tensor/internal:graph",
92-
"//litert/tensor/internal:mixin",
9393
"@abseil-cpp//absl/strings:string_view",
9494
],
9595
)

0 commit comments

Comments
 (0)