Skip to content

Commit cc54971

Browse files
authored
Merge branch 'main' into Arm-backend-Fix-int64-argmax-delegation-rejection
2 parents 6f55027 + dcc04ef commit cc54971

24 files changed

Lines changed: 175 additions & 100 deletions

.ci/scripts/unittest-linux-cmake.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@ set -eux
1111
# Install from a local tosa-tools checkout when available. If absent in this
1212
# checkout layout, clone the pinned upstream tag and install from there.
1313
if ! python -c "import tosa_serializer" >/dev/null 2>&1; then
14-
TOSA_SERIALIZATION_DIR="./examples/arm/arm-scratch/tosa-tools/serialization"
15-
if [[ ! -d "${TOSA_SERIALIZATION_DIR}" ]]; then
14+
TOSA_TOOLS_DIR="./examples/arm/arm-scratch/tosa-tools"
15+
if [[ ! -d "${TOSA_TOOLS_DIR}" ]]; then
1616
TOSA_TOOLS_DIR="$(mktemp -d /tmp/tosa-tools.XXXXXX)"
17-
git clone --depth 1 --branch v2025.11.2 \
17+
git clone --depth 1 --branch v2026.05.0 \
1818
https://git.gitlab.arm.com/tosa/tosa-tools.git "${TOSA_TOOLS_DIR}"
19-
TOSA_SERIALIZATION_DIR="${TOSA_TOOLS_DIR}/serialization"
2019
fi
2120

2221
# NOTE: Will be removed when tosa-tools is installed via pypi
2322
python -m pip install pybind11==2.10.4
2423
CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 \
2524
python -m pip install --no-dependencies \
26-
"${TOSA_SERIALIZATION_DIR}"
25+
"${TOSA_TOOLS_DIR}"
2726
python -c "import tosa_serializer"
2827
fi
2928

.claude/skills/building/SKILL.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ conda activate executorch
2323

2424
**Path B — no conda (fall back to venv):**
2525
```bash
26-
# Find a compatible Python (3.10–3.13). On macOS with only Homebrew Python 3.14+,
27-
# install a compatible version first: brew install python@3.12
28-
python3.12 -m venv .executorch-venv # or python3.11, python3.10, python3.13
26+
# Find a compatible Python (3.10–3.14).
27+
python3.12 -m venv .executorch-venv # or python3.11, python3.10, python3.13, python3.14
2928
source .executorch-venv/bin/activate
3029
pip install --upgrade pip
3130
```
3231

3332
**Then verify (either path):**
3433

3534
Run `python --version` and `cmake --version`. Fix automatically:
36-
- **Python not 3.10–3.13**: recreate the env with a correct Python version.
35+
- **Python not 3.10–3.14**: recreate the env with a correct Python version.
3736
- **cmake missing or < 3.24**: run `pip install 'cmake>=3.24'` inside the env.
3837
- **cmake >= 4.0**: works in practice, no action needed.
3938

.github/workflows/add-unanswered-to-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
6464
// List of organization logins (lowercased) to exclude members of
6565
const excludedOrgs = new Set([
66-
"meta", "facebook", "pytorch", "arm", "apple", "qualcomm", "nxp", "mediatek", "cadence", "intel", "samsung",
66+
"meta", "facebook", "pytorch", "arm", "apple", "qualcomm", "nxp", "mediatek", "cadence", "intel", "samsung", "arm ltd.",
6767
"@meta", "@facebook", "@pytorch", "@arm", "@apple", "@qualcomm", "@nxp", "@mediatek", "@cadence", "@intel", "@samsung"
6868
]);
6969

.github/workflows/build-wheels-aarch64-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
test-infra-ref: main
3131
with-cuda: disabled
3232
with-rocm: disabled
33-
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
33+
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
3434

3535
build:
3636
needs: generate-matrix

.github/workflows/build-wheels-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
test-infra-ref: main
3131
with-cuda: disabled
3232
with-rocm: disabled
33-
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
33+
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
3434

3535
build:
3636
needs: generate-matrix

.github/workflows/build-wheels-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
test-infra-ref: main
3131
with-cuda: disabled
3232
with-rocm: disabled
33-
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
33+
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
3434

3535
build:
3636
needs: generate-matrix

