[GH-ISSUE #4589] [Engine] HIP source build fails since v0.1.45: __shared__ alignas(16) int4 in iq_kernels.cu (expdec verify window) #2076

Closed
opened 2026-11-04 01:56:27 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ljubomirj on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4589

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

Source (setup.sh --build on Linux, ROCm system install)

What happened

A source build of the AMD (HIP) engine fails. Compilation stops in src/kernels/cuda/iq_kernels.cu:

/…/src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types
 2571 |     __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB];
      |                ^
/…/src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types
 2758 |     __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB];
      |                ^
ninja: build stopped: subcommand failed.

I expected the engine to build as it did on v0.1.42; this is the expdec "Evaluate window" kernels.

The same file already documents this exact toolchain rule and carries a macro for it (line ~1869, #778):

// #778: `__shared__ alignas(16)` does not compile for gfx1030 (HIP); the attribute after the declarator does, but nvcc
// with MSVC as host does not take it.  Same layout either way.
#if defined(__HIPCC__)
#define STRATA_SHARED_ALIGN16_U32(name, ...) __shared__ uint32_t name[__VA_ARGS__] __attribute__((aligned(16)))
#else
#define STRATA_SHARED_ALIGN16_U32(name, ...) __shared__ alignas(16) uint32_t name[__VA_ARGS__]
#endif

The two int4 declarations added later use the bare __shared__ alignas(16) form and bypass that macro. CUDA is unaffected (nvcc accepts the form), so this is HIP-only. The declarations compile unconditionally even though STRATA_EXPDEC is a runtime opt-in, so it blocks every AMD source build.

Introduced by f7eaf2de ("Verify window: the routed experts' gate/up with the group's q8_1 rows in shared memory (STRATA_EXPDEC=1, opt-in, bitwise)…"); first tag that contains it is v0.1.45, so every release from there on. My previous clone was v0.1.42, which is why it built in October.

Smallest steps or command that reproduce it

  1. Clone main (46c152a1, v0.2.7.1) on a gfx1100 machine with system ROCm 7.1.1.
  2. ROCM_PATH=/opt/rocm-7.1.1 ./setup.sh --backend hip --family qwen --model IQ3_XXS --context 262144 --kv int8 --low-ram auto --vision no --draft-vocab en --port 8081 --data-dir … --build --yes --no-start
    (or the equivalent cmake -DSTRATA_ENABLE_HIP=ON … && ninja strata in build-hip/).
  3. The build fails at iq_kernels.cu, lines 2571 and 2758, as above.

Note: ./update.sh does not compile and only reports "the engine was NOT: it is still 0.1.42 and this Strata wants 0.1.46 or newer", so the compile is only reachable through setup.sh --build.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.7.1 (46c152a1, v0.2.7.1) · engine 0.1.53 (built after the fix below)

Graphics card, memory and system

RX 7900 XTX 24 GB (gfx1100) · 126 GB RAM · Ubuntu 22.04.5, kernel 5.15 · system ROCm 7.1.1 (AMD clang 20.0.0git, hipBLASLt 1.1.0) · single card

Model, size and settings

Qwen3.8-Flash-Next IQ3_XXS · 262 144 context · --kv int8 · --spec 4 + MTP · --expert-cache auto · text only (no vision). (Only the build is affected; the model starts fine once the engine compiles.)

Logs

[68/164] Building HIP object CMakeFiles/strata_kernels.dir/src/kernels/cuda/kv_q4.cu.o
…
src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types
src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types
ninja: build stopped: subcommand failed.

Suggested fix

Give int4 the same split the file already has for uint32_t and use it at both sites:

+#if defined(__HIPCC__)
+#define STRATA_SHARED_ALIGN16_INT4(name, ...) __shared__ int4 name[__VA_ARGS__] __attribute__((aligned(16)))
+#else
+#define STRATA_SHARED_ALIGN16_INT4(name, ...) __shared__ alignas(16) int4 name[__VA_ARGS__]
+#endif
…
-    __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB];
+    STRATA_SHARED_ALIGN16_INT4(s_u, ED_NC * 2 * ED_XB);
…
-    __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB];
+    STRATA_SHARED_ALIGN16_INT4(s_u, ED_NC * 2 * ED_HB);

With that one file changed (+9/−2), the same command builds engine 0.1.53 and the model runs on this card (prefill ≈1500–1580 tok/s at 8.8 K, decode ≈80–88 tok/s, parity with v0.1.42 at the same settings).

What I did not test: whether a newer AMD clang accepts the original form. My check is ROCm 7.1.1 / clang 20 only; I have not built unpatched with ROCm 7.2.x (clang 22).

