[PR #3429] [CLOSED] [Engine] HIP: the expdec shared int4 arrays use the attribute-after-declarator form #4631

Closed
opened 2026-11-07 15:37:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3429
Author: @chenxyz129
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: hip-expdec-align


📝 Commits (1)

  • 45423b7 fix(HIP): the expdec gate/up and down kernels use the #778 shared-array form (gfx1030/gfx1032)

📊 Changes

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

View changed files

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

📄 Description

Problem and result

Before: on main (c62d5e3a, Control 0.2.9 / engine 0.1.55), a HIP build for gfx1032 stops in
src/kernels/cuda/iq_kernels.cu:

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

Those are the two expdec kernels added in v0.1.45 (gate/up and down), which declare
__shared__ alignas(16) int4 s_u[...]. The same file already carries the working form right next to them:
STRATA_SHARED_ALIGN16_U32, with the #778 comment saying that HIP takes the attribute after the declarator.

After: a STRATA_SHARED_ALIGN16_I4 macro mirrors that one (__shared__ int4 name[...] __attribute__((aligned(16)))
under __HIPCC__, alignas elsewhere), and the two kernels use it. Array type, size and alignment are unchanged.

Refs #2784 (the gfx1032 setup PR; its engine build needs this fix).

Approach

One macro beside the existing STRATA_SHARED_ALIGN16_U32, and the two declarations switched to it. No kernel logic,
no launch configuration and no numerics change: this only makes the expdec source compile for HIP again.

Validation

Passed:

  • After the change, at commit 45423b7f (main c62d5e3a + this patch), ninja -C build-hip for gfx1032 -> all 89
    targets built and strata linked; ./build-hip/strata --version -> strata 0.1.55.
    Environment: Fedora, ROCm 7.1.1 (hipcc 7.1.52802), AMD RX 6650 XT (gfx1032, 8 GB).

Failed:

  • Before the change, at c62d5e3a, the same ninja -C build-hip for gfx1032 fails with the two
    'alignas' attribute cannot be applied to types errors quoted above (lines 2571 and 2758). That is the problem
    this fixes.

Not run:

  • gfx1030 hardware: same shared-memory declaration and same HIP compiler path, but no such card here.
  • CUDA, SYCL and Metal builds.
  • strata-device --selftest on this revision; the earlier revision passed it.
  • A full model run, llama.cpp parity and any timing: this is a compile fix, and no number here is a speed claim.

Limits

  • Tested with one HIP compiler version (7.1.52802) on one gfx1032 card; other HIP targets compile the same macro but
    were not built here.
  • Nothing about the expdec kernels' speed or results is measured in this pull request.

🔄 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/3429 **Author:** [@chenxyz129](https://github.com/chenxyz129) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `hip-expdec-align` --- ### 📝 Commits (1) - [`45423b7`](https://github.com/Niko1221/Strata/commit/45423b7fdb450699729f31a98a4535d662770be8) fix(HIP): the expdec gate/up and down kernels use the #778 shared-array form (gfx1030/gfx1032) ### 📊 Changes **1 file changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/iq_kernels.cu` (+6 -2) </details> ### 📄 Description ## Problem and result **Before:** on `main` (`c62d5e3a`, Control 0.2.9 / engine 0.1.55), a HIP build for gfx1032 stops in `src/kernels/cuda/iq_kernels.cu`: ```text 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 ``` Those are the two expdec kernels added in v0.1.45 (gate/up and down), which declare `__shared__ alignas(16) int4 s_u[...]`. The same file already carries the working form right next to them: `STRATA_SHARED_ALIGN16_U32`, with the #778 comment saying that HIP takes the attribute after the declarator. **After:** a `STRATA_SHARED_ALIGN16_I4` macro mirrors that one (`__shared__ int4 name[...] __attribute__((aligned(16)))` under `__HIPCC__`, `alignas` elsewhere), and the two kernels use it. Array type, size and alignment are unchanged. ## Related discussion Refs #2784 (the gfx1032 setup PR; its engine build needs this fix). ## Approach One macro beside the existing `STRATA_SHARED_ALIGN16_U32`, and the two declarations switched to it. No kernel logic, no launch configuration and no numerics change: this only makes the expdec source compile for HIP again. ## Validation **Passed:** - After the change, at commit `45423b7f` (`main` `c62d5e3a` + this patch), `ninja -C build-hip` for gfx1032 -> all 89 targets built and `strata` linked; `./build-hip/strata --version` -> `strata 0.1.55`. Environment: Fedora, ROCm 7.1.1 (hipcc 7.1.52802), AMD RX 6650 XT (gfx1032, 8 GB). **Failed:** - Before the change, at `c62d5e3a`, the same `ninja -C build-hip` for gfx1032 fails with the two `'alignas' attribute cannot be applied to types` errors quoted above (lines 2571 and 2758). That is the problem this fixes. **Not run:** - gfx1030 hardware: same shared-memory declaration and same HIP compiler path, but no such card here. - CUDA, SYCL and Metal builds. - `strata-device --selftest` on this revision; the earlier revision passed it. - A full model run, llama.cpp parity and any timing: this is a compile fix, and no number here is a speed claim. ## Limits - Tested with one HIP compiler version (7.1.52802) on one gfx1032 card; other HIP targets compile the same macro but were not built here. - Nothing about the expdec kernels' speed or results is measured in this pull request. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:37:57 +07:00
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#4631
No description provided.