.github/workflows/build-wheels-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
test-infra-ref: main
3434
with-cuda: disabled
3535
with-rocm: disabled
36-
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
36+
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
3737

3838
build:
3939
needs: generate-matrix

backends/arm/test/conftest.py

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ def pytest_configure(config):
2626
pytest._test_options["llama_inputs"] = config.option.llama_inputs # type: ignore[attr-defined]
2727

2828
logging.basicConfig(stream=sys.stdout)
29+
seed, seed_label = _setup_random_seed()
30+
config._test_seed = seed
31+
config._test_seed_label = seed_label
32+
33+
if os.environ.get("TEST_RUNTIME_IS_NOT_OSS", "0") != "1":
34+
# This imports/uses torch early, which doesn't work in some Buck2 test environments.
35+
# Since this only makes randomness deterministic (reducing flakiness), it's mainly meant for
36+
# local/OSS project test runs.
37+
_set_random_seed(seed)
38+
39+
40+
def pytest_report_header(config):
41+
return config._test_seed_label
2942

3043

3144
def pytest_collection_modifyitems(config, items):
@@ -63,38 +76,44 @@ def pytest_sessionfinish(session, exitstatus):
6376

6477

6578
@pytest.fixture(autouse=True)
66-
def set_random_seed():
79+
def set_random_seed(request):
6780
"""Control random numbers in Arm test suite. Default behavior is to use a
6881
fixed seed (0), which ensures reproducible tests. Use the env variable
69-
ARM_TEST_SEED to set a custom seed, or set it to RANDOM for random seed
70-
behavior.
82+
TEST_SEED to set a custom session seed, or set it to RANDOM to choose a
83+
random session seed.
7184
7285
Examples:
7386
As default use fixed seed (0) for reproducible tests
7487
pytest --config-file=/dev/null --verbose -s --color=yes backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
75-
Use a random seed for each test
76-
ARM_TEST_SEED=RANDOM pytest --config-file=/dev/null --verbose -s --color=yes backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
88+
Use a random seed for the test session
89+
TEST_SEED=RANDOM pytest --config-file=/dev/null --verbose -s --color=yes backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
7790
Rerun with a specific seed
78-
ARM_TEST_SEED=3478246 pytest --config-file=/dev/null --verbose -s --color=yes backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
91+
TEST_SEED=3478246 pytest --config-file=/dev/null --verbose -s --color=yes backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
7992
8093
"""
81-
import torch
94+
_set_random_seed(request.config._test_seed)
95+
8296

83-
seed_env = os.environ.get("ARM_TEST_SEED", "0")
97+
def _setup_random_seed():
98+
seed_env = os.environ.get("TEST_SEED", "0")
8499
if seed_env == "RANDOM":
85100
random.seed() # reset seed, in case any other test has fiddled with it
86101
seed = random.randint(0, 2**32 - 1) # nosec B311 - non-crypto seed for tests
87-
torch.manual_seed(seed)
102+
seed_label = f"TEST_SEED=RANDOM using:{seed}"
88103
elif str.isdigit(seed_env):
89104
seed = int(seed_env)
90-
random.seed(seed)
91-
torch.manual_seed(seed)
105+
seed_label = f"TEST_SEED={seed}"
92106
else:
93-
raise TypeError(
94-
"ARM_TEST_SEED env variable must be integers or the string RANDOM"
95-
)
107+
raise TypeError("TEST_SEED env variable must be integers or the string RANDOM")
108+
109+
return seed, seed_label
110+
111+
112+
def _set_random_seed(seed):
113+
import torch
96114

97-
print(f" ARM_TEST_SEED={seed} ", end=" ")
115+
random.seed(seed)
116+
torch.manual_seed(seed)
98117

99118

100119
# ==== End of Pytest fixtures =====

