[GH-ISSUE #5060] [Engine] Linux HIP self-build against kpack ROCm: bundled librocblas can't find its device code (hipErrorInvalidKernelFile, engine hangs) #2349

Open
opened 2026-11-04 01:58:37 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @amplogik on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5060

Area

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

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

A Linux HIP engine built with packaging/build_hip_linux.sh against a system ROCm that uses kpack (device code split out of the libraries into <rocm>/.kpack/*_lib_<arch>.kpack) works for most requests, then on some request dies with:

rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218

After that the engine hangs (client times out, then HTTP 503) until it is restarted. With AMD_LOG_LEVEL=1 the cause is printed just before it:

:1:hip_fatbin.cpp :835 : Could not find device type specific kpack code objects for any available device from binary: ~/.local/share/strata/components/engine/0.1.55-linux-x86_64-hip-rx7900/librocblas.so.5
rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218

Cause, as far as I can tell: the bundled librocblas.so.5, libhipblaslt.so.1 and librocsolver.so.0 have an empty .hip_fatbin (NOBITS) and a .rocm_kpack_ref section whose search path is relative to the library:

librocblas.so.5:   ../.kpack/blas_lib_@GFXARCH@.kpack
libhipblaslt.so.1: ../.kpack/blas_lib_@GFXARCH@.kpack
librocsolver.so.0: ../.kpack/solver_lib_@GFXARCH@.kpack

In the ROCm tree that resolves to /opt/rocm/core-10.1/.kpack/blas_lib_gfx1100.kpack (present). After collect_libs.py copies the libraries into the component, ../.kpack points at components/engine/.kpack, which does not exist, and build_hip_linux.sh never copies the .kpack archives (it only bundles rocblas/library and hipblaslt/library via --data). Kernels that rocBLAS keeps in its own fat binary (not in the Tensile library files) therefore cannot be loaded; the first request whose shapes reach one of them fails. That is why it looks intermittent.

Expected: the component carries the kpack archives it needs for its target archs (or the launcher points the kpack loader at them), so the engine is self-contained like the TheRock-based package.

Smallest steps or command that reproduce it

  1. Build: VARIANT=rx7900 DSV41=1 HP=/opt/rocm CORE=/opt/rocm LIBW=/opt/rocm packaging/build_hip_linux.sh on a system ROCm with /opt/rocm/.kpack (here: ROCm core 10.1, HIP 7.16.26385), install the component.
  2. readelf -S librocblas.so.5 in the component shows .hip_fatbin NOBITS + .rocm_kpack_ref; ls ../.kpack from the component dir: missing.
  3. Start DeepSeek-V4.1-Flash IST-DAS 2.25 bpw at --context 1m on 6× gfx1100 and send a few 4K-16K-token prompts. Here it failed 5 times in 5 engine starts: four times on a ~16K-token real-code prompt (Python source + "explain and refactor"), once on a ~230-token code-generation request partway through a ~12K-token answer. The most reliable sequence: three random-word prompts of ~3.5K/7K/27K tokens, one ~4K and then one ~16K real-code prompt; it died on the ~16K one on the most recent fresh start. Synthetic prompts of the same lengths and a replay of the 230-token request did not trigger it on other starts, so it depends on which kernel a request reaches, not on length alone.

Workaround that fixed it here (verified: the same sequence then ran 3 rounds clean, and ROCM_KPACK_DEBUG=1 shows opened and cached archive: /opt/rocm/core-10.1/.kpack/blas_lib_gfx1100.kpack ... loaded code object: 3940648 bytes):

ln -s /opt/rocm/core-10.1/.kpack ~/.local/share/strata/components/engine/.kpack

Possible fix (not tested): in build_hip_linux.sh, bundle $LIBW/.kpack/{blas,solver}_lib_<arch>.kpack for the variant's archs and lay them out so the relative ../.kpack resolves inside the component (for example libraries in a lib/ subfolder with .kpack/ beside it). librocm_kpack.so.0 also knows ROCM_KPACK_PATH / ROCM_KPACK_PATH_PREFIX, which the launcher could set instead; I did not test those.

I only observed it at --max-context 1048576; at 64K it did not occur over a few dozen requests including a full benchmark, but nothing in the cause is context-specific, so it may just be which kernels those requests reached. Possibly related in spirit to #4350 (also a self-built gfx1100 HIP engine), but the error and the cause here are different.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.9 (commit c62d5e3) · engine 0.1.55 · self-built 0.1.55-linux-x86_64-hip-rx7900 with DSV41=1

Graphics card, memory and system

6× RX 7900 XTX 24 GB (gfx1100) · Threadripper PRO 3955WX · 108 GB RAM usable · Ubuntu 26.04.1, kernel 7.0.0-42 · system ROCm core 10.1 (HIP 7.16.26385) under /opt/rocm/core-10.1

Model, size and settings

DeepSeek-V4.1-Flash IST-DAS 2.25 bpw · 1M context (--max-context 1048576 --eos 1 --vision on --dspark auto --dspark-conf 0.65 --tp 1 --layer-split auto) · pictures on · STRATA_DSV41_EXE pointing at the self-built strata-dsv41

Logs

Engine log excerpt (one failing start):

maya ds4 serve: prompt 31 tokens = 0 reused + 31 read in 750 ms (41.4 tok/s), 1 generated in 2 ms (564.38 tok/s); CPU lane 5.2% of the experts
:1:hip_fatbin.cpp :835 : Could not find device type specific kpack code objects for any available device from binary: .../0.1.55-linux-x86_64-hip-rx7900/librocblas.so.5
rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218

No amdgpu errors, resets or faults in the kernel log at any of the failure times.

Thanks for Strata, by the way: on this box DeepSeek V4.1 2.25 bpw read 9 of 9 planted facts at up to ~885K tokens with the workaround in place.

Originally created by @amplogik on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5060 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) ### What happened A Linux HIP engine built with `packaging/build_hip_linux.sh` against a system ROCm that uses **kpack** (device code split out of the libraries into `<rocm>/.kpack/*_lib_<arch>.kpack`) works for most requests, then on some request dies with: ``` rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218 ``` After that the engine hangs (client times out, then HTTP 503) until it is restarted. With `AMD_LOG_LEVEL=1` the cause is printed just before it: ``` :1:hip_fatbin.cpp :835 : Could not find device type specific kpack code objects for any available device from binary: ~/.local/share/strata/components/engine/0.1.55-linux-x86_64-hip-rx7900/librocblas.so.5 rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218 ``` Cause, as far as I can tell: the bundled `librocblas.so.5`, `libhipblaslt.so.1` and `librocsolver.so.0` have an empty `.hip_fatbin` (NOBITS) and a `.rocm_kpack_ref` section whose search path is **relative to the library**: ``` librocblas.so.5: ../.kpack/blas_lib_@GFXARCH@.kpack libhipblaslt.so.1: ../.kpack/blas_lib_@GFXARCH@.kpack librocsolver.so.0: ../.kpack/solver_lib_@GFXARCH@.kpack ``` In the ROCm tree that resolves to `/opt/rocm/core-10.1/.kpack/blas_lib_gfx1100.kpack` (present). After `collect_libs.py` copies the libraries into the component, `../.kpack` points at `components/engine/.kpack`, which does not exist, and `build_hip_linux.sh` never copies the `.kpack` archives (it only bundles `rocblas/library` and `hipblaslt/library` via `--data`). Kernels that rocBLAS keeps in its own fat binary (not in the Tensile library files) therefore cannot be loaded; the first request whose shapes reach one of them fails. That is why it looks intermittent. Expected: the component carries the kpack archives it needs for its target archs (or the launcher points the kpack loader at them), so the engine is self-contained like the TheRock-based package. ### Smallest steps or command that reproduce it 1. Build: `VARIANT=rx7900 DSV41=1 HP=/opt/rocm CORE=/opt/rocm LIBW=/opt/rocm packaging/build_hip_linux.sh` on a system ROCm with `/opt/rocm/.kpack` (here: ROCm core 10.1, HIP 7.16.26385), install the component. 2. `readelf -S librocblas.so.5` in the component shows `.hip_fatbin NOBITS` + `.rocm_kpack_ref`; `ls ../.kpack` from the component dir: missing. 3. Start DeepSeek-V4.1-Flash IST-DAS 2.25 bpw at `--context 1m` on 6× gfx1100 and send a few 4K-16K-token prompts. Here it failed **5 times in 5 engine starts**: four times on a ~16K-token real-code prompt (Python source + "explain and refactor"), once on a ~230-token code-generation request partway through a ~12K-token answer. The most reliable sequence: three random-word prompts of ~3.5K/7K/27K tokens, one ~4K and then one ~16K real-code prompt; it died on the ~16K one on the most recent fresh start. Synthetic prompts of the same lengths and a replay of the 230-token request did *not* trigger it on other starts, so it depends on which kernel a request reaches, not on length alone. Workaround that fixed it here (verified: the same sequence then ran 3 rounds clean, and `ROCM_KPACK_DEBUG=1` shows `opened and cached archive: /opt/rocm/core-10.1/.kpack/blas_lib_gfx1100.kpack ... loaded code object: 3940648 bytes`): ```sh ln -s /opt/rocm/core-10.1/.kpack ~/.local/share/strata/components/engine/.kpack ``` Possible fix (not tested): in `build_hip_linux.sh`, bundle `$LIBW/.kpack/{blas,solver}_lib_<arch>.kpack` for the variant's archs and lay them out so the relative `../.kpack` resolves inside the component (for example libraries in a `lib/` subfolder with `.kpack/` beside it). `librocm_kpack.so.0` also knows `ROCM_KPACK_PATH` / `ROCM_KPACK_PATH_PREFIX`, which the launcher could set instead; I did not test those. I only observed it at `--max-context 1048576`; at 64K it did not occur over a few dozen requests including a full benchmark, but nothing in the cause is context-specific, so it may just be which kernels those requests reached. Possibly related in spirit to #4350 (also a self-built gfx1100 HIP engine), but the error and the cause here are different. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.9 (commit c62d5e3) · engine 0.1.55 · self-built `0.1.55-linux-x86_64-hip-rx7900` with `DSV41=1` ### Graphics card, memory and system 6× RX 7900 XTX 24 GB (gfx1100) · Threadripper PRO 3955WX · 108 GB RAM usable · Ubuntu 26.04.1, kernel 7.0.0-42 · system ROCm core 10.1 (HIP 7.16.26385) under /opt/rocm/core-10.1 ### Model, size and settings DeepSeek-V4.1-Flash IST-DAS 2.25 bpw · 1M context (`--max-context 1048576 --eos 1 --vision on --dspark auto --dspark-conf 0.65 --tp 1 --layer-split auto`) · pictures on · `STRATA_DSV41_EXE` pointing at the self-built `strata-dsv41` ### Logs Engine log excerpt (one failing start): ``` maya ds4 serve: prompt 31 tokens = 0 reused + 31 read in 750 ms (41.4 tok/s), 1 generated in 2 ms (564.38 tok/s); CPU lane 5.2% of the experts :1:hip_fatbin.cpp :835 : Could not find device type specific kpack code objects for any available device from binary: .../0.1.55-linux-x86_64-hip-rx7900/librocblas.so.5 rocBLAS error from hip error code: 'hipErrorInvalidKernelFile':218 ``` No amdgpu errors, resets or faults in the kernel log at any of the failure times. Thanks for Strata, by the way: on this box DeepSeek V4.1 2.25 bpw read 9 of 9 planted facts at up to ~885K tokens with the workaround in place.
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#2349
No description provided.