Skip to content

Commit f7d5a87

Browse files
committed
Update on "[ET-VK][ez] Retry with no optimization during shader compilation"
## Context In some cases, a shader can be compiled successfully with `glslc`, but if an optimization flag such as `-O` or `-Os` is used, the compilation will fail with a message similar to ``` internal error: compilation succeeded but failed to optimize: Invalid use of 8- or 16-bit result\n %133 = OpExtInst %half %1 Pow %125 %132 ``` Which will cause the shader compilation script to fail. This diff introduces a check that if `glslc` complains about not being able to optimize the SPIR-V, then retry compilation without optimization arguments. Differential Revision: [D70906097](https://our.internmc.facebook.com/intern/diff/D70906097/) [ghstack-poisoned]
2 parents 6329941 + abaf1ca commit f7d5a87

File tree

49 files changed

+362
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+362
-408
lines changed

.buckconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@
3939

4040
[buck2]
4141
restarter=true
42+
43+
[oss]
44+
folly_cxx_tests = False

.ci/scripts/build_llama_android.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ install_executorch_and_backend_lib() {
4242

4343
build_llama_runner() {
4444
echo "Building llama runner for Android..."
45+
pushd extension/llm/tokenizers
46+
echo "Updating tokenizers submodule"
47+
git submodule update --init
48+
popd
4549
ANDROID_ABI=arm64-v8a
4650
cmake -DBUCK2="${BUCK2}" \
4751
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \

.ci/scripts/gather_test_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dl3": "linux.4xlarge.memory",
3131
"emformer_join": "linux.4xlarge.memory",
3232
"emformer_predict": "linux.4xlarge.memory",
33+
"phi-4-mini": "linux.4xlarge.memory",
3334
}
3435
}
3536

.ci/scripts/test_ane_static_llama.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ fi
1717

1818
which "${PYTHON_EXECUTABLE}"
1919

20+
# Update tokenizers submodule
21+
pushd $EXECUTORCH_ROOT/extension/llm/tokenizers
22+
echo "Update tokenizers submodule"
23+
git submodule update --init
24+
popd
25+
2026
pushd $EXECUTORCH_ROOT/examples/apple/coreml/llama
2127

2228
# Download stories llama110m artifacts

.ci/scripts/test_llama.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ cmake_install_executorch_libraries() {
173173

174174
cmake_build_llama_runner() {
175175
echo "Building llama runner"
176+
pushd extension/llm/tokenizers
177+
echo "Updating tokenizers submodule"
178+
git submodule update --init
179+
popd
176180
dir="examples/models/llama"
177181
retry cmake \
178182
-DCMAKE_INSTALL_PREFIX=cmake-out \

.ci/scripts/unittest-buck2.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ set -eux
88

99
# TODO: expand this to //...
1010
# TODO: can't query cadence & vulkan backends
11+
# TODO: can't query //kernels/prim_ops because of a cpp_unittest and
12+
# broken code in shim to read oss.folly_cxx_tests. Sending fix but it
13+
# needs to propagate and we need a submodule update.
1114
buck2 query "//backends/apple/... + //backends/example/... + \
1215
//backends/mediatek/... + //backends/test/... + //backends/transforms/... + \
13-
//backends/xnnpack/... + //configurations/... + //kernels/portable/cpu/... + \
14-
//runtime/... + //schema/... + //test/... + //util/..."
16+
//backends/xnnpack/... + //configurations/... + //kernels/aten/... + \
17+
//kernels/optimized/... + //kernels/portable/... + //kernels/quantized/... + \
18+
//kernels/test/... + //runtime/... + //schema/... + //test/... + //util/..."
1519

1620
# TODO: expand the covered scope of Buck targets.
17-
buck2 build //runtime/core/portable_type/...
18-
buck2 test //runtime/core/portable_type/...
21+
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
22+
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
23+
buck2 build //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...
24+
buck2 test //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...

.github/workflows/doc-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
cp -rf docs/_build/html/* "${RUNNER_DOCS_DIR}"
8484
8585
mv docs/_build/html "${RUNNER_ARTIFACT_DIR}"
86+
cp -rf "${RUNNER_DOCS_DIR}"/javadoc "${RUNNER_ARTIFACT_DIR}"/html
8687
8788
ls -R "${RUNNER_ARTIFACT_DIR}"/*/*.html
8889

.gitmodules

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,9 @@
2828
[submodule "backends/xnnpack/third-party/pthreadpool"]
2929
path = backends/xnnpack/third-party/pthreadpool
3030
url = https://github.com/Maratyszcza/pthreadpool.git
31-
[submodule "extension/llm/third-party/abseil-cpp"]
32-
path = extension/llm/third-party/abseil-cpp
33-
url = https://github.com/abseil/abseil-cpp.git
34-
[submodule "extension/llm/third-party/re2"]
35-
path = extension/llm/third-party/re2
36-
url = https://github.com/google/re2.git
37-
[submodule "extension/llm/third-party/sentencepiece"]
38-
path = extension/llm/third-party/sentencepiece
39-
url = https://github.com/google/sentencepiece.git
31+
[submodule "extension/llm/tokenizers"]
32+
path = extension/llm/tokenizers
33+
url = https://github.com/pytorch-labs/tokenizers.git
4034
[submodule "kernels/optimized/third-party/eigen"]
4135
path = kernels/optimized/third-party/eigen
4236
url = https://gitlab.com/libeigen/eigen.git

backends/arm/_passes/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python_library(
66
deps = [
77
"//executorch/backends/arm:tosa_quant_utils",
88
"//executorch/backends/arm:tosa_utils",
9+
"//executorch/backends/transforms:fuse_view_copy",
910
"//executorch/backends/transforms:replace_scalar_with_tensor",
1011
"//executorch/backends/xnnpack/_passes:xnnpack_passes",
1112
"//executorch/exir:lib",

backends/arm/operator_support/tosa_supported_operators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ def is_node_supported(
112112
supported = node.op == "call_function" and node.target in [
113113
exir_ops.edge.aten.abs.default,
114114
exir_ops.edge.aten.add.Tensor,
115+
exir_ops.edge.aten.logical_and.default,
116+
exir_ops.edge.aten.logical_or.default,
117+
exir_ops.edge.aten.logical_xor.default,
115118
exir_ops.edge.aten.bitwise_and.Tensor,
116119
exir_ops.edge.aten.bitwise_or.Tensor,
117120
exir_ops.edge.aten.bitwise_xor.Tensor,
@@ -193,6 +196,9 @@ def is_node_supported(
193196
exir_ops.edge.aten.bitwise_and.Tensor,
194197
exir_ops.edge.aten.bitwise_or.Tensor,
195198
exir_ops.edge.aten.bitwise_xor.Tensor,
199+
exir_ops.edge.aten.logical_and.default,
200+
exir_ops.edge.aten.logical_or.default,
201+
exir_ops.edge.aten.logical_xor.default,
196202
exir_ops.edge.aten.amax.default,
197203
exir_ops.edge.aten.amin.default,
198204
exir_ops.edge.aten.eq.Tensor,

0 commit comments

Comments
 (0)