backends/arm/test/models/Qwen3_VL/test_qwen3_vl_model.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,17 @@ def _test_qwen3_vl_full_models_tosa_FP(
252252
def _test_qwen3_vl_full_models_tosa_FP_bf16(
253253
test_case: Qwen3VLModelTestCase,
254254
config_factory=_make_qwen3_vl_e2e_test_config,
255+
text_model_atol: float | None = None,
255256
):
256257
model, inputs = test_case.model_cls.prepare_model_and_inputs(config_factory)
257258
model, inputs = _to_bfloat16_model_and_floating_inputs(model, inputs)
258259
# Slightly higher atol for TOSA BF16 on aarch64 (MLETORCH-2048: numeric mismatch)
259-
atol = (
260-
0.4
261-
if common.is_aarch64_host()
262-
and test_case.model_cls is LowerableVisionModelWrapper
263-
else 0.1
264-
)
260+
if common.is_aarch64_host() and test_case.model_cls is LowerableVisionModelWrapper:
261+
atol = 0.4
262+
elif text_model_atol is not None and test_case.model_cls is TextModelWrapper:
263+
atol = text_model_atol
264+
else:
265+
atol = 0.1
265266
with torch.no_grad():
266267
pipeline = TosaPipelineFP[input_t](
267268
model,
@@ -382,7 +383,9 @@ def test_qwen3_vl_2b_instruct_full_models_tosa_FP_bf16(
382383
test_case: Qwen3VLModelTestCase,
383384
):
384385
_test_qwen3_vl_full_models_tosa_FP_bf16(
385-
test_case, _make_qwen3_vl_2b_instruct_layer_config
386+
test_case,
387+
_make_qwen3_vl_2b_instruct_layer_config,
388+
text_model_atol=0.15,
386389
)
387390

388391

backends/arm/test/targets.bzl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ def define_arm_tests():
9696
for test_file in test_files:
9797
test_file_name = paths.basename(test_file)
9898
test_name = test_file_name.replace("test_", "").replace(".py", "")
99+
test_env = {
100+
"TEST_RUNTIME_IS_NOT_OSS": "1" if not runtime.is_oss else "0",
101+
}
102+
if not runtime.is_oss and _ENABLE_VGF:
103+
test_env.update({
104+
"MODEL_CONVERTER_PATH": "$(location fbsource//third-party/pypi/ai-ml-sdk-model-converter/0.9.0:model-converter-bin)",
105+
"MODEL_CONVERTER_LIB_DIR": "$(location fbsource//third-party/nvidia-nsight-systems:linux-x86_64)/host-linux-x64",
106+
"LAVAPIPE_LIB_PATH": "$(location fbsource//third-party/mesa:vulkan_lvp)",
107+
"EMULATION_LAYER_TENSOR_SO": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:libVkLayer_Tensor)",
108+
"EMULATION_LAYER_GRAPH_SO": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:libVkLayer_Graph)",
109+
"EMULATION_LAYER_TENSOR_JSON": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:VkLayer_Tensor_json)",
110+
"EMULATION_LAYER_GRAPH_JSON": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:VkLayer_Graph_json)",
111+
})
99112

100113
python_pytest(
101114
name = test_name,
@@ -105,15 +118,7 @@ def define_arm_tests():
105118
compile = "with-source",
106119
typing = False,
107120
skip_on_mode_mac = True,
108-
env = {} if runtime.is_oss else ({
109-
"MODEL_CONVERTER_PATH": "$(location fbsource//third-party/pypi/ai-ml-sdk-model-converter/0.9.0:model-converter-bin)",
110-
"MODEL_CONVERTER_LIB_DIR": "$(location fbsource//third-party/nvidia-nsight-systems:linux-x86_64)/host-linux-x64",
111-
"LAVAPIPE_LIB_PATH": "$(location fbsource//third-party/mesa:vulkan_lvp)",
112-
"EMULATION_LAYER_TENSOR_SO": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:libVkLayer_Tensor)",
113-
"EMULATION_LAYER_GRAPH_SO": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:libVkLayer_Graph)",
114-
"EMULATION_LAYER_TENSOR_JSON": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:VkLayer_Tensor_json)",
115-
"EMULATION_LAYER_GRAPH_JSON": "$(location fbsource//third-party/arm-ml-emulation-layer/v0.9.0/src:VkLayer_Graph_json)",
116-
} if _ENABLE_VGF else {}),
121+
env = test_env,
117122
preload_deps = [
118123
"//executorch/kernels/quantized:custom_ops_generated_lib",
119124
] + ([] if runtime.is_oss or not _ENABLE_VGF else [

0 commit comments

Comments
 (0)