Repository navigation
[ROCm][Inductor] Advance CK pin, Generate ck/config.h for the CK wheel and re-enable CI tests - #195658
[ROCm][Inductor] Advance CK pin, Generate ck/config.h for the CK wheel and re-enable CI tests#195658andriy-ca wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195658
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (5 Unrelated Failures)As of commit 090a323 with merge base 6fac2b6 ( NEW FAILURES SUPPRESSED BY AI (non-blocking) - The following job failed, but the AI CI Advisor judged the failure not to be evidence against this change:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
1 similar comment
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
|
@pytorchbot label "topic: not user facing" |
|
LGTM. I tested the PR on a system which doesn't ship ck headers, ck config.h got generated and ck inductor tests passed. |
Thanks for testing on a system without the CK headers. Reference added to the summary. |
|
Took a pass over this. Three things I'd like addressed before it lands, plus a note on CI. Findings below were drafted with an AI assistant and reviewed by me:
Non-blocking, but worth fixing while the mirror is fresh: On CI: Findings in the quoted block above were drafted with an AI assistant. |
The pinned commit predates the gfx1250 work: it has no WMMA instance enumerators, so the WMMA backends find nothing and their tests skip rather than run. It also does not ship the CK-Tile headers in the wheel, which ROCm no longer installs system-wide. The new pin adds WMMA enumeration for universal GEMM, batched GEMM and grouped convolution, ships the CK-Tile headers and the batched WMMA instance sources, and adds a header-resolution diagnostic. Instance enumeration is also now deterministic and duplicate-free, so the same wheel offers the same candidates on every machine.
Seven subtests were skipped on ROCm 7.14 and above because the classic CK path failed against the pinned Composable Kernel commit. That pin is from May and predates six months of CK work, while CI now builds against ROCm 10.0 -- so the guard covers every ROCm job rather than the one release it was written for, and the tests it disables never run anywhere. The preceding pin bump is what makes them viable again: enumeration is deterministic and duplicate-free, so a given wheel offers the same candidates on every machine rather than depending on filesystem order. Test IDs are unchanged, so prior runs remain comparable.
ROCm 7.14 stopped installing the CK headers system-wide, so the inductor CK backends now compile against what the ck4inductor wheel ships. One header is missing from that set: ck/config.h is generated by CK's build from include/ck/config.h.in, so it is in neither the wheel nor $ROCM_HOME. Without it every CK choice fails to compile and is silently discarded, and the user sees an autotune with no CK candidates. Generate it during the wheel build and package it with the rest of include/ck. CK's own CMake cannot produce it in the wheel-build container: CMakeLists.txt calls find_package(ROCM), find_package(hip REQUIRED) and enable_language(HIP), and the image has hipcc but no ROCm CMake packages. config.h.in substitutes only plain variables, so the new helper sets them and runs the same configure_file in cmake script mode. The helper mirrors CK's arch rules rather than referencing them, so it assigns every variable unconditionally -- "ON" or empty -- instead of only in the true branch. Leaving a variable undefined would be indistinguishable from a deliberate OFF, which both defeats the drift check and makes the script reject any target list that does not happen to enable everything. Verified against the header CK's own CMake produces: the output for GPU_TARGETS=gfx1100 is byte-identical to /opt/rocm/include/ck/config.h from a ROCm 7.15 install, and every CK_USE_* macro matches the gfx942, gfx950 and gfx1250 headers shipped in their respective ROCm images.
94c7f6e to
097c274
Compare
|
Thanks — all four findings reproduced, and three turned out to share a root cause. Reply below was drafted by an AI agent and edited by me: Findings 1–3: the diagnostic is withdrawn rather than fixed.Working out how to fix finding 2 showed that the code it lives in no longer has a justification:
torch/_inductor/utils.py is now byte-identical to main and no longer appears in the diff. That is also finding 3's answer: rather than adding a test asserting the gates are unchanged, the three gate functions are provably untouched. Finding 4: fixed, and the problem was larger than reported.All three drift claims confirmed against /opt/rocm/include/ck/config.h taken from real ROCm images. While fixing them I found the generator raised FATAL_ERROR for every target list except the exact one we pass — the arch blocks only assigned in the true branch, so the drift check could not distinguish "OFF for this arch" from "the script forgot it". Your FP8 correction is right: ON is an undefined identifier in #if, so neither arm is taken. There is no #define ON anywhere in CK. The mechanism is that CK pairs each FP8 macro with add_definitions(-DCK_USE_OCP_FP8), an empty definition, and that is what #if actually sees in a real build — we emit the header but not the -D flags. The comment now records this and notes the fix would belong in compile_command.py if the fp8 path is ever enabled, rather than changing a value here and diverging from the header ROCm ships. |
|
Re-reviewed the reworked version. The four earlier findings are resolved: I re-derived Two things left before this lands, both small. Findings below were drafted with an AI assistant and reviewed by me:
Two description fixes while you are in there: "the Findings in the quoted block above were drafted with an AI assistant. |
Effect on the generated header: CK_USE_WMMA and CK_USE_WMMA_FP8 become undefined; XDL, GFX94, OCP_FP8, FNUZ_FP8 and NATIVE_MX are unchanged. gfx1250 support is deferred to a follow-up that extends ck_supported_arch and this list together.
|
Thanks — both fixed. Head is now 090a323 TitleUpdated to Arch listRestricted generation of the # torch/_inductor/config.py
ck_supported_arch: list[Literal["gfx90a", "gfx942", "gfx950"]] = [...]
Introduction of gfx1250 definitions is deferred to the follow-up, which extends DescriptionBoth fixed:
|
|
The docker image build failures are present on other PRs, so not this PR's fault. @pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 5 checks: inductor / unit-test / inductor-cpu-test / test (inductor_aoti_fallback, 2, 2, mt-l-x86iamx-8-64, unstable), inductor / unit-test / inductor-cpu-test / test (inductor_aoti_fallback, 1, 2, mt-l-x86iamx-8-64, unstable), Build manywheel docker images / manylinux2_28-builder:cuda13.0, Build manywheel docker images / manylinux2_28-builder:rocm10.0, Build almalinux docker images / build-docker (cuda12.6) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Advances the
rocm-composable-kernelpin and generates the one CK header the wheeldoes not ship. Restores CK autotuning in CI disabled due to stale pin.
Motivation
ROCm 7.14 stopped installing the CK headers system-wide, so the inductor CK backends
now compile against what the
ck4inductorwheel ships. Every header they#includeis checked into CK except one:
ck/config.his generated by CK's build frominclude/ck/config.h.in, so it exists in neither ROCm nor the wheel's source tree.Without it every CK choice fails to compile and is silently discarded, so the CK backends
contribute no autotune candidates at all rather than reporting a missing header.
Scope: this restores CK autotuning in CI. The ROCm CD path has routed through the
Python build pipeline since #182696 and has no CK step.
Changes
Generate
ck/config.h(.ci/pytorch/rocm_utils.sh,.ci/pytorch/generate_ck_config_h.cmake)build_rocm_ck_wheel()now generates the header forgfx90a;gfx942;gfx950and packages itwith the rest of
include/ck. This replaces theck_tilepyproject.tomlpatch, which the newpin makes a no-op.
CK's own CMake cannot produce it in the wheel-build container:
CMakeLists.txtcallsfind_package(ROCM),find_package(hip REQUIRED)andenable_language(HIP), and theimage has
hipccbut no ROCm CMake packages.config.h.insubstitutes only plainvariables, so the helper sets them and runs the same
configure_fileincmake -Pscript mode.
The helper mirrors CK's arch rules rather than referencing them, so it assigns every
variable unconditionally —
"ON"or empty — instead of only in the true branch.Leaving one undefined would be indistinguishable from a deliberate OFF, which both
defeats the drift check and makes the script reject any target list that does not
happen to enable everything.
Pin bump
4266f867→e2daf442The outgoing pin is from February. The new one packages the
ck_tileheaders inpyproject.toml, which makes the patch #189646 added torocm_utils.sha no-op. Italso makes instance enumeration deterministic and duplicate-free, so a given wheel
offers the same candidates on every machine instead of depending on filesystem order.
This pin is also a prerequisite for follow-up PRs adding gfx1250 WMMA support.
Re-enable version-skipped tests (
test/inductor/test_ck_backend.py)Removes seven
skipIfRocmVersionAtLeast([7, 14])decorators, added in #188593 (andone in #188429) for known 7.14 failures. The predicate is
>=, so on ROCm 10.x itevaluates true and these subtests are skipped on every current ROCm CI job rather than
only on the 7.14 release they were written for.
Test plan
Verified on hardware with both wheels built from this branch — the CK wheel by the
real
build_rocm_ck_wheel(), so the code under test is what produced the artifact.The 8 skips are the
scaled_mmcells, skipped upstream for unrelated reasons.@pytorchbot label "topic: not user facing"
cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben