Skip to content

cuda: keep the PTX L2 prefetch hints off HIP and MUSA - #168

Merged
khosravipasha merged 1 commit into
prismfrom
fix/hip-prefetch-guard
Sep 9, 2026
Merged

khosravipasha merged 1 commit into
prismfrom
fix/hip-prefetch-guard

Conversation

@khosravipasha

Copy link
Copy Markdown
Collaborator

What

Two guard changes, no other code:

-#if defined(__CUDA_ARCH__)
+#if defined(__CUDA_ARCH__) && !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA)

around the two PTX L2 prefetch hints added in #135: the Q1_0 J128 tile hint in mmq.cuh and the decode weight prefetch in mmvq.cu.

Why

hipcc defines __CUDA_ARCH__ for device code too, so the HIP builds try to compile prefetch.global.L2 inline PTX and the CUDA-only __cvta_generic_to_global. Both ROCm jobs of the release workflow fail on it (run 34291069282):

ggml/src/ggml-cuda/mmq.cuh:1004:72: error: use of undeclared identifier '__cvta_generic_to_global'
ggml/src/ggml-cuda/mmq.cuh:1004:68: error: invalid input constraint 'l' in asm

For HIP and MUSA this restores the pre-#135 code at those two spots; CUDA is unchanged.

Verification

  • L40S (sm_89, CUDA 12.8): clean build, test-backend-ops test -b CUDA0 -o MUL_MAT 1283/1283.
  • HIP itself is not testable here; the release workflow's ROCm jobs are the check.

The prefetch.global.L2 asm and __cvta_generic_to_global added in #135 were
guarded by __CUDA_ARCH__ alone, which hipcc also defines, so the ROCm and
Windows HIP release builds fail on mmq.cuh and mmvq.cu. Exclude HIP and MUSA
from the two hint blocks; the surrounding code is unchanged.
@khosravipasha
khosravipasha merged commit d8f26ee into prism Sep 9, 2026
7 checks passed
@khosravipasha
khosravipasha deleted the fix/hip-prefetch-guard branch September 23, 2026 23:04
imaami pushed a commit to imaami/llama.cpp that referenced this pull request Oct 13, 2026
Fuse residual normalization, activation quantization and shared-Q8 projections. Add transpose concat, recurrent gate activation and scale combinations, with the original GB10 dispatch controls. Preserve portable device queries and PTX guards, and adapt fused RMS launches to the current channel and sample dimensions.

Source: PrismML-Eng#135
Source: PrismML-Eng#163
Source: PrismML-Eng#165
Source: PrismML-Eng#168

Source commits (PrismML-Eng/llama.cpp):
3dd7675
00e8187
d8d96cf
d8f26ee

Co-authored-by: bri-prism <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Assisted-by: GitHub Copilot
Assisted-by: OpenAI Codex

Ported and rebased by Codex.
imaami pushed a commit to imaami/llama.cpp that referenced this pull request Oct 13, 2026
Fuse residual normalization, activation quantization and shared-Q8 projections. Add transpose concat, recurrent gate activation and scale combinations, with the original GB10 dispatch controls. Preserve portable device queries and PTX guards, and adapt fused RMS launches to the current channel and sample dimensions.

Source: PrismML-Eng#135
Source: PrismML-Eng#163
Source: PrismML-Eng#165
Source: PrismML-Eng#168

Source commits (PrismML-Eng/llama.cpp):
3dd7675
00e8187
d8d96cf
d8f26ee

Co-authored-by: bri-prism <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Assisted-by: GitHub Copilot
Assisted-by: OpenAI Codex

Ported and rebased by Codex.
imaami pushed a commit to imaami/llama.cpp that referenced this pull request Nov 2, 2026
Fuse residual normalization, activation quantization and shared-Q8 projections. Add transpose concat, recurrent gate activation and scale combinations, with the original GB10 dispatch controls. Preserve portable device queries and PTX guards, and adapt fused RMS launches to the current channel and sample dimensions.

Source: PrismML-Eng#135
Source: PrismML-Eng#163
Source: PrismML-Eng#165
Source: PrismML-Eng#168

Source commits (PrismML-Eng/llama.cpp):
3dd7675
00e8187
d8d96cf
d8f26ee

Co-authored-by: bri-prism <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Assisted-by: GitHub Copilot
Assisted-by: OpenAI Codex
Assisted-by: Claude (Opus 5.5), rebase onto ggml-org master with conflict resolution

Ported and rebased by Codex.
imaami pushed a commit to imaami/llama.cpp that referenced this pull request Nov 24, 2026
Fuse residual normalization, activation quantization and shared-Q8 projections. Add transpose concat, recurrent gate activation and scale combinations, with the original GB10 dispatch controls. Preserve portable device queries and PTX guards, and adapt fused RMS launches to the current channel and sample dimensions.

Source: PrismML-Eng#135
Source: PrismML-Eng#163
Source: PrismML-Eng#165
Source: PrismML-Eng#168

Source commits (PrismML-Eng/llama.cpp):
3dd7675
00e8187
d8d96cf
d8f26ee

Co-authored-by: bri-prism <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Co-authored-by: Pasha Khosravi <[email protected]>
Assisted-by: GitHub Copilot
Assisted-by: OpenAI Codex
Assisted-by: Claude (Opus 5.5), rebase onto ggml-org master with conflict resolution

Ported and rebased by Codex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant