Skip to content

cuda: make the PQ2_0 J=128 header compile under HIP (fixes today's release HIP/ROCm jobs) - #386

Closed
bri-prism wants to merge 1 commit into
prismfrom
fix/hip-pq2-j128
Closed

bri-prism wants to merge 1 commit into
prismfrom
fix/hip-pq2-j128

Conversation

@bri-prism

Copy link
Copy Markdown
Collaborator

Release (Prism) run 40108409720 (first dispatch after #374 merged) failed on windows-hip and ubuntu-22-rocm:

mmq-pq2-j128.cuh:137:46: error: invalid output constraint '=f' in asm
mmq-pq2-j128.cuh:143:55: error: invalid output constraint '=f' in asm
mmq-pq2-j128.cuh:888:49: error: use of undeclared identifier 'cudaFuncAttributePreferredSharedMemoryCarveout'
mmq-pq2-j128.cuh:888:103: error: use of undeclared identifier 'cudaSharedmemCarveoutMaxShared'

HIP compiles every header under ggml-cuda/, and the new J=128 kernel uses PTX ld.shared inline asm plus the carveout attribute, neither of which hipcc accepts. The kernel is only dispatched on NVIDIA sm_90+ (mmq.cuh gate: GGML_CUDA_CC_IS_NVIDIA(cc) && cc >= HOPPER && warp_size == 32), so under GGML_USE_HIP the three shared-window load helpers become stubs and the carveout attribute is skipped (vendors/hip.h maps only cudaFuncAttributeMaxDynamicSharedMemorySize). The CUDA build is unchanged.

PR CI on the fork has no HIP job, which is why #374 went green; only the release workflow builds HIP. Verification is therefore the release workflow (or a HIP build) on this branch; I could not build HIP locally.

Also seen in the same run, unrelated: windows-cuda (13.4, arm64) failed in CMake's CUDA compiler-id step (cudafe++ ... The system cannot find the path specified) with the same nvcc 13.4.46 / MSVC 14.44 that passed on 10-19; the rerun (40110106438) is in progress.

https://claude.ai/code/session_01NzdxkdQRP2XfoY2zDeW1yn

#374 added mmq-pq2-j128.cuh with PTX ld.shared inline asm and the
cudaFuncAttributePreferredSharedMemoryCarveout attribute. HIP builds
compile every header under ggml-cuda, so the first release run after the
merge (40108409720) failed on windows-hip and ubuntu-22-rocm:

  mmq-pq2-j128.cuh:137:46: error: invalid output constraint '=f' in asm
  mmq-pq2-j128.cuh:888:49: error: use of undeclared identifier
      'cudaFuncAttributePreferredSharedMemoryCarveout'

The kernel is only ever dispatched on NVIDIA sm_90+ (mmq.cuh gate), so
HIP gets stubs for the three shared-window loads and skips the carveout
attribute, which has no mapping in vendors/hip.h. CUDA output unchanged.
@bri-prism

Copy link
Copy Markdown
Collaborator Author

Superseded by #385, which guards the include instead.

@bri-prism bri-prism closed this Oct 24, 2026
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