[PR #4151] [Engine] gfx906/HIP: __shared__ alignas(16) int4 does not compile (clang 18 / ROCm 6.3.3) #4923

Open
opened 2026-11-07 16:31:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4151
Author: @ken2425pm
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: fix-hip633-build


📝 Commits (1)

  • ee6419d gfx906: map __shared__ alignas(16) int4 onto the attribute form on HIP

📊 Changes

1 file changed (+9 additions, -2 deletions)

View changed files

📝 src/kernels/cuda/iq_kernels.cu (+9 -2)

📄 Description

Replaces the same-numbered closed PR (0.2.0-beta tracker reset; its /reopen check passed but GitHub would not reopen the closed PR after the branch update - new PR per the check bot's guidance).

Problem and result: on ROCm 6.3.3 (clang 18) the gfx906 build stops in src/kernels/cuda/iq_kernels.cu — error: 'alignas' attribute cannot be applied to types at the two expdec kernels' __shared__ alignas(16) int4 staging tiles. After this change that error is gone.

Related discussion: #2459 (the build thread; the closed #3078 was rescoped after the 0.2.0-beta tracker reset), #3172 (same-class compat gaps, dflash2.cpp), #2460 (the cublas maps — merged upstream in 0.2.1, not touched here).

Approach: the uint32_t macro right above (STRATA_SHARED_ALIGN16_U32) already handles this exact class for HIP; the two int4 tiles get the same treatment. STRATA_SHARED_ALIGN16_INT4 keeps the CUDA spelling and takes __attribute__((aligned(16))) under HIPCC. Two call sites change spelling; no behaviour change on CUDA — the macro's CUDA branch is the previous text.

Validation:

  • Passed: v0.2.6, system ROCm 6.3.3 (/opt/rocm-6.3.3, clang 18), gfx906, the pinned ggml as cmake fetches it (3cf03257f): without the change ninja -C build-906 strata fails at iq_kernels.cu:2477 and :2664 only; with this and the dflash2.cpp stream-priority mapping reported in #3172, the build links — [5/5] Linking HIP executable strata, 35.7 MB.
  • Failed: none observed beyond the two named blockers.
  • Not run: CUDA and SYCL builds (no CUDA/oneAPI toolkit on this box) — the macro's CUDA branch is character-identical to the previous spelling, so those paths compile as before by construction; a -Werror build (the build is not -Werror and carries the upstream warning set).

Limits: the second link blocker (dflash2.cpp, two compat lines) is reported with a fix offered in #3172 — left to that thread so this PR stays one change. The earlier #3078 commits that 0.2.x made obsolete (q36_engine __ldg/__half_as_ushort, the cudaInitDevice guard, the qsa sm_80 gate) are dropped — upstream now covers or no-longer-compiles each (qwen35 is not part of the v0.2.6 gfx906 build).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4151 **Author:** [@ken2425pm](https://github.com/ken2425pm) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-hip633-build` --- ### 📝 Commits (1) - [`ee6419d`](https://github.com/Niko1221/Strata/commit/ee6419d4ef1fdb6798459c1a15efa016aefbe9b9) gfx906: map `__shared__ alignas(16) int4` onto the attribute form on HIP ### 📊 Changes **1 file changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/iq_kernels.cu` (+9 -2) </details> ### 📄 Description Replaces the same-numbered closed PR (0.2.0-beta tracker reset; its /reopen check passed but GitHub would not reopen the closed PR after the branch update - new PR per the check bot's guidance). Problem and result: on ROCm 6.3.3 (clang 18) the gfx906 build stops in `src/kernels/cuda/iq_kernels.cu` — `error: 'alignas' attribute cannot be applied to types` at the two expdec kernels' `__shared__ alignas(16) int4` staging tiles. After this change that error is gone. Related discussion: #2459 (the build thread; the closed #3078 was rescoped after the 0.2.0-beta tracker reset), #3172 (same-class compat gaps, dflash2.cpp), #2460 (the cublas maps — merged upstream in 0.2.1, not touched here). Approach: the `uint32_t` macro right above (`STRATA_SHARED_ALIGN16_U32`) already handles this exact class for HIP; the two int4 tiles get the same treatment. `STRATA_SHARED_ALIGN16_INT4` keeps the CUDA spelling and takes `__attribute__((aligned(16)))` under HIPCC. Two call sites change spelling; no behaviour change on CUDA — the macro's CUDA branch is the previous text. Validation: - Passed: v0.2.6, system ROCm 6.3.3 (`/opt/rocm-6.3.3`, clang 18), gfx906, the pinned ggml as cmake fetches it (`3cf03257f`): without the change `ninja -C build-906 strata` fails at `iq_kernels.cu:2477` and `:2664` only; with this and the `dflash2.cpp` stream-priority mapping reported in #3172, the build links — `[5/5] Linking HIP executable strata`, 35.7 MB. - Failed: none observed beyond the two named blockers. - Not run: CUDA and SYCL builds (no CUDA/oneAPI toolkit on this box) — the macro's CUDA branch is character-identical to the previous spelling, so those paths compile as before by construction; a `-Werror` build (the build is not `-Werror` and carries the upstream warning set). Limits: the second link blocker (`dflash2.cpp`, two compat lines) is reported with a fix offered in #3172 — left to that thread so this PR stays one change. The earlier #3078 commits that 0.2.x made obsolete (q36_engine `__ldg`/`__half_as_ushort`, the `cudaInitDevice` guard, the qsa sm_80 gate) are dropped — upstream now covers or no-longer-compiles each (qwen35 is not part of the v0.2.6 gfx906 build). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4923
No description provided.