Originally created by @ljubomirj on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4589 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Source (`setup.sh --build` on Linux, ROCm system install) ### What happened A source build of the AMD (HIP) engine fails. Compilation stops in `src/kernels/cuda/iq_kernels.cu`: ``` /…/src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types 2571 | __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB]; | ^ /…/src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types 2758 | __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB]; | ^ ninja: build stopped: subcommand failed. ``` I expected the engine to build as it did on v0.1.42; this is the expdec "Evaluate window" kernels. The same file already documents this exact toolchain rule and carries a macro for it (line ~1869, #778): ```cpp // #778: `__shared__ alignas(16)` does not compile for gfx1030 (HIP); the attribute after the declarator does, but nvcc // with MSVC as host does not take it. Same layout either way. #if defined(__HIPCC__) #define STRATA_SHARED_ALIGN16_U32(name, ...) __shared__ uint32_t name[__VA_ARGS__] __attribute__((aligned(16))) #else #define STRATA_SHARED_ALIGN16_U32(name, ...) __shared__ alignas(16) uint32_t name[__VA_ARGS__] #endif ``` The two `int4` declarations added later use the bare `__shared__ alignas(16)` form and bypass that macro. CUDA is unaffected (nvcc accepts the form), so this is HIP-only. The declarations compile unconditionally even though `STRATA_EXPDEC` is a runtime opt-in, so it blocks every AMD source build. Introduced by `f7eaf2de` ("Verify window: the routed experts' gate/up with the group's q8_1 rows in shared memory (STRATA_EXPDEC=1, opt-in, bitwise)…"); first tag that contains it is **v0.1.45**, so every release from there on. My previous clone was v0.1.42, which is why it built in October. ### Smallest steps or command that reproduce it 1. Clone `main` (`46c152a1`, v0.2.7.1) on a gfx1100 machine with system ROCm 7.1.1. 2. `ROCM_PATH=/opt/rocm-7.1.1 ./setup.sh --backend hip --family qwen --model IQ3_XXS --context 262144 --kv int8 --low-ram auto --vision no --draft-vocab en --port 8081 --data-dir … --build --yes --no-start` (or the equivalent `cmake -DSTRATA_ENABLE_HIP=ON … && ninja strata` in `build-hip/`). 3. The build fails at `iq_kernels.cu`, lines 2571 and 2758, as above. Note: `./update.sh` does not compile and only reports "the engine was NOT: it is still 0.1.42 and this Strata wants 0.1.46 or newer", so the compile is only reachable through `setup.sh --build`. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.7.1 (`46c152a1`, v0.2.7.1) · engine 0.1.53 (built after the fix below) ### Graphics card, memory and system RX 7900 XTX 24 GB (gfx1100) · 126 GB RAM · Ubuntu 22.04.5, kernel 5.15 · system ROCm 7.1.1 (AMD clang 20.0.0git, hipBLASLt 1.1.0) · single card ### Model, size and settings Qwen3.8-Flash-Next IQ3_XXS · 262 144 context · `--kv int8` · `--spec 4` + MTP · `--expert-cache auto` · text only (no vision). (Only the build is affected; the model starts fine once the engine compiles.) ### Logs ``` [68/164] Building HIP object CMakeFiles/strata_kernels.dir/src/kernels/cuda/kv_q4.cu.o … src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types ninja: build stopped: subcommand failed. ``` ### Suggested fix Give `int4` the same split the file already has for `uint32_t` and use it at both sites: ```diff +#if defined(__HIPCC__) +#define STRATA_SHARED_ALIGN16_INT4(name, ...) __shared__ int4 name[__VA_ARGS__] __attribute__((aligned(16))) +#else +#define STRATA_SHARED_ALIGN16_INT4(name, ...) __shared__ alignas(16) int4 name[__VA_ARGS__] +#endif … - __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB]; + STRATA_SHARED_ALIGN16_INT4(s_u, ED_NC * 2 * ED_XB); … - __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB]; + STRATA_SHARED_ALIGN16_INT4(s_u, ED_NC * 2 * ED_HB); ``` With that one file changed (+9/−2), the same command builds engine 0.1.53 and the model runs on this card (prefill ≈1500–1580 tok/s at 8.8 K, decode ≈80–88 tok/s, parity with v0.1.42 at the same settings). What I did **not** test: whether a newer AMD clang accepts the original form. My check is ROCm 7.1.1 / clang 20 only; I have not built unpatched with ROCm 7.2.x (clang 22).
Author
Owner

@suvayu commented on GitHub (Oct 29, 2026):

I'm also seeing the same issue for about a week. Last version I tried was v0.2.7.1.

/path/to/Strata/src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types
 2571 |     __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB];
      |                ^
/path/to/Strata/src/kernels/cuda/iq_kernels.cu:2570:20: warning: comparison of integers of different signs: 'unsigned int' and 'const int' [-Wsign-compare]
 2570 |     if (blockIdx.y >= ng) return;
      |         ~~~~~~~~~~ ^  ~~
