From c3edce01752449ec2510cc481f6bda5426c9ed46 Mon Sep 17 00:00:00 2001 From: Gregory Comer Date: Fri, 12 Jun 2026 14:30:04 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- backends/xnnpack/CMakeLists.txt | 1 + .../xnnpack/runtime/operators/operator.cpp | 20 +++++++++++++ backends/xnnpack/runtime/operators/operator.h | 28 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 backends/xnnpack/runtime/operators/operator.cpp create mode 100644 backends/xnnpack/runtime/operators/operator.h diff --git a/backends/xnnpack/CMakeLists.txt b/backends/xnnpack/CMakeLists.txt index 6f90ac4ea1a..f02d48e1141 100644 --- a/backends/xnnpack/CMakeLists.txt +++ b/backends/xnnpack/CMakeLists.txt @@ -108,6 +108,7 @@ list( backends/xnnpack/runtime/core/quant_params.cpp backends/xnnpack/runtime/graph/graph.cpp backends/xnnpack/runtime/graph/graph_builder.cpp + backends/xnnpack/runtime/operators/operator.cpp ) list(TRANSFORM _xnnpack_backend__srcs PREPEND "${EXECUTORCH_ROOT}/") diff --git a/backends/xnnpack/runtime/operators/operator.cpp b/backends/xnnpack/runtime/operators/operator.cpp new file mode 100644 index 00000000000..ae44797651e --- /dev/null +++ b/backends/xnnpack/runtime/operators/operator.cpp @@ -0,0 +1,20 @@ +#include + +#include + +namespace executorch::backends::xnnpack::operators { + +std::unique_ptr create_operator(graph::Operator op) { + // No in-tree operators are available yet; the graph runtime currently + // supports only XNNPACK-delegated subgraphs. Reaching this point means a + // node was routed to an in-tree kernel that has not been added. Return null + // so the caller can fail cleanly rather than aborting. + ET_LOG( + Error, + "No in-tree kernel for operator %d; only XNNPACK-delegated nodes are " + "supported", + static_cast(op)); + return nullptr; +} + +} // namespace executorch::backends::xnnpack::operators diff --git a/backends/xnnpack/runtime/operators/operator.h b/backends/xnnpack/runtime/operators/operator.h new file mode 100644 index 00000000000..c63ba0c9a68 --- /dev/null +++ b/backends/xnnpack/runtime/operators/operator.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include + +namespace executorch::backends::xnnpack::operators { + +class Operator { + public: + virtual void setup(runtime::Span constant_args) {}; + virtual void prepare( + runtime::Span inputs, + runtime::Span outputs) {}; + virtual void reshape(runtime::Span input_specs) {}; + virtual void execute( + runtime::Span inputs, + runtime::Span outputs) = 0; + virtual ~Operator() = default; +}; + +std::unique_ptr create_operator(graph::Operator op); + +} // namespace executorch::backends::xnnpack::operators