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

cuda: keep the PTX L2 prefetch hints off HIP and MUSA#168
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
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