Skip to content

Commit

Permalink
Add smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
larryliu0820 committed Oct 25, 2024
1 parent 8222c24 commit 08f4d84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions build/packaging/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
# will fail and the process will exit.
from executorch.extension.pybindings import portable_lib # usort: skip

# Import custom ops. This requires portable_lib to be loaded first.
from executorch.extension.llm.custom_ops import (
sdpa_with_kv_cache,
) # usort: skip # noqa: F401, F403

# Import quantized ops. This requires portable_lib to be loaded first.
from executorch.kernels import quantized # usort: skip # noqa: F401, F403

# Import this after importing the ExecuTorch pybindings. If the pybindings
# links against a different torch.so than this uses, there will be a set of
# symbol comflicts; the process will either exit now, or there will be issues
Expand Down Expand Up @@ -75,6 +83,15 @@ def main():
assert len(ops) > 0, "Empty operator list"
print(f"Found {len(ops)} operators; first element '{ops[0]}'")

# Make sure custom ops are registered.
assert (
"llama::sdpa_with_kv_cache" in ops
), f"sdpa_with_kv_cache not registered, Got ops: {ops}"

# Make sure quantized ops are registered.
assert (
"quantized_decomposed::add.out" in ops
), f"quantized_decomposed::add.out not registered, Got ops: {ops}"
# Export LinearModel to .pte data.
pte_data: bytes = export_linear_model()

Expand Down
2 changes: 1 addition & 1 deletion kernels/quantized/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode"
# values, run `otool -l libquantized_ops_lib.dylib`.
if(APPLE)
set_target_properties(
quantized_ops_lib
quantized_ops_aot_lib
PROPERTIES # Assume this library will be installed in
# <site-packages>/executorch/kernels/quantized/, and the
# _portable_lib.so is installed in
Expand Down

0 comments on commit 08f4d84

Please sign in to comment.