Skip to content

Commit 530c96b

Browse files
committed
Merge the updated #24299 cherry-pick into the #24314 cherry-pick
2 parents 07002ff + b4f29e3 commit 530c96b

19 files changed

Lines changed: 189 additions & 38 deletions

‎.ci/scripts/tests/test_filter_cuda_matrix.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ def test_supported_toolkits_select_the_matching_torch_index(self):
327327
INSTALL_UTILS.platform, "system", return_value="Linux"
328328
), mock.patch.object(
329329
INSTALL_UTILS.subprocess, "run", return_value=detected
330+
), mock.patch.dict(
331+
os.environ, {"CMAKE_ARGS": "-DEXECUTORCH_BUILD_CUDA=ON"}
330332
):
331333
self.assertEqual(
332334
INSTALL_UTILS.determine_torch_url(base_url),

‎.ci/scripts/wheel/test_shared_libraries.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
_AOTI_SHIM_SYMBOLS = (
9393
"aoti_torch_empty_strided",
9494
"aoti_torch_delete_tensor_object",
95+
"aoti_torch_dtype_element_size",
9596
"executorch::backends::cuda::CUDAStreamGuard::create",
9697
# From the CUDA sources rather than the C++ ones. The build drops every .cu file when no working
9798
# compiler is found, and the library is still produced from its .cpp sources, so a check that

‎.github/workflows/pull.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ jobs:
213213
EXECUTORCH_PYBIND_TEST_BFLOAT16_CHANNELS_LAST_PTE=cmake-out-no-aten/add_bfloat16_channels_last.pte \
214214
PYTHONPATH=cmake-out-no-aten:.. \
215215
python extension/pybindings/test/test_pybindings_no_aten.py
216-
if ldd cmake-out-no-aten/_C*.so | grep -Eiq 'torch|aten|c10'; then
216+
NO_ATEN_LINKS="$(ldd cmake-out-no-aten/_C*.so)"
217+
printf '%s\n' "$NO_ATEN_LINKS"
218+
if grep -q 'not found' <<<"$NO_ATEN_LINKS"; then
219+
echo "torch-free pybindings have a missing runtime dependency"
220+
exit 1
221+
fi
222+
if grep -Eiq '^[[:space:]]*(lib(torch|aten|c10)[^[:space:]/]*\.so|[^[:space:]]*/lib(torch|aten|c10)[^[:space:]/]*\.so)' <<<"$NO_ATEN_LINKS"; then
217223
echo "torch-free pybindings unexpectedly link against ATen"
218224
exit 1
219225
fi

‎.github/workflows/release-runner-groups-refresh.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,20 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26+
dispatch:
27+
if: github.repository_owner == 'pytorch' && github.event_name == 'push'
28+
runs-on: ubuntu-latest
29+
permissions:
30+
actions: write
31+
steps:
32+
- name: Refresh runner groups from protected main
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
GH_REPO: ${{ github.repository }}
36+
run: gh workflow run release-runner-groups-refresh.yml --ref main -f apply=true
37+
2638
reconcile:
27-
if: github.repository_owner == 'pytorch'
39+
if: github.repository_owner == 'pytorch' && github.event_name != 'push'
2840
runs-on: ubuntu-latest
2941
environment: ${{ github.event_name != 'pull_request' && 'runner-group' || '' }}
3042
steps:

‎backends/aoti/common_shims_slim.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ int32_t aoti_torch_dtype_bool() {
177177
return 11; // ScalarType::Bool
178178
}
179179

180+
size_t aoti_torch_dtype_element_size(int32_t dtype) {
181+
using namespace executorch::backends::aoti::slim::c10;
182+
return elementSize(static_cast<ScalarType>(dtype));
183+
}
184+
180185
// ============================================================
181186
// Device Type Constants - Implementations
182187
// ============================================================

‎backends/aoti/common_shims_slim.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_int8();
9292
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_uint8();
9393
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_bool();
9494

95+
AOTI_SHIM_EXPORT size_t aoti_torch_dtype_element_size(int32_t dtype);
96+
9597
// ============================================================
9698
// Device Type Constants - Declarations
9799
// ============================================================

backends/arm/public_api_manifests/api_manifest_1_4.toml renamed to backends/arm/public_api_manifests/api_manifest_1_6.toml

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ signature = "EthosUBackend.preprocess(edge_program: torch.export.exported_progra
1818

1919
[python.EthosUCompileSpec]
2020
kind = "class"
21-
signature = "EthosUCompileSpec(target: str, system_config: str | None = None, memory_mode: str | None = None, extra_flags: list[str] | None = None, config_ini: str | None = 'Arm/vela.ini')"
21+
signature = "EthosUCompileSpec(target: str, system_config: str | None = None, memory_mode: str | None = None, extra_flags: list[str] | None = None, config_ini: str | None = 'Arm/vela.ini', external_block_placements: executorch.backends.arm.ethosu.compile_spec.VelaExternalBlockPlacements | None = None, max_scratch_size: int | None = None)"
2222

2323
[python.EthosUCompileSpec.DebugMode]
2424
kind = "enum"
@@ -60,6 +60,10 @@ signature = "EthosUPartitioner.partition(self, exported_program: torch.export.ex
6060
kind = "function"
6161
signature = "EthosUPartitioner.register_custom_partition_op(self, op: torch._ops.OpOverload) -> None"
6262

63+
[python.EthosUPartitioner.transform_for_pre_decomposition]
64+
kind = "function"
65+
signature = "EthosUPartitioner.transform_for_pre_decomposition(self, exported_program: torch.export.exported_program.ExportedProgram) -> torch.export.exported_program.ExportedProgram"
66+
6367
[python.EthosUQuantizer]
6468
kind = "class"
6569
signature = "EthosUQuantizer(compile_spec: 'EthosUCompileSpec', use_composable_quantizer: 'bool' = True) -> 'None'"
@@ -92,6 +96,38 @@ signature = "EthosUQuantizer.transform_for_annotation(self, model: 'GraphModule'
9296
kind = "function"
9397
signature = "EthosUQuantizer.validate(self, model: 'GraphModule') -> 'None'"
9498

99+
[python.VelaExternalBlockPlacements]
100+
kind = "class"
101+
signature = "VelaExternalBlockPlacements(cmd_data: str | None = None, weight_data: str | None = None) -> None"
102+
103+
[python.VelaExternalBlockPlacements.__delattr__]
104+
kind = "function"
105+
signature = "VelaExternalBlockPlacements.__delattr__(self, name)"
106+
107+
[python.VelaExternalBlockPlacements.__eq__]
108+
kind = "function"
109+
signature = "VelaExternalBlockPlacements.__eq__(self, other)"
110+
111+
[python.VelaExternalBlockPlacements.__hash__]
112+
kind = "function"
113+
signature = "VelaExternalBlockPlacements.__hash__(self)"
114+
115+
[python.VelaExternalBlockPlacements.__post_init__]
116+
kind = "function"
117+
signature = "VelaExternalBlockPlacements.__post_init__(self) -> None"
118+
119+
[python.VelaExternalBlockPlacements.__repr__]
120+
kind = "function"
121+
signature = "VelaExternalBlockPlacements.__repr__(self)"
122+
123+
[python.VelaExternalBlockPlacements.__setattr__]
124+
kind = "function"
125+
signature = "VelaExternalBlockPlacements.__setattr__(self, name, value)"
126+
127+
[python.VelaExternalBlockPlacements.to_block_placements]
128+
kind = "function"
129+
signature = "VelaExternalBlockPlacements.to_block_placements(self) -> dict[str, str]"
130+
95131
[python.VgfBackend]
96132
kind = "class"
97133
signature = "VgfBackend()"
@@ -102,7 +138,7 @@ signature = "VgfBackend.preprocess(edge_program: torch.export.exported_program.E
102138

103139
[python.VgfCompileSpec]
104140
kind = "class"
105-
signature = "VgfCompileSpec(tosa_spec: executorch.backends.arm.tosa.specification.TosaSpecification | str | None = None, compiler_flags: list[str] | None = None)"
141+
signature = "VgfCompileSpec(tosa_spec: executorch.backends.arm.tosa.specification.TosaSpecification | str | None = None, compiler_flags: list[str] | None = None, emit_debug_info: bool = False)"
106142

107143
[python.VgfCompileSpec.DebugMode]
108144
kind = "enum"
@@ -148,6 +184,10 @@ signature = "VgfPartitioner.partition(self, exported_program: torch.export.expor
148184
kind = "function"
149185
signature = "VgfPartitioner.register_custom_partition_op(self, op: torch._ops.OpOverload) -> None"
150186

187+
[python.VgfPartitioner.transform_for_pre_decomposition]
188+
kind = "function"
189+
signature = "VgfPartitioner.transform_for_pre_decomposition(self, exported_program: torch.export.exported_program.ExportedProgram) -> torch.export.exported_program.ExportedProgram"
190+
151191
[python.VgfQuantizer]
152192
kind = "class"
153193
signature = "VgfQuantizer(compile_spec: 'VgfCompileSpec', use_composable_quantizer: 'bool' = True) -> 'None'"
@@ -187,3 +227,61 @@ signature = "get_symmetric_a16w8_quantization_config(is_per_channel: 'bool' = Tr
187227
[python.get_symmetric_quantization_config]
188228
kind = "function"
189229
signature = "get_symmetric_quantization_config(is_per_channel: 'bool' = True, is_qat: 'bool' = False, is_dynamic: 'bool' = False, act_qmin: 'int' = -128, act_qmax: 'int' = 127, weight_qmin: 'int' = -127, weight_qmax: 'int' = 127, eps: 'float' = 1.52587890625e-05) -> 'QuantizationConfig'"
230+
231+
[cmake]
232+
233+
[cmake.arm_runner_add_minimal_executable]
234+
kind = "function"
235+
signature = "arm_runner_add_minimal_executable(*, TARGET, SOURCE, OPS_PREFIX, COMPILE_DEFINITIONS=())"
236+
237+
[cmake.arm_runner_add_standalone_executorch]
238+
kind = "macro"
239+
signature = "arm_runner_add_standalone_executorch()"
240+
241+
[cmake.arm_runner_configure_ethos_u_platform]
242+
kind = "function"
243+
signature = "arm_runner_configure_ethos_u_platform(*, SDK_PATH, SYSTEM_CONFIG, MEMORY_MODE)"
244+
245+
[cmake.arm_runner_configure_linker_script]
246+
kind = "function"
247+
signature = "arm_runner_configure_linker_script(*, TARGET, SYSTEM_CONFIG, OUTPUT_NAME=None)"
248+
249+
[cmake.arm_runner_configure_model]
250+
kind = "function"
251+
signature = "arm_runner_configure_model(*, TARGET, PTE_FILE=None, MODEL_PTE_ADDR=None, MODEL_PTE_SIZE=None, PUBLIC=False)"
252+
253+
[cmake.arm_runner_configure_runtime_output]
254+
kind = "function"
255+
signature = "arm_runner_configure_runtime_output(TARGET_NAME, FALLBACK_DIR)"
256+
257+
[cmake.arm_runner_create_default_selected_ops_libs]
258+
kind = "function"
259+
signature = "arm_runner_create_default_selected_ops_libs(*, PREFIX, SUFFIX=None, OP_LIST=None, OPS_FROM_MODEL=None, DTYPE_SELECTIVE_BUILD=None, OUT_LIBS=None, DEPS=())"
260+
261+
[cmake.arm_runner_create_selected_ops_lib]
262+
kind = "function"
263+
signature = "arm_runner_create_selected_ops_lib(*, LIB_NAME, FUNCTIONS_YAML=None, CUSTOM_OPS_YAML=None, OP_LIST=None, OPS_FROM_MODEL=None, DTYPE_SELECTIVE_BUILD=None, KERNEL_LIBS=(), DEPS=(), INCLUDE_ALL_OPS=False, PRIM_OPS=False)"
264+
265+
[cmake.arm_runner_define_cache_options]
266+
kind = "function"
267+
signature = "arm_runner_define_cache_options(*, METHOD_ALLOCATOR_SIZE=None)"
268+
269+
[cmake.arm_runner_link_minimal_specs]
270+
kind = "function"
271+
signature = "arm_runner_link_minimal_specs(TARGET_NAME)"
272+
273+
[cmake.arm_runner_link_registration_libraries]
274+
kind = "function"
275+
signature = "arm_runner_link_registration_libraries(*, TARGET, SCOPE=None, BASE_LIBS=(), REGISTRATION_LIBS=(), NORMAL_LIBS=(), SUPPRESS_LIBS=())"
276+
277+
[cmake.arm_runner_require_baremetal_targets]
278+
kind = "function"
279+
signature = "arm_runner_require_baremetal_targets()"
280+
281+
[cmake.arm_runner_require_python]
282+
kind = "macro"
283+
signature = "arm_runner_require_python()"
284+
285+
[cmake.arm_runner_validate_model_source]
286+
kind = "function"
287+
signature = "arm_runner_validate_model_source(*, ALLOW_SEMIHOSTING=False)"

‎backends/cuda/runtime/aoti_cuda_shims.lib.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ nm --defined-only aoti_cuda_shims.lib \
1515
# add the new names to exports.txt, then
1616
{ echo 'LIBRARY aoti_cuda_shims.dll'; echo 'EXPORTS'; sed 's/^/ /' exports.txt; } \
1717
> aoti_cuda_shims.def
18-
x86_64-w64-mingw32-dlltool -d aoti_cuda_shims.def -l aoti_cuda_shims.lib \
18+
x86_64-w64-mingw32-dlltool -m i386:x86-64 -d aoti_cuda_shims.def -l aoti_cuda_shims.lib \
1919
--dllname aoti_cuda_shims.dll
2020
# zero the archive metadata so the file is reproducible
2121
mkdir extract && cd extract && x86_64-w64-mingw32-ar x ../aoti_cuda_shims.lib \
@@ -27,6 +27,9 @@ The archive has to be built at a fresh path. Updating it in place keeps the reve
2727
member order the generator produced, so the same export list would not give the same
2828
bytes twice.
2929

30+
Use the relative output name shown above in each build directory. The generator embeds
31+
the output name in its object names, so absolute temporary paths change the bytes.
32+
3033
Then check the result is a superset of what it replaced and that no member carries a
3134
timestamp, since this file ships in the wheel and a stamped one makes two builds of
3235
the same source differ.

‎backends/cuda/tests/test_int6_large_quantized_gemm.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ def test_buckets_and_generic_candidate_counts(self):
7676
for bucket, expected in expected_counts.items():
7777
configs = tile_autotune_configs(bucket)
7878
self.assertEqual(len(configs), expected)
79-
self.assertEqual(len(legal_configs(bucket, 256)), expected // 3)
80-
self.assertEqual(len(legal_configs(bucket, 5376)), expected)
79+
legal_expected = 18 if torch.version.hip is not None else expected
80+
self.assertEqual(len(legal_configs(bucket, 256)), legal_expected // 3)
81+
self.assertEqual(len(legal_configs(bucket, 5376)), legal_expected)
8182
self.assertTrue(hasattr(torch.ops.triton, f"int6_quantized_gemm_m{bucket}"))
8283

8384
@unittest.skipUnless(torch.cuda.is_available(), "CUDA required")

‎backends/cuda/triton/kernels/int6_quantized_gemm.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,10 @@ def _tile_main_loop_trips(args) -> int:
12391239

12401240

12411241
def _prune_tiles(configs, named_args, **kwargs):
1242+
if torch.version.hip is not None:
1243+
# Larger M tiles can access invalid memory on masked tails with ROCm
1244+
# 7.14. Keep the eight-row path for the release.
1245+
configs = [config for config in configs if config.kwargs["BLOCK_M"] == 8]
12421246
return prune_by_main_loop_trips(
12431247
_tile_main_loop_trips, configs, named_args, **kwargs
12441248
)

0 commit comments

Comments
 (0)