Skip to content

[ROCm] CK SDPA - Move arch check to CK patch - #144777

Closed
alugorey wants to merge 6 commits into
pytorch:mainfrom
alugorey:fix_guards
Closed

alugorey wants to merge 6 commits into
pytorch:mainfrom
alugorey:fix_guards

Conversation

@alugorey

@alugorey alugorey commented Jan 14, 2025 •

Copy link
Copy Markdown
Contributor

gfxXXX should only be visible by device code. Move the check to the ck kernel

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang @naromero77amd @albanD

@alugorey
alugorey requested review from a team, jeffdaily and jithunnair-amd as code owners January 14, 2025 16:07
@pytorch-bot

pytorch-bot Bot commented Jan 14, 2025 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/144777

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 8 Pending, 1 Unrelated Failure

As of commit 8a7d48e with merge base 19c3ba4 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the release notes: releng release notes category label Jan 14, 2025
@alugorey

Copy link
Copy Markdown
Contributor Author

@jeffdaily Here is the PR to fix the issue we were working on on friday. This PR needs all the relevant CI labels

@bdhirsh bdhirsh added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 15, 2025
@jeffdaily jeffdaily added module: rocm AMD GPU support for Pytorch rocm This tag is for PRs from ROCm team ciflow/rocm labels Jan 15, 2025
@jeffdaily jeffdaily changed the title CK SDPA - Move arch check to CK patch [ROCm] CK SDPA - Move arch check to CK patch Jan 15, 2025
Comment thread tools/amd_build/build_amd.py Outdated
)


def add_make_kernel_pt(line: str) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow! This is actually patching a ck header file in the pytorch build file? That doesn't sound a good idea. Can we add this into CK itself?

Comment thread tools/amd_build/build_amd.py Outdated
// Added by hipification to become a no-op on non supported architectures
template <int MaxThreadPerBlock, int MinBlockPerCu, typename Kernel, typename... Args>
#if CK_TILE_USE_LAUNCH_BOUNDS
__launch_bounds__(MaxThreadPerBlock, MinBlockPerCu)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to throw an error rather than just silent passing.

@xw285cornell xw285cornell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a lot better now, let me test it out internally.

@@ -201,6 +201,7 @@ def remove_hcc(line: str) -> str:
sources.write(line)
print(f"{hip_platform_file} updated")


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to rebase the update_ck PR once this is merged. I will make this change in that PR so we don't have to wait for CI on this one again

@xw285cornell

Copy link
Copy Markdown
Contributor

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased fix_guards onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout fix_guards && git pull --rebase)

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@xw285cornell has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@pytorch-bot
pytorch-bot Bot temporarily deployed to upload-benchmark-results January 22, 2025 07:13 Inactive
@pytorch-bot
pytorch-bot Bot temporarily deployed to upload-benchmark-results January 22, 2025 07:13 Inactive
@pytorch-bot
pytorch-bot Bot had a problem deploying to upload-benchmark-results January 22, 2025 07:13 Failure
@xw285cornell

Copy link
Copy Markdown
Contributor

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 23, 2025
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@pytorch-bot
pytorch-bot Bot temporarily deployed to upload-benchmark-results January 23, 2025 03:39 Inactive
@pytorch-bot
pytorch-bot Bot temporarily deployed to upload-benchmark-results January 23, 2025 03:39 Inactive
@pytorch-bot
pytorch-bot Bot temporarily deployed to upload-benchmark-results January 23, 2025 03:39 Inactive
@xw285cornell

Copy link
Copy Markdown
Contributor

@pytorchbot merge -f "merged internally and skip sanity check"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

poad42 added a commit to poad42/pytorch that referenced this pull request Jun 24, 2026
The CK Tile FMHA generator already compiles working kernels for gfx12
(--targets=gfx1201 passes through to the kernel template), but two
guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in
   PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a
   hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950
   in PR pytorch#155103). gfx1200/gfx1201 were never added despite the
   CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in
   PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only
   listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs,
