Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195699
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c007619 with merge base 81deebd ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
I want to let @chuanqi129 make the final decision. Before that, I would like to understand the motivation. |
|
@xuhancn Seems the xpu build job is still timeout |
Still debugging it. |
7e474ab to
87732cc
Compare
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Root cause: unified manywheel reconfigures once per Python ABI, and torch-xpu-ops FindSYCL custom-script content depends on target include directories. We already removed direct Python include dirs, but Python-derived transitive includes (for example site-packages/NumPy paths) can still vary by ABI and churn the generated SYCL custom-command scripts, causing avoidable torch_xpu_ops_gen rebuilds. Fix: filter TORCH_XPU_OPS_INCLUDE_DIRS to exclude site-packages and python-versioned include path segments before add_subdirectory(third_party/torch-xpu-ops). This keeps SYCL custom-command inputs more ABI-agnostic and increases cross-iteration reuse. Test Plan: ```bash lintrunner -a -m upstream/main git diff --check ``` AI-assisted: This commit was authored with the help of an AI coding assistant.
Root cause: In unified manywheel jobs each Python-ABI iteration reconfigures the same build directory with that iteration's own cmake/ninja wheels (installed per /opt/python/cp3XX env by requirements-build.txt). CMake embeds CMAKE_COMMAND's absolute path in the cmake_transform_depfile step it synthesizes for DEPFILE-based custom commands, which is how every torch-xpu-ops SYCL device object is compiled. Because that path changes per iteration, Ninja sees a changed command and recompiles all torch-xpu-ops SYCL device objects plus the multi-minute torch_xpu_ops device link on every Python iteration, so XPU iterations cost ~64 min each instead of CUDA's ~10 min and the 8-Python job cannot finish within the 420-minute timeout. Fix: Pin one cmake/ninja (captured on the first iteration) at the front of PATH for the rest of the loop, so every Python-ABI iteration reconfigures with an identical CMAKE_COMMAND. SYCL custom-command commands stay byte-stable across ABIs and Ninja reuses the previously built device objects, skipping the device link on later iterations. The alternative of fixing this inside torch-xpu-ops FindSYCL was rejected: the depfile-transform step is synthesized by CMake itself and is not reachable from the FindSYCL custom commands, so the churn can only be removed at build orchestration level. Verified locally by reconfiguring the same XPU build tree for Python 3.10 and then Python 3.11: with CMAKE_COMMAND held constant, the ninja edges for all torch-xpu-ops SYCL device objects are byte-identical (only python-bound edges differ), confirming the churn comes from the cmake path rather than Python include/ABI flags. Test Plan: ```bash bash -n .ci/manywheel/build.sh shellcheck .ci/manywheel/build.sh lintrunner .ci/manywheel/build.sh git diff --check ``` CI rerun of linux-binary-manywheel manywheel-xpu-build should show Python-ABI iterations after the first dropping from ~64 min to ~10-15 min each. AI-assisted: This commit was authored with the help of an AI coding assistant.
scikit-build-core prefers the importable cmake and ninja packages from each Python environment, so prepending shared symlinks to PATH did not keep CMAKE_COMMAND stable. Each ABI therefore changed every SYCL depfile command and rebuilt the XPU kernels. Set CMAKE_EXECUTABLE explicitly and pass the shared Ninja path through CMAKE_ARGS. Local Python 3.10 and 3.11 XPU builds both completed successfully; the second build performed zero SYCL object compilations and zero XPU device links. Test Plan: ```bash python -m pip install -e . -v --no-build-isolation spin lint ``` AI-assisted: This commit was authored with the help of an AI coding assistant. Co-authored-by: Copilot <[email protected]>
|
Successfully rebased |
8991197 to
b05d60f
Compare
Hi @EikanWang, the main motivation is to reduce CD costs. |
|
Keep the torch-xpu-ops compute target explicitly Python-ABI-independent and validate both source and generated oneDNN headers before reusing an existing build. Use the normalized oneDNN ExternalProject prefix consistently so the build and reuse paths agree when the caller does not provide an override.
Test Plan:
spin lint caffe2/CMakeLists.txt cmake/Modules/FindMKLDNN.cmake
git diff --check -- caffe2/CMakeLists.txt cmake/Modules/FindMKLDNN.cmake
AI-assisted: This commit was authored with the help of an AI coding assistant and reviewed by the author.
|
@pytorchmergebot merge -f "all looks good, lets merge" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…le-runner rebase The pytorchmergebot rebase onto main brought in pytorch#195699, which routes the XPU manywheel build through the unified build_all.sh job. That commit's template change merged cleanly, but the pre-rendered generated workflow was taken textually from main, where the script still lived at .ci/manywheel/build_all.sh. This branch moved it to .ci/wheel/linux/, so manywheel-xpu-build failed with "No such file or directory" and workflow-checks/lint flagged the generated file as stale. Regenerating from the merged template fixes exactly that one line. The same rebase also brought in the native-aot workflow (pytorch#190899), whose paths filter names .ci/manywheel/build.sh. That entry is repointed to the moved script so edits to the Linux build script keep triggering the workflow. Test Plan: ``` uv run --no-project --python 3.10 --with jinja2 --with typing_extensions --with pyyaml python .github/scripts/generate_ci_workflows.py git diff --stat # only generated-linux-binary-manywheel-nightly.yml, 1 line grep -rn '\.ci/manywheel' .github .ci # empty lintrunner .github/workflows/native-aot.yml .github/workflows/generated-linux-binary-manywheel-nightly.yml ``` Authored with an AI assistant. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Take over #188136.
Builds all Linux XPU manywheel variants in one job, reusing ABI-independent C++/SYCL artifacts across Python versions while rebuilding Python-bound artifacts per interpreter.
Before vs after
Comparing the eight XPU matrix builds from #195438 run 33729050328 with the unified build from this PR, run 34123506914:
Linux XPU build runner-minutes
This saves approximately 484 runner-minutes per XPU manywheel build.
Per-Python build breakdown
The first build establishes the shared XPU backend. Subsequent interpreters reuse the SYCL kernel objects and device link, rebuilding only Python-ABI-bound components.
Fix for SYCL reuse
The earlier PATH-only tool pin did not prevent scikit-build-core from selecting the importable CMake/Ninja packages in each Python environment. The final implementation explicitly sets
CMAKE_EXECUTABLEand passes the shared Ninja path throughCMAKE_ARGS, keeping CMake's generated SYCL depfile commands stable across the loop.Local Python 3.10 then Python 3.11 XPU builds confirmed zero SYCL object recompilations and zero XPU device relinks on the second build.
cc @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @snadampal