[GH-ISSUE #355] HIP build: ninja fails on three test targets - strata_engine's glm_prefill.cu needs strata_prefill (undefined strata::prefill::Gemm) #141

Closed
opened 2026-10-29 21:21:29 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @precisionailabsllc-collab on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/355

Summary

Reported from a Strix Halo (Ryzen AI Max+ 395, gfx1151, ROCm 7.14) — on that machine a plain ninja after a
default configure fails, so this blocks the build out of the box.

On a HIP build, a default configure (STRATA_BUILD_TESTS defaults to ON) followed by ninja fails at link time
for three tests:

  • split_groups_test
  • expert_profile_version_test
  • expert_profile_save_test

All three link only strata_engine, but on HIP strata_engine's glm_prefill.cu.o references
strata::prefill::Gemm, which is defined in src/prefill/gemm.cu and compiled into the separate static library
strata_prefill. ninja maya-ds4 and ninja maya are unaffected: the engine targets already link both libraries.

The build is otherwise good — the engine built by ninja maya-ds4 runs the Maya-S pack on this machine.

Environment

  • Project Maya v1.1.21 (451f9cb)
  • AMD Ryzen AI Developer Platform 1 (rex), kernel 6.18.44+rex+5-amd64, Ryzen AI Max+ 395 (Strix Halo), gfx1151
  • ROCm / HIP 7.14.60850 (clang 23), CMake 3.31.6, Ninja
  • Configure: CMAKE_BUILD_TYPE=Release, CMAKE_HIP_ARCHITECTURES=gfx1151, STRATA_ENABLE_HIP=ON,
    STRATA_ENABLE_CUDA=OFF, STRATA_PREFILL_MMQ=ON, STRATA_BUILD_TESTS=ON
  • No NVIDIA hardware here, so the CUDA side is untested (see "Scope" below).

Steps to reproduce

cmake -G Ninja -B build -DCMAKE_HIP_ARCHITECTURES=gfx1151 -DSTRATA_ENABLE_HIP=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8            # or: ninja -j8

Expected

The build completes.

Actual

FAILED: [code=1] split_groups_test
FAILED: [code=1] expert_profile_version_test
FAILED: [code=1] expert_profile_save_test
ninja: build stopped: subcommand failed.

Linker output (first of the three, identical symbols in all three):

ld.lld: error: undefined symbol: strata::prefill::Gemm::init_external(void*, unsigned short*, long, void*, unsigned long, std::__cxx11::basic_string<...>&)
>>> referenced by glm_prefill.cu
>>>               glm_prefill.cu.o:(strata::core::Glm5Model::prefill_half(...))

ld.lld: error: undefined symbol: strata::prefill::Gemm::~Gemm()
ld.lld: error: undefined symbol: strata::prefill::Gemm::rebind(unsigned short*, long, void*, unsigned long)
ld.lld: error: undefined symbol: strata::prefill::Gemm::f16(unsigned short const*, unsigned short const*, float*, long, long, long, long, float)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Analysis

  • src/core/glm_prefill.cu:554 declares std::unique_ptr<strata::prefill::Gemm> lt; and :1993-1995 calls
    std::make_unique<strata::prefill::Gemm>() / init_external(...); both are inside
    #if defined(STRATA_USE_HIP) (:554, :1989). That is where the reference comes from.
  • The definitions live in src/prefill/gemm.cu (namespace strata::prefill at :35, Gemm::init_external at
    :302), compiled into add_library(strata_prefill STATIC src/prefill/gemm.cu src/prefill/kernels.cu src/prefill/prefill.cpp) — CMakeLists.txt:430.
  • The three tests are generated by the loop at CMakeLists.txt:416-423, whose only link line is
    target_link_libraries(${_t} PRIVATE strata_engine). On HIP that pulls glm_prefill.cu.o out of
    strata_engine with nothing to satisfy the strata::prefill symbols.
  • Targets that do link the pair build fine: maya uses strata_engine strata_prefill
    (CMakeLists.txt:443), and the GLM test set uses set(_strata_gpu_glm_libs strata_engine strata_prefill)
    (CMakeLists.txt:626-628, with the ordering note at :626).

Suggested fix

In the loop at CMakeLists.txt:416-423, add strata_prefill, in the order the other GLM targets use:

target_link_libraries(${_t} PRIVATE strata_engine strata_prefill)

or, to keep the CUDA link line minimal (the reference is HIP-only):

if(STRATA_ENABLE_HIP)
  target_link_libraries(${_t} PRIVATE strata_engine strata_prefill)
else()
  target_link_libraries(${_t} PRIVATE strata_engine)
endif()

Any other target that links only strata_engine on HIP and pulls glm_prefill.cu.o will need the same treatment;
these three are the ones the default test set hits.

Workaround

ninja maya-ds4        # or: cmake --build build --target maya-ds4

The engine builds and runs; only the three test targets fail.

Scope / confidence

  • Reproduced on v1.1.21 (451f9cb), HIP only, with a clean configure and a full ninja.
  • The CUDA path is inferred to be unaffected (the Gemm use sits behind #if defined(STRATA_USE_HIP)); I have no
    NVIDIA card to confirm that.
  • ninja maya-ds4 on the same tree exits 0 and the resulting binary (19,751,368 bytes) loads the Maya-S pack
    (7,634 of 15,744 experts in VRAM on this 128 GB APU) and serves requests.
Originally created by @precisionailabsllc-collab on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/355 ## Summary Reported from a **Strix Halo** (Ryzen AI Max+ 395, `gfx1151`, ROCm 7.14) — on that machine a plain `ninja` after a default configure fails, so this blocks the build out of the box. On a HIP build, a default configure (`STRATA_BUILD_TESTS` defaults to ON) followed by `ninja` fails at link time for three tests: - `split_groups_test` - `expert_profile_version_test` - `expert_profile_save_test` All three link only `strata_engine`, but on HIP `strata_engine`'s `glm_prefill.cu.o` references `strata::prefill::Gemm`, which is defined in `src/prefill/gemm.cu` and compiled into the separate static library `strata_prefill`. `ninja maya-ds4` and `ninja maya` are unaffected: the engine targets already link both libraries. The build is otherwise good — the engine built by `ninja maya-ds4` runs the Maya-S pack on this machine. ## Environment - Project Maya v1.1.21 (`451f9cb`) - AMD Ryzen AI Developer Platform 1 (rex), kernel `6.18.44+rex+5-amd64`, Ryzen AI Max+ 395 (Strix Halo), `gfx1151` - ROCm / HIP 7.14.60850 (clang 23), CMake 3.31.6, Ninja - Configure: `CMAKE_BUILD_TYPE=Release`, `CMAKE_HIP_ARCHITECTURES=gfx1151`, `STRATA_ENABLE_HIP=ON`, `STRATA_ENABLE_CUDA=OFF`, `STRATA_PREFILL_MMQ=ON`, `STRATA_BUILD_TESTS=ON` - No NVIDIA hardware here, so the CUDA side is untested (see "Scope" below). ## Steps to reproduce ```sh cmake -G Ninja -B build -DCMAKE_HIP_ARCHITECTURES=gfx1151 -DSTRATA_ENABLE_HIP=ON -DCMAKE_BUILD_TYPE=Release cmake --build build -j8 # or: ninja -j8 ``` ## Expected The build completes. ## Actual ``` FAILED: [code=1] split_groups_test FAILED: [code=1] expert_profile_version_test FAILED: [code=1] expert_profile_save_test ninja: build stopped: subcommand failed. ``` Linker output (first of the three, identical symbols in all three): ``` ld.lld: error: undefined symbol: strata::prefill::Gemm::init_external(void*, unsigned short*, long, void*, unsigned long, std::__cxx11::basic_string<...>&) >>> referenced by glm_prefill.cu >>> glm_prefill.cu.o:(strata::core::Glm5Model::prefill_half(...)) ld.lld: error: undefined symbol: strata::prefill::Gemm::~Gemm() ld.lld: error: undefined symbol: strata::prefill::Gemm::rebind(unsigned short*, long, void*, unsigned long) ld.lld: error: undefined symbol: strata::prefill::Gemm::f16(unsigned short const*, unsigned short const*, float*, long, long, long, long, float) clang++: error: linker command failed with exit code 1 (use -v to see invocation) ``` ## Analysis - `src/core/glm_prefill.cu:554` declares `std::unique_ptr<strata::prefill::Gemm> lt;` and `:1993-1995` calls `std::make_unique<strata::prefill::Gemm>()` / `init_external(...)`; both are inside `#if defined(STRATA_USE_HIP)` (`:554`, `:1989`). That is where the reference comes from. - The definitions live in `src/prefill/gemm.cu` (`namespace strata::prefill` at `:35`, `Gemm::init_external` at `:302`), compiled into `add_library(strata_prefill STATIC src/prefill/gemm.cu src/prefill/kernels.cu src/prefill/prefill.cpp)` — `CMakeLists.txt:430`. - The three tests are generated by the loop at `CMakeLists.txt:416-423`, whose only link line is `target_link_libraries(${_t} PRIVATE strata_engine)`. On HIP that pulls `glm_prefill.cu.o` out of `strata_engine` with nothing to satisfy the `strata::prefill` symbols. - Targets that do link the pair build fine: `maya` uses `strata_engine strata_prefill` (`CMakeLists.txt:443`), and the GLM test set uses `set(_strata_gpu_glm_libs strata_engine strata_prefill)` (`CMakeLists.txt:626-628`, with the ordering note at `:626`). ## Suggested fix In the loop at `CMakeLists.txt:416-423`, add `strata_prefill`, in the order the other GLM targets use: ```cmake target_link_libraries(${_t} PRIVATE strata_engine strata_prefill) ``` or, to keep the CUDA link line minimal (the reference is HIP-only): ```cmake if(STRATA_ENABLE_HIP) target_link_libraries(${_t} PRIVATE strata_engine strata_prefill) else() target_link_libraries(${_t} PRIVATE strata_engine) endif() ``` Any other target that links only `strata_engine` on HIP and pulls `glm_prefill.cu.o` will need the same treatment; these three are the ones the default test set hits. ## Workaround ```sh ninja maya-ds4 # or: cmake --build build --target maya-ds4 ``` The engine builds and runs; only the three test targets fail. ## Scope / confidence - Reproduced on `v1.1.21` (`451f9cb`), HIP only, with a clean configure and a full `ninja`. - The CUDA path is inferred to be unaffected (the `Gemm` use sits behind `#if defined(STRATA_USE_HIP)`); I have no NVIDIA card to confirm that. - `ninja maya-ds4` on the same tree exits 0 and the resulting binary (19,751,368 bytes) loads the Maya-S pack (7,634 of 15,744 experts in VRAM on this 128 GB APU) and serves requests.
Author
Owner

@mw00 commented on GitHub (Oct 22, 2026):

Fixed in v1.1.22: the three test programs now link the prefill library after the engine library, so a plain ninja builds on HIP. Thanks for pinning it down!

<!-- gh-comment-id:6343960729 --> @mw00 commented on GitHub (Oct 22, 2026): Fixed in v1.1.22: the three test programs now link the prefill library after the engine library, so a plain `ninja` builds on HIP. Thanks for pinning it down!
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#141
No description provided.