WITH patch the kernel executes correctly.
poad42 added a commit to poad42/pytorch that referenced this pull request Jun 24, 2026
The CK Tile FMHA generator already compiles working kernels for gfx12
(--targets=gfx1201 passes through to the kernel template), but two
guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in
   PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a
   hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950
   in PR pytorch#155103). gfx1200/gfx1201 were never added despite the
   CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in
   PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only
   listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs,
WITH patch the kernel executes correctly.
poad42 added a commit to poad42/pytorch that referenced this pull request Jun 24, 2026
The CK Tile FMHA generator already compiles working kernels for gfx12
(--targets=gfx1201 passes through to the kernel template), but two
guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in
   PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a
   hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950
   in PR pytorch#155103). gfx1200/gfx1201 were never added despite the
   CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in
   PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only
   listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs,
WITH patch the kernel executes correctly.

Fixes pytorch#188113
pytorchmergebot pushed a commit that referenced this pull request Aug 28, 2026
The CK Tile FMHA generator already compiles working kernels for gfx12 (--targets=gfx1201 passes through to the kernel template), but two guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in PR #144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950 in PR #155103). gfx1200/gfx1201 were never added despite the CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in PR #187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs, WITH patch the kernel executes correctly.

Fixes #188113

Pull Request resolved: #188114
Approved by: https://github.com/eellison, https://github.com/alugorey, https://github.com/jeffdaily

Co-authored-by: doplxyz <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
…h#188114)

The CK Tile FMHA generator already compiles working kernels for gfx12 (--targets=gfx1201 passes through to the kernel template), but two guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950 in PR pytorch#155103). gfx1200/gfx1201 were never added despite the CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs, WITH patch the kernel executes correctly.

Fixes pytorch#188113

Pull Request resolved: pytorch#188114
Approved by: https://github.com/eellison, https://github.com/alugorey, https://github.com/jeffdaily

Co-authored-by: doplxyz <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
pytorchmergebot pushed a commit that referenced this pull request Sep 2, 2026
The CK Tile FMHA generator already compiles working kernels for gfx12 (--targets=gfx1201 passes through to the kernel template), but two guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in PR #144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950 in PR #155103). gfx1200/gfx1201 were never added despite the CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in PR #187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs, WITH patch the kernel executes correctly.

Fixes #188113

Pull Request resolved: #188114
Approved by: https://github.com/jeffdaily

Co-authored-by: doplxyz <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
…h#188114)

The CK Tile FMHA generator already compiles working kernels for gfx12 (--targets=gfx1201 passes through to the kernel template), but two guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950 in PR pytorch#155103). gfx1200/gfx1201 were never added despite the CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs, WITH patch the kernel executes correctly.

Fixes pytorch#188113

Pull Request resolved: pytorch#188114
Approved by: https://github.com/eellison, https://github.com/alugorey, https://github.com/jeffdaily

Co-authored-by: doplxyz <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
…h#188114)

The CK Tile FMHA generator already compiles working kernels for gfx12 (--targets=gfx1201 passes through to the kernel template), but two guards prevented them from being used on RDNA4 hardware:

1. launch_kernel_pt.hpp: kentry_pt kernel entry stubs added in PR pytorch#144777 ([ROCm] CK SDPA - Move arch check to CK patch) had a hard-coded whitelist of gfx90a/gfx942/gfx950 (updated for gfx950 in PR pytorch#155103). gfx1200/gfx1201 were never added despite the CK Tile FMHA generator supporting them.

2. Context.cpp: ckSDPASupported() split from ckSupported() in PR pytorch#187267 ([ROCm] Split CK SDPA vs CK GEMM arch gating) only listed gfx942/gfx950. Added gfx1200/gfx1201.

Tested on gfx1201 (RX 9070): WITHOUT patch the kernel ASSERTs, WITH patch the kernel executes correctly.

Fixes pytorch#188113

Pull Request resolved: pytorch#188114
Approved by: https://github.com/jeffdaily

Co-authored-by: doplxyz <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>

This branch was previously deployed

1 inactive deployment
upload-benchmark-results — 8a7d48e3 Deployed Jan 23, 2025 by pytorch-bot[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source release notes: releng release notes category rocm This tag is for PRs from ROCm team skip-pr-sanity-checks triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants