From 793658f92b538982b0f0e77eb0490d12fd47babf Mon Sep 17 00:00:00 2001 From: Digant Desai Date: Fri, 30 Oct 2026 16:27:03 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- backends/native/test/runtime/BUCK | 14 ++++++++--- backends/native/test/runtime/PtnRunner.h | 4 ++-- backends/native/test/runtime/ggml/BUCK | 23 +++++++++++++++---- .../test/runtime/ggml/ggml_ptn_runner.cpp | 2 +- .../native/test/runtime/vulkan/targets.bzl | 12 ++++++++-- .../test/runtime/vulkan/vulkan_ptn_runner.cpp | 2 +- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/backends/native/test/runtime/BUCK b/backends/native/test/runtime/BUCK index 80136220925..8ce73cd9078 100644 --- a/backends/native/test/runtime/BUCK +++ b/backends/native/test/runtime/BUCK @@ -8,16 +8,24 @@ non_fbcode_target(_kind = define_common_targets) fbcode_target(_kind = define_common_targets) -# Engine-neutral PTN runner; each engine's runner binary adds make_engine_host(). +# Declares make_engine_host(), which each engine's host library defines. +fbcode_target( + _kind = runtime.cxx_library, + name = "engine_host", + exported_headers = ["PtnRunner.h"], + visibility = ["//executorch/backends/native/test/..."], + exported_deps = ["//executorch/backends/native/runtime/engine:engine"], +) + +# Engine-neutral PTN runner; each engine's runner binary adds its host library. fbcode_target( _kind = runtime.cxx_library, name = "ptn_runner_main", srcs = ["ptn_runner_main.cpp"], - exported_headers = ["PtnRunner.h"], link_whole = True, undefined_symbols = True, visibility = ["//executorch/backends/native/test/..."], - exported_deps = ["//executorch/backends/native/runtime/engine:engine"], + exported_deps = [":engine_host"], deps = [ "//executorch/backends/native/runtime:runtime", "//executorch/backends/native/runtime/deserialize:package", diff --git a/backends/native/test/runtime/PtnRunner.h b/backends/native/test/runtime/PtnRunner.h index 830b7fa4f62..de23aeb4da4 100644 --- a/backends/native/test/runtime/PtnRunner.h +++ b/backends/native/test/runtime/PtnRunner.h @@ -12,8 +12,8 @@ namespace ptn::testing { -// Defined once per runner binary; ptn_runner_main.cpp drives the host it -// returns, so every engine runs a PTN through the same harness. +// Defined once per binary by an engine's host library; drivers such as +// ptn_runner_main.cpp run every engine through the host it returns. std::unique_ptr make_engine_host(); } // namespace ptn::testing diff --git a/backends/native/test/runtime/ggml/BUCK b/backends/native/test/runtime/ggml/BUCK index 2b2add96f39..05de9fa2b72 100644 --- a/backends/native/test/runtime/ggml/BUCK +++ b/backends/native/test/runtime/ggml/BUCK @@ -59,17 +59,32 @@ _VARIANTS = [ }, ] +[ + fbcode_target( + _kind = runtime.cxx_library, + name = "ggml_engine_host" + v["suffix"], + srcs = ["ggml_ptn_runner.cpp"], + link_whole = True, + visibility = ["//executorch/backends/native/test/..."], + exported_deps = ["//executorch/backends/native/test/runtime:engine_host"], + deps = ["//executorch/backends/native/runtime/engine:" + v["engine"]] + + v.get("deps", []), + external_deps = ["gflags"] + v.get("external_deps", []), + labels = v.get("labels", []), + **v.get("compat", {}) + ) + for v in _VARIANTS +] + [ fbcode_target( _kind = runtime.cxx_binary, name = "ggml_ptn_runner" + v["suffix"], - srcs = ["ggml_ptn_runner.cpp"], visibility = ["//executorch/backends/native/test/..."], deps = [ - "//executorch/backends/native/runtime/engine:" + v["engine"], + ":ggml_engine_host" + v["suffix"], "//executorch/backends/native/test/runtime:ptn_runner_main", - ] + v.get("deps", []), - external_deps = ["gflags"] + v.get("external_deps", []), + ], labels = v.get("labels", []), **v.get("compat", {}) ) diff --git a/backends/native/test/runtime/ggml/ggml_ptn_runner.cpp b/backends/native/test/runtime/ggml/ggml_ptn_runner.cpp index 6b725ee46f4..85336504930 100644 --- a/backends/native/test/runtime/ggml/ggml_ptn_runner.cpp +++ b/backends/native/test/runtime/ggml/ggml_ptn_runner.cpp @@ -4,7 +4,7 @@ // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. -// The ggml engine for ptn_runner_main.cpp. +// The ggml engine host for PTN test drivers. #include diff --git a/backends/native/test/runtime/vulkan/targets.bzl b/backends/native/test/runtime/vulkan/targets.bzl index 0add4242c86..7ccf8b9c725 100644 --- a/backends/native/test/runtime/vulkan/targets.bzl +++ b/backends/native/test/runtime/vulkan/targets.bzl @@ -19,12 +19,20 @@ def define_common_targets(): cmd = "mkdir -p $OUT && cp $(location fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_so)/libvulkan.so.1 $OUT/libvk_swiftshader.so", ) + runtime.cxx_library( + name = "vulkan_engine_host", + srcs = ["vulkan_ptn_runner.cpp"], + link_whole = True, + visibility = ["//executorch/backends/native/test/..."], + exported_deps = ["//executorch/backends/native/test/runtime:engine_host"], + deps = ["//executorch/backends/native/runtime/vulkan:vulkan_engine"], + ) + runtime.cxx_binary( name = "vulkan_ptn_runner", - srcs = ["vulkan_ptn_runner.cpp"], visibility = ["//executorch/backends/native/test/..."], deps = [ - "//executorch/backends/native/runtime/vulkan:vulkan_engine", + ":vulkan_engine_host", "//executorch/backends/native/test/runtime:ptn_runner_main", "fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_fbcode", ], diff --git a/backends/native/test/runtime/vulkan/vulkan_ptn_runner.cpp b/backends/native/test/runtime/vulkan/vulkan_ptn_runner.cpp index b4695b6a784..3f8b9e76ee0 100644 --- a/backends/native/test/runtime/vulkan/vulkan_ptn_runner.cpp +++ b/backends/native/test/runtime/vulkan/vulkan_ptn_runner.cpp @@ -4,7 +4,7 @@ // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. -// The Vulkan engine for ptn_runner_main.cpp. +// The Vulkan engine host for PTN test drivers. #include #include