Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201113
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7c4b1e4 with merge base 6e33a88 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
My agent came up with this analysis, but I've read and approved it.
|
|
|
Addresses review feedback: the CK GEMM architecture allowlist was hardcoded
in three places (torch_filter_ck_gemm_arches, Context::ckGemmSupported, and
the ck_gemm_{half,bfloat16}.hip dispatch), and the gfx11/gfx12 WMMA path
could only be re-enabled by editing source in multiple spots.
Introduce a single CMake cache variable TORCH_CK_GEMM_ARCH_LIST (default
gfx90a;gfx942;gfx950). torch_filter_ck_gemm_arches reads it to select the
ck_gemm build architectures, and it is surfaced to C++ through a generated
ATen/ROCmCKGEMMConfig.h header (mirroring the existing AT_ROCM_CK_SDPA_ARCHS
mechanism) that Context.cpp and the .hip dispatch parse. The per-site
hardcoded lists and keep-in-sync comments are removed.
Default behavior is unchanged. A WMMA arch can now be opted back in at both
build and run time without patching source, e.g.
-DTORCH_CK_GEMM_ARCH_LIST="gfx90a;gfx942;gfx950;gfx1200".
Test Plan:
Verified the CMake wiring with a standalone project that includes
cmake/public/utils.cmake and configure_file()s the new header:
```
# default allowlist
PYTORCH_ROCM_ARCH="gfx942;gfx1250-strict;gfx950;gfx1200"
torch_filter_ck_gemm_arches -> gfx942;gfx950
ROCmCKGEMMConfig.h -> #define TORCH_CK_GEMM_ARCH_LIST "gfx90a,gfx942,gfx950"
# override pulls the gfx1200 WMMA arch into build and runtime
cmake -DTORCH_CK_GEMM_ARCH_LIST="gfx90a;gfx942;gfx950;gfx1200"
torch_filter_ck_gemm_arches -> gfx942;gfx950;gfx1200
ROCmCKGEMMConfig.h -> #define TORCH_CK_GEMM_ARCH_LIST "gfx90a,gfx942,gfx950,gfx1200"
```
Full compile+link verification on gfx90a, gfx942, gfx950 (single and
combined) is being run separately.
Authored with assistance from an AI coding agent (Claude).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
0a856a6 to
4e1be93
Compare
jeffdaily
left a comment
There was a problem hiding this comment.
My agent came up with this analysis, but I've read and approved it.
Thanks for moving the list to
TORCH_CK_GEMM_ARCH_LIST. Three things before this is ready:
- The comma-list parser is now copied four times (
Context.cppfor CK SDPA and CK GEMM, and bothck_gemm_{half,bfloat16}.hip), and the fallback default three times. In the.hipdispatch, theelse ifcan callat::globalContext().ckGemmSupported()instead, which removes the header include, the parser and the fallback from both files. InContext.cpp, please share one parse helper betweenckSDPASupported()andckGemmSupported().TORCH_CK_GEMM_ARCH_LISTis not forwarded from the environment, so apip installbuild cannot set it without-C cmake.define=.... Please add it to the passthrough list incmake/EnvVarForwarding.cmakenext toTORCH_CUDA_ARCH_LIST, and to the reference list at the top of that file.- Please add a test plan to the description showing the default build and a
TORCH_CK_GEMM_ARCH_LISToverride, then mark the PR ready so CI runs.
Addresses review feedback on the TORCH_CK_GEMM_ARCH_LIST change:
- Consolidate the comma-separated arch-list parser into a single
parseArchList helper in Context.cpp, shared by ckSDPASupported() and
ckGemmSupported(). The ck_gemm_{half,bfloat16}.hip dispatch now calls
at::globalContext().ckGemmSupported() instead of re-parsing the list, so
the generated-header include, the parser, and the fallback define are
removed from both .hip files (the parser lived in four places and the
fallback in three).
- Forward TORCH_CK_GEMM_ARCH_LIST from the environment by adding it to
cmake/EnvVarForwarding.cmake (the reference list and _ENV_PASSTHROUGH), so
a pip install / setup.py build can set it without -C cmake.define=...
Test Plan:
Full compile+link build with PYTORCH_ROCM_ARCH="gfx90a gfx942 gfx950":
```
pip install -e . --no-build-isolation -v # rc=0, 4911 ninja steps, 0 failed
```
ck_gemm compiles for all three archs (ck_gemm_half.hip.o offload bundle =
gfx90a,gfx942,gfx950) and libtorch_hip.so links, confirming the new
ck_gemm -> at::Context::ckGemmSupported() cross-TU call resolves.
Authored with assistance from an AI coding agent (Claude).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
@jeffdaily ready for next round of review |
The ck_gemm_{half,bfloat16}.hip dispatch now calls ckGemmSupported() on every CK GEMM, and it walked every visible device and re-parsed the arch list each time. Compute it once; the device set does not change within a process.
Authored with Claude.
jeffdaily
left a comment
There was a problem hiding this comment.
My agent came up with this analysis, but I've read and approved it.
All three points from the last round are addressed at bfc3aea: one
parseArchListhelper inContext.cpp, the.hipdispatch callsckGemmSupported()with no header, parser or fallback of its own,TORCH_CK_GEMM_ARCH_LISTis in theEnvVarForwarding.cmakepassthrough and reference lists, and the description has a test plan.
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Resolve the conflict with pytorch#201113 in gemm_internal_ck<BFloat16> and gemm_internal_ck<Half>: keep main's ckGemmSupported() check and this branch's bool return from the gfx9 dispatch. Authored with Claude.
…llow-list (#3979) Backport of the CK GEMM single-source allow-list to release/2.13. Replaces the gfx1250 blacklist (list(REMOVE_ITEM ... gfx1250 gfx1250-strict)) with a single CMake cache variable TORCH_CK_GEMM_ARCH_LIST (default gfx90a;gfx942;gfx950) that drives the ck_gemm build arch filter (torch_filter_ck_gemm_arches) and is surfaced to C++ via a generated ATen/ROCmCKGEMMConfig.h header. release/2.13 predates the CK SDPA/GEMM gating split (upstream pytorch#187267) and had no ckGemmSupported() -- only a combined ckSupported(). This adds Context::ckGemmSupported() (parsing TORCH_CK_GEMM_ARCH_LIST via a shared parseArchList helper) and routes the CK blas-backend gate through it, leaving the CK SDPA / flash-attention gates on ckSupported(). The ck_gemm_{half,bfloat16}.hip dispatch calls at::globalContext().ckGemmSupported() instead of an isGPUArch({"gfx9"}) prefix check. TORCH_CK_GEMM_ARCH_LIST is forwarded from the environment via cmake/EnvVarForwarding.cmake. Squashed backport of upstream pytorch/pytorch pytorch#200307 (base allow-list) and pytorch#201113 (TORCH_CK_GEMM_ARCH_LIST consolidation). Once these are merged need to revert ROCm/TheRock#9414 Co-authored-by: Claude Opus 4.8 <[email protected]>
…llow-list (#3980) Backport of the CK GEMM single-source allow-list to release/2.14. Replaces the gfx1250 blacklist (list(REMOVE_ITEM ... gfx1250 gfx1250-strict)) with a single CMake cache variable TORCH_CK_GEMM_ARCH_LIST (default gfx90a;gfx942;gfx950) that drives the ck_gemm build arch filter (torch_filter_ck_gemm_arches) and is surfaced to C++ via a generated ATen/ROCmCKGEMMConfig.h header. Context::ckGemmSupported() parses that list (shared parseArchList helper) and the ck_gemm_{half,bfloat16}.hip dispatch calls at::globalContext().ckGemmSupported() instead of an isGPUArch({"gfx9"}) prefix check. TORCH_CK_GEMM_ARCH_LIST is forwarded from the environment via cmake/EnvVarForwarding.cmake. Squashed backport of upstream pytorch/pytorch pytorch#200307 (base allow-list) and pytorch#201113 (TORCH_CK_GEMM_ARCH_LIST consolidation). Once these are merged need to revert ROCm/TheRock#9414 Co-authored-by: Claude Opus 4.8 <[email protected]>
Summary
The CK GEMM supported-architecture allowlist currently lives hardcoded in three
places:
torch_filter_ck_gemm_arches(cmake/public/utils.cmake), the runtimecheck
at::Context::ckGemmSupported(), and thegemm_internal_ckdispatch inck_gemm_{half,bfloat16}.hip. Keeping them in sync is manual, and thegfx11/gfx12 WMMA path (#143971) can only be re-enabled by editing source in
several spots.
This PR makes the list a single source of truth:
TORCH_CK_GEMM_ARCH_LIST(defaultgfx90a;gfx942;gfx950) drives theck_gemmbuild arch filter and is surfacedto C++ through a generated
ATen/ROCmCKGEMMConfig.hheader, mirroring theexisting
AT_ROCM_CK_SDPA_ARCHSmechanism. It is forwarded from theenvironment via
cmake/EnvVarForwarding.cmake.Context.cppparses the list once through a sharedparseArchListhelperused by both
ckSDPASupported()andckGemmSupported()..hipdispatch callsat::globalContext().ckGemmSupported()instead ofre-parsing the list, so the header include, the parser, and the fallback are
removed from both
.hipfiles.A WMMA arch can now be opted back in at both build and run time without patching
source, e.g.
TORCH_CK_GEMM_ARCH_LIST="gfx90a;gfx942;gfx950;gfx1200".BC-breaking
No. Default behavior is unchanged -- the default list is the same three archs
that were previously hardcoded.
Supporting maintainer
@jeffdaily (requested this refactor in review).
Test plan
CMake wiring, standalone project including
cmake/public/utils.cmake:torch_filter_ck_gemm_archesfiltersgfx942;gfx1250-strict;gfx950;gfx1200togfx942;gfx950; generated header#define TORCH_CK_GEMM_ARCH_LIST "gfx90a,gfx942,gfx950".TORCH_CK_GEMM_ARCH_LIST="gfx90a;gfx942;gfx950;gfx1200": filter keepsgfx942;gfx950;gfx1200; header"gfx90a,gfx942,gfx950,gfx1200".Full build:
rc=0, 0 failed.
ck_gemm_half.hip.ooffload bundle =gfx90a,gfx942,gfx950;libtorch_hip.solinks (theck_gemm->Context::ckGemmSupported()cross-TUcall resolves).
cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang