mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5491
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5518
Author: @rwkeyes
Created: 11/7/2026
Status: 🔄 Open
Base:
main← Head:hip/aligned-shared-int4-staging📝 Commits (1)
98a74cdHIP: the two int4 staging arrays #778 left behind do not compile📊 Changes
1 file changed (+10 additions, -2 deletions)
View changed files
📝
src/kernels/cuda/iq_kernels.cu(+10 -2)📄 Description
Problem and result
v0.2.12does not build for HIP: two expert-decode kernels stage their int4 rows as__shared__ alignas(16) int4,and HIP clang rejects that placement. This is the same defect #778 fixed for the shared grid buffers — the two
int4staging arrays were not converted when that fix landed, so those kernels never compile.Before (
146df3c4, ROCm 7.1.1,-DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100):After: both declarations use a
STRATA_SHARED_ALIGN16_INT4macro with the same two forms as the existingSTRATA_SHARED_ALIGN16_U32(__attribute__((aligned(16)))after the declarator under HIP,alignas(16)before itotherwise), the object compiles, and the gfx1100 engine builds.
Related discussion
Follow-up to #778 ("iq_kernels: portable aligned shared-memory declaration for gfx1030", closed). That fix
introduced
STRATA_SHARED_ALIGN16_U32and converted the grid buffers; these twoint4sites in the same file wereleft with the old declaration. I did not find an open issue covering them, and this is a build failure rather than a
behaviour change, so it goes straight to a PR.
Approach
Ten lines in
src/kernels/cuda/iq_kernels.cu, no other file:#if defined(__HIPCC__)split — the__attribute__form whereHIP clang needs it, the
alignasform where nvcc with MSVC as host requires it (the reason #778 is split at all);STRATA_SHARED_ALIGN16_INT4(s_u, ...). Same size, same alignment, same layout — thischanges no arithmetic and no memory footprint.
Nothing else in the tree is touched: no CMake, no other kernel, no version bump.
Validation
Passed:
ninja CMakeFiles/strata_kernels.dir/src/kernels/cuda/iq_kernels.cu.o→ object produced (6 534 784 B).The same command on the unmodified tag fails with the two errors quoted above.
-DCMAKE_CUDA_ARCHITECTURES=89:object produced (11 587 504 B) — the nvcc path is unchanged.
ninja -C build-hip-full -j10 strata→[164/164] Linking HIP executable strata, 0 errors, engine 60 162 624 B, and./strata --helprc=0 withhipv4-amdgcn-amd-amdhsa--gfx1100in the binary (a real gfx1100 device image, not a CPU fallback). Configure:-DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_BUILD_TESTS=OFF -DSTRATA_PREFILL_MMQ=ON -DSTRATA_Q6K_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100with ROCm 7.1.1's clang— i.e. the option set
setup.py's HIP path uses, which I had left out of my first attempt (it then stopped at thelink on
undefined symbol: strata::prefill::fused::dm_f16_used(), becauseSTRATA_PREFILL_MMQ=OFFdropssrc/prefill/moe_fused_iq.cufrom that archive). My error, not the tree's; corrected here rather than dropped.Failed: the unmodified tag's HIP build, on the two lines above (that is the bug).
Not run:
built but not executed here. I am not claiming it runs, only that it builds.
gfx1201,gfx1030) built; the fix is the same declaration for all of them, and #778'sreport was gfx1030, but I did not build those.
Limits
Whether these kernels are numerically correct on an AMD card is not something this host can establish.
__shared__ alignas(16) <vector type>in this file, the same trap returns — themacros are the only thing preventing it, so a
grepfor that spelling is worth keeping in review.AI assistance was used to locate the failing sites and run the builds; the failing and passing compile lines above are
from the commands shown, on the ROCm and CUDA toolchains named.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.