Skip to content

Commit b65db04

Browse files
committed
Fix tests
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 1248697 commit b65db04

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ cmake_install_executorch_libraries() {
5858
fi
5959
retry cmake -DBUCK2="$BUCK" \
6060
-DCMAKE_INSTALL_PREFIX=cmake-out \
61+
-DCMAKE_PREFIX_PATH=$($PYTHON_EXECUTABLE -c "from distutils.sysconfig import get_python_lib; get_python_lib")
6162
-DCMAKE_BUILD_TYPE=Release \
6263
-DEXECUTORCH_BUILD_CUSTOM=ON \
6364
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \

examples/models/llama2/custom_ops/op_sdpa_with_kv_cache_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <limits>
1010

11-
#include <executorch/examples/models/llama2/custom_ops/FunctionHeaderWrapper.h> // Declares the operator
11+
#include <executorch/examples/models/llama2/custom_ops/op_sdpa.h> // Declares the operator
1212
#include <executorch/kernels/test/TestUtil.h>
1313
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1414
#include <executorch/runtime/core/exec_aten/testing_util/tensor_factory.h>

examples/models/llama2/custom_ops/sdpa_with_kv_cache.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# This is only needed for OSS.
1010

1111
import os
12+
from pathlib import Path
1213

1314
import torch
1415

@@ -17,8 +18,12 @@
1718
assert op is not None
1819
except:
1920
# assuming we only hit this in OSS, find the default install path
20-
prefix = os.environ.get("CMAKE_INSTALL_PREFIX", "../../../../cmake-out")
21-
lib_path = os.path.join(prefix, "lib/libcustom_ops_aot_lib.so")
21+
if "CMAKE_INSTALL_PREFIX" in os.environ:
22+
prefix = Path(os.environ["CMAKE_INSTALL_PREFIX"])
23+
else:
24+
prefix = Path(__file__).parent.parent.parent.parent.parent.resolve() / "cmake-out"
25+
lib_path = prefix / "lib" / "libcustom_ops_aot_lib.so"
26+
assert lib_path.exists(), f"{lib_path} does not exist, please run cmake --install"
2227
torch.ops.load_library(lib_path)
2328
op = torch.ops.llama.sdpa_with_kv_cache.default
2429
assert op is not None

0 commit comments

Comments
 (0)