/path/to/Strata/src/kernels/cuda/iq_kernels.cu:2624:32: warning: unused parameter 'r' [-Wunused-parameter]
 2624 |     auto term = [&](int k, int r, int c, const typename S::W& w) -> float {
      |                                ^
/path/to/Strata/src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types
 2758 |     __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB];
      |                ^

Steps

Instead of using the setup script, I am calling cmake directly. These are my steps:

  1. GGML checkout:
    $ cd ../strata_ggml/
    $ git log -1 
    commit 3cf03257f219afbe7334045ff7c6a06ac68c627d (HEAD, tag: b11062)
    Author: Aman Gupta <amangupta052@gmail.com>
    Date:   Sun Sep 20 16:08:11 2026 +0800
    
        CUDA: enable sparse fa for qwen4 (#28770)
    
  2. My build script:
    HIPCXX="$(hipconfig -l)/clang++"
    cmake -S . -B build-halo -DCMAKE_BUILD_TYPE=Release \
          -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF \
          -DSTRATA_PREFILL_MMQ=ON \
          -DSTRATA_GGML_DIR=$HOME/build/strata_ggml \
          -DCMAKE_HIP_ARCHITECTURES=gfx1151 \
          -DCMAKE_HIP_COMPILER=$HIPCXX
    cmake --build build-halo --target strata
    

Environment

OS: 7.2.13-200.fc44.x86_64 (Fedora 44)

ROCm is from Fedora repositories. I use this same environment for llama.cpp and DwarfStar4:

$ sudo dnf info --installed rocm-core
Installed packages
Name            : rocm-core
Epoch           : 0
Version         : 7.1.1
Release         : 4.fc44
Architecture    : x86_64
Installed size  : 20.4 KiB
Source          : rocm-core-7.1.1-4.fc44.src.rpm
From repository : fedora
Summary         : A utility to get the ROCm release version
URL             : https://github.com/ROCm/rocm-systems
License         : MIT
Description     : A utility to get the ROCm release version
Vendor          : Fedora Project

EDIT: I had some time and found a possible fix using DeepSeek, see the linked PR

<!-- gh-comment-id:6495180540 --> @suvayu commented on GitHub (Oct 29, 2026): I'm also seeing the same issue for about a week. Last version I tried was v0.2.7.1. ``` /path/to/Strata/src/kernels/cuda/iq_kernels.cu:2571:16: error: 'alignas' attribute cannot be applied to types 2571 | __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_XB]; | ^ /path/to/Strata/src/kernels/cuda/iq_kernels.cu:2570:20: warning: comparison of integers of different signs: 'unsigned int' and 'const int' [-Wsign-compare] 2570 | if (blockIdx.y >= ng) return; | ~~~~~~~~~~ ^ ~~ /path/to/Strata/src/kernels/cuda/iq_kernels.cu:2624:32: warning: unused parameter 'r' [-Wunused-parameter] 2624 | auto term = [&](int k, int r, int c, const typename S::W& w) -> float { | ^ /path/to/Strata/src/kernels/cuda/iq_kernels.cu:2758:16: error: 'alignas' attribute cannot be applied to types 2758 | __shared__ alignas(16) int4 s_u[ED_NC * 2 * ED_HB]; | ^ ``` ### Steps Instead of using the setup script, I am calling cmake directly. These are my steps: 1. GGML checkout: ``` $ cd ../strata_ggml/ $ git log -1 commit 3cf03257f219afbe7334045ff7c6a06ac68c627d (HEAD, tag: b11062) Author: Aman Gupta <amangupta052@gmail.com> Date: Sun Sep 20 16:08:11 2026 +0800 CUDA: enable sparse fa for qwen4 (#28770) ``` 2. My build script: ``` HIPCXX="$(hipconfig -l)/clang++" cmake -S . -B build-halo -DCMAKE_BUILD_TYPE=Release \ -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF \ -DSTRATA_PREFILL_MMQ=ON \ -DSTRATA_GGML_DIR=$HOME/build/strata_ggml \ -DCMAKE_HIP_ARCHITECTURES=gfx1151 \ -DCMAKE_HIP_COMPILER=$HIPCXX cmake --build build-halo --target strata ``` ### Environment OS: 7.2.13-200.fc44.x86_64 (Fedora 44) ROCm is from Fedora repositories. I use this same environment for llama.cpp and DwarfStar4: ``` $ sudo dnf info --installed rocm-core Installed packages Name : rocm-core Epoch : 0 Version : 7.1.1 Release : 4.fc44 Architecture : x86_64 Installed size : 20.4 KiB Source : rocm-core-7.1.1-4.fc44.src.rpm From repository : fedora Summary : A utility to get the ROCm release version URL : https://github.com/ROCm/rocm-systems License : MIT Description : A utility to get the ROCm release version Vendor : Fedora Project ``` **EDIT:** I had some time and found a possible fix using DeepSeek, see the linked PR
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660742291 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#2076
No description provided.