Skip to content

[Engine] build Inkling 2's DSpark screen on HIP - #206

Open
okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:fix/hip-dspark-ldcs
Open

okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:fix/hip-dspark-ldcs

Conversation

@okada-shogo

@okada-shogo okada-shogo commented Nov 22, 2026 •

Copy link
Copy Markdown

Problem and result

Since 8ddd416 (the DSpark screen), the HIP build of strata-poly stops at engine/src/poly/inkling2.cu. The screen kernels (scr_base_kernel, scr_step_kernel, scr_final_kernel) call __ldcs and __ldcg on uint4, uint32_t, float and float2. HIP declares those two only for __half and __half2, so the build fails with ten errors:

engine/src/poly/inkling2.cu:2295:20: error: no matching function for call to '__ldcs'
engine/src/poly/inkling2.cu:2296:20: error: no matching function for call to '__ldcs'
(also lines 2329 and 2330 __ldcs; 2383, 2418, 2426, 2429, 2444 and 2527 __ldcg)

After this change, strata-poly builds for HIP again.

Related discussion

Fixes #207 (the same ten errors, reported on gfx1032).

Split out of #200 as the maintainer asked there (one change per PR, HIP support separately). The HIP support for Inkling 2 will be its own PR on top of this one.

Approach

On HIP only, __ldcs and __ldcg become plain loads (two small templates under #if defined(__HIPCC__)). The screen uses them only as cache hints, on a copy's words that are read once and on candidates that earlier launches wrote, so a plain load gives the same values. CUDA code is unchanged: the definitions are not compiled for CUDA.

Validation

Passed:

  • HIP build of strata-poly for gfx1201. ROCm 7.2.4 in a container based on rocm/dev-ubuntu-24.04:7.2.4-complete (digest sha256:92f309c5…), with cmake, ninja and ccache added:

    cmake -S engine -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF \
      -DCMAKE_HIP_ARCHITECTURES=gfx1201 -DSTRATA_BUILD_TESTS=ON -DSTRATA_NATIVE_EXPERTS=ON \
      -DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ -DCMAKE_PREFIX_PATH=/opt/rocm
    ninja -C build -k 0 -j6 strata-poly
    
    • At d1f711e: 10 errors (above), FAILED: CMakeFiles/strata-poly.dir/src/poly/inkling2.cu.o.
    • With this commit: 0 errors, ends with [2/2] Linking HIP executable strata-poly.
  • CUDA object identity: engine/src/poly/inkling2.cu at d1f711e and with this commit, each at the same path, compiled with main's nvcc line for sm_75 (CUDA 12.9, -O3 -std=c++20 --generate-code=arch=compute_75,code=[compute_75,sm_75], the same -D flags). The md5 of cuobjdump -sass, of cuobjdump -ptx (without .file/.loc lines) and of the host code (objdump -d --no-show-raw-insn) is the same before and after.

  • CUDA: full strata-poly build for sm_75 with this commit (CUDA 12.9, gcc 11): cmake -S engine -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=75 -DSTRATA_NATIVE_EXPERTS=ON then cmake --build build --target strata-poly: 118 of 118 steps, 0 errors.

  • HIP compile of inkling2.cu for gfx1100 and gfx1200 (same container, strata-poly's clang++ line): 0 errors. Three warnings per arch about constants unused under HIP (kFlashRel, kFlashKv), which were there before this change.

Failed: none observed.

Not run:

  • A run on an NVIDIA card: none was made. The only change is 7 lines inside #if defined(__HIPCC__) in inkling2.cu,
    and the CUDA object code is unchanged (the sm_75 SASS/PTX/host-code md5 check above).
  • The HIP test targets, and a HIP build on Windows.
  • Any run on an AMD card: this PR only restores the build. Running Inkling 2 on AMD is for the HIP support PR.
  • SYCL and Metal: this file isn't built for them.

Limits

Build fix only. It does not claim that Inkling 2 runs correctly on AMD.

🤖 Generated with Claude Code

The HIP build of strata-poly stopped at inkling2.cu since 8ddd416:
the screen kernels (scr_base_kernel, scr_step_kernel, scr_final_kernel)
call __ldcs and __ldcg on uint4, uint32_t, float and float2, and HIP
has those two only for halves ("no matching function for call to
'__ldcs'", ten errors, ROCm 7.2.4, gfx1201).  On HIP they are now plain
loads: the screen uses them as cache hints, on a copy's words read once
and on candidates that earlier launches wrote.  CUDA builds compile the
same code as before (the definitions are under __HIPCC__).

Class: same bits on CUDA; HIP did not build before.  Inkling 2 is
VecSzn's engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Erqa3PhC87SPTfVSKZ3Ri5
@github-actions github-actions Bot added the needs-format Title or description does not follow CONTRIBUTING.md yet label Nov 22, 2026
@github-actions

Copy link
Copy Markdown

Thanks for the pull request. To keep the tracker readable, every item needs an area prefix in the title and the parts of the pull request template filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] fix decode stop on long prompts".

Edit the pull request (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

@okada-shogo okada-shogo changed the title poly: build Inkling 2's DSpark screen on HIP [Engine] build Inkling 2's DSpark screen on HIP Nov 22, 2026
@github-actions github-actions Bot removed the needs-format Title or description does not follow CONTRIBUTING.md yet label Nov 22, 2026
@github-actions

Copy link
Copy Markdown

Thanks, this follows the format now.

okada-shogo added a commit to okada-shogo/PolyStrata that referenced this pull request Nov 23, 2026
… HIP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Engine] Build fails on HIP (gfx1032): __ldcs/__ldcg have no overload for uint4, uint32_t, float, float2 in inkling2.cu

1 participant