diff --git a/backends/native/examples/hf_llm/runtime/BUCK b/backends/native/examples/hf_llm/runtime/BUCK index ac110c40504..fe9aec8101b 100644 --- a/backends/native/examples/hf_llm/runtime/BUCK +++ b/backends/native/examples/hf_llm/runtime/BUCK @@ -1,4 +1,6 @@ load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +load("@fbsource//third-party/llama.cpp:ggml_ci.bzl", "ggml_ci_labels") +load("@fbsource//tools/build_defs:default_platform_defs.bzl", "CXX") load("@fbsource//xplat/executorch/backends/native/runtime/engine:targets.bzl", "CPU_COMPAT", "CUDA_COMPAT", "HIP_COMPAT", "METAL_COMPAT") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") @@ -80,6 +82,7 @@ fbcode_target( # ggml's VMM pool calls the driver API, which //third-party/cuda:libcuda does not link on fbcode. ("cuda", None, "cuda_driver_api-lazy"), ], + labels = ggml_ci_labels("cuda"), visibility = ["PUBLIC"], **CUDA_COMPAT ) @@ -93,6 +96,7 @@ fbcode_target( "//executorch/backends/native/runtime/engine:ggml_engine_hip", ], external_deps = ["gflags"], + labels = ggml_ci_labels("hip"), visibility = ["PUBLIC"], **HIP_COMPAT ) @@ -108,6 +112,9 @@ non_fbcode_target( "//executorch/backends/native/runtime/engine:ggml_engine_metal", ], external_deps = ["gflags"], + labels = ggml_ci_labels("metal"), + # ggml-metal has no mobile flavors. + platforms = [CXX], visibility = ["PUBLIC"], **METAL_COMPAT ) diff --git a/backends/native/runtime/engine/targets.bzl b/backends/native/runtime/engine/targets.bzl index f3270a23fd8..a7ba9d20939 100644 --- a/backends/native/runtime/engine/targets.bzl +++ b/backends/native/runtime/engine/targets.bzl @@ -1,3 +1,5 @@ +load("@fbsource//third-party/llama.cpp:ggml_ci.bzl", "ggml_ci_labels") +load("@fbsource//tools/build_defs:default_platform_defs.bzl", "CXX") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime") # Platform constraints of the ggml backend sets. Targets that link one repeat @@ -81,6 +83,9 @@ def define_common_targets(): "//executorch/backends/native/runtime/graph:value", ggml_dep, ], + labels = ggml_ci_labels(variant), + # The GPU sets have no mobile flavors. + platforms = None if variant == "cpu" else [CXX], visibility = ["//executorch/backends/native/..."], **compat ) diff --git a/backends/native/test/runtime/ggml/BUCK b/backends/native/test/runtime/ggml/BUCK index b8a45182030..2b2add96f39 100644 --- a/backends/native/test/runtime/ggml/BUCK +++ b/backends/native/test/runtime/ggml/BUCK @@ -1,4 +1,5 @@ load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//third-party/llama.cpp:ggml_ci.bzl", "ggml_ci_labels") load("@fbsource//xplat/executorch/backends/native/runtime/engine:targets.bzl", "CPU_COMPAT", "CUDA_COMPAT", "HIP_COMPAT") load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") @@ -22,13 +23,15 @@ fbcode_target( ) # The op suite runs once per ggml backend set; only the engine variant, the -# runner's --device, link deps and resources, and the test host differ. +# runner's --device, link deps and resources, the test host, and the CI +# configuration differ. _VARIANTS = [ {"suffix": "", "engine": "ggml_engine_cpu", "compat": CPU_COMPAT, "device": "cpu"}, { "suffix": "_cuda", "engine": "ggml_engine_cuda", "compat": CUDA_COMPAT, + "labels": ggml_ci_labels("cuda"), "device": "gpu", "remote_execution": re_test_utils.remote_execution( platform = "gpu-remote-execution", @@ -47,6 +50,7 @@ _VARIANTS = [ "suffix": "_hip", "engine": "ggml_engine_hip", "compat": HIP_COMPAT, + "labels": ggml_ci_labels("hip"), "device": "gpu", "remote_execution": re_test_utils.remote_execution( platform = "amd-gpu", @@ -66,6 +70,7 @@ _VARIANTS = [ "//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", {}) ) for v in _VARIANTS @@ -77,6 +82,7 @@ _VARIANTS = [ name = "test_ggml_ops" + v["suffix"], srcs = ["test_ggml_ops.py"], env = {"GGML_PTN_DEVICE": v["device"]}, + labels = v.get("labels", []), remote_execution = v.get("remote_execution"), resources = {":ggml_ptn_runner" + v["suffix"]: "ggml_ptn_runner"} | v.get("resources", {}), diff --git a/shim_et/third-party/llama.cpp/ggml_ci.bzl b/shim_et/third-party/llama.cpp/ggml_ci.bzl new file mode 100644 index 00000000000..968df8fb90d --- /dev/null +++ b/shim_et/third-party/llama.cpp/ggml_ci.bzl @@ -0,0 +1,4 @@ +# Open-source builds have no Meta CI configuration, so targets that link a ggml +# GPU backend set get no CI labels. +def ggml_ci_labels(_backend): + return []