Skip to content

Commit fff2090

Browse files
authored
build_variables.bzl: make CUSTOM_OPS_SRCS usable in BUCK (#13357)
Making the structure in this file mirror buck's worldview more closely when it makes sense. #8268 (Also piggybacked a fixup for a continue() I left for this target in #8326.)
1 parent 166f56b commit fff2090

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

extension/llm/custom_ops/targets.bzl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@fbsource//xplat/executorch/build:build_variables.bzl", "EXTENSION_LLM_CUSTOM_OPS_BUCK_SRCS")
12
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
23
load(
34
"@fbsource//xplat/executorch/kernels/optimized:lib_defs.bzl",
@@ -30,12 +31,7 @@ def define_common_targets():
3031
for mkl_dep in ["", "_mkl_noomp"]:
3132
runtime.cxx_library(
3233
name = "custom_ops" + mkl_dep,
33-
srcs = [
34-
"op_fallback.cpp",
35-
"op_fast_hadamard_transform.cpp",
36-
"op_sdpa.cpp",
37-
"op_update_cache.cpp",
38-
],
34+
srcs = EXTENSION_LLM_CUSTOM_OPS_BUCK_SRCS,
3935
exported_headers = [
4036
"op_fallback.h",
4137
"op_fast_hadamard_transform.h",

shim_et/xplat/executorch/build/build_variables.bzl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,15 @@ VULKAN_SCHEMA_SRCS = [
493493
"backends/vulkan/serialization/schema.fbs",
494494
]
495495

496-
CUSTOM_OPS_SRCS = [
497-
"extension/llm/custom_ops/op_fallback.cpp",
498-
"extension/llm/custom_ops/op_fast_hadamard_transform.cpp",
499-
"extension/llm/custom_ops/op_sdpa.cpp",
500-
"extension/llm/custom_ops/op_update_cache.cpp",
496+
EXTENSION_LLM_CUSTOM_OPS_BUCK_SRCS = [
497+
"op_fallback.cpp",
498+
"op_fast_hadamard_transform.cpp",
499+
"op_sdpa.cpp",
500+
"op_update_cache.cpp",
501+
]
502+
503+
CUSTOM_OPS_SRCS = ["extension/llm/custom_ops/" + x for x in EXTENSION_LLM_CUSTOM_OPS_BUCK_SRCS] + [
501504
"extension/llm/custom_ops/spinquant/fast_hadamard_transform.cpp",
502-
"kernels/portable/cpu/util/reduce_util.cpp",
503505
]
504506

505507
LLAMA_RUNNER_SRCS = [

tools/cmake/Codegen.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,6 @@ function(executorch_validate_build_variables)
455455
foreach(filelist_and_varname IN ZIP_LISTS BUILD_VARIABLES_FILELISTS
456456
BUILD_VARIABLES_VARNAMES
457457
)
458-
if("${filelist_and_varname_1}" STREQUAL "_custom_ops__srcs")
459-
continue()
460-
endif()
461458
executorch_append_filelist(
462459
${filelist_and_varname_0}
463460
"${filelist_and_varname_1}_from_build_variables"

0 commit comments

Comments
 (0)