Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions backends/native/test/runtime/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions backends/native/test/runtime/PtnRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<EngineHost> make_engine_host();

} // namespace ptn::testing
23 changes: 19 additions & 4 deletions backends/native/test/runtime/ggml/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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", {})
)
Expand Down
2 changes: 1 addition & 1 deletion backends/native/test/runtime/ggml/ggml_ptn_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdexcept>

Expand Down
12 changes: 10 additions & 2 deletions backends/native/test/runtime/vulkan/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
2 changes: 1 addition & 1 deletion backends/native/test/runtime/vulkan/vulkan_ptn_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <executorch/backends/native/runtime/vulkan/VulkanEngine.h>
#include <executorch/backends/native/test/runtime/PtnRunner.h>
Expand Down
Loading