Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

gfx906 (HIP wave64) builds again: no Qwen3.6 engine (cuBLAS calls the compat layer does not map), GGML_USE_HIP on the W4A4 target, the trellis overlay sources and the moe_f16_kq stub in the HIP source list; all targets compile for gfx906 (#3172 #3271)

Niko122110715d856d5e
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc1093502..10f9e1f95 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -744,7 +744,10 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
target_link_libraries(strata-q36ref PRIVATE strata_kernels strata_warnings ${_strata_gpu_runtime_target})
# the engine path for the same family (serve protocol, prompt chunks, decode graph): src/qwen35/q36_engine.cu, a
# library that `strata` switches to for a qwen35moe model (the family switch at the top of its main) and that
- # strata-q36 wraps on its own
+ # strata-q36 wraps on its own. Not on gfx906 (#3172, #3271): it calls cuBLAS entry points the wave64 compat layer does
+ # not map (cublasSgemm, cublasGemmStridedBatchedEx) and its kernels assume 32-lane warps; main() guards every use with
+ # STRATA_HAVE_QWEN35, so a gfx906 build links and runs the Qwen3.8 family, and `strata --families` says so
+ if(NOT STRATA_HIP_GFX906)
add_library(strata_qwen35 STATIC src/qwen35/q36_engine.cu)
target_include_directories(strata_qwen35 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${_strata_gpu_include_directories})
target_link_libraries(strata_qwen35 PRIVATE strata_prefill strata_kernels strata_warnings ${_strata_gpu_runtime_target})
@@ -758,6 +761,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
target_link_libraries(strata-q36 PRIVATE strata_qwen35 ${_strata_gpu_runtime_target})
target_link_libraries(strata PRIVATE strata_qwen35)
target_compile_definitions(strata PRIVATE STRATA_HAVE_QWEN35=1)
+ endif()
if(STRATA_ENABLE_HIP)
enable_testing()
@@ -2177,6 +2181,23 @@ if(STRATA_HIP_GFX906)
file(GLOB _strata_mmq_cu ${_strata_mmq}/*.cu ${_strata_mmq}/template-instances/*.cu)
list(APPEND _strata_cu ${_strata_mmq_cu})
target_compile_definitions(strata_mmq PRIVATE GGML_USE_HIP)
+ # #3172: strata_mmq_w4a4 is built from llama.cpp's headers too; without GGML_USE_HIP its common.cuh took the CUDA vendor header
+ # (cuda.h, cuda_bf16.h: not found). Here it only reports that W4A4 (RTX 50's FP4 MMA) is not available.
+ if(TARGET strata_mmq_w4a4)
+ target_compile_definitions(strata_mmq_w4a4 PRIVATE GGML_USE_HIP)
+ endif()
+ # #3271: three more link errors of a 0.1.44+ gfx906 build, all sources that strata_mmq lists but the glob above never saw:
+ # the trellis overlay's quantize.cu and instances (they are generated into the build tree, so the glob missed them: CMake drops a
+ # .cu source whose language is not enabled) and moe_f16_kq.cu, which moe_fused_iq.cu calls (a stub here: no gfx11 device code, so
+ # f16kq::covers() answers false and the int8 kernels run, as on every other card)
+ if(_strata_mmq_tq_overlay)
+ set(_strata_tq_hip ${_strata_tq_overlay_dir}/quantize.cu)
+ foreach(_t tq2_t tqk6 tqk7)
+ list(APPEND _strata_tq_hip ${_strata_tq_overlay_dir}/template-instances/mmq-instance-${_t}.cu)
+ endforeach()
+ list(APPEND _strata_cu ${_strata_tq_hip})
+ endif()
+ target_sources(strata_mmq PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/prefill/moe_f16_kq.cu)
endif()
set_source_files_properties(${_strata_cu} PROPERTIES LANGUAGE HIP)
endif()
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index 9a67bba21..2375cf97c 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -805,6 +805,11 @@ ninja -C build-906 strata
container with `--device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --ulimit memlock=-1`; on some boards
`HSA_OVERRIDE_GFX_VERSION=9.0.6` is needed for the runtime to accept the card.
+0.2.1 builds `ninja -C build-906 strata` again (0.1.44 to 0.2.0 stopped at `cublasSgemm` in `src/qwen35/q36_engine.cu`, at
+`cuda.h` in `strata_mmq_w4a4` and at three link errors, #3172 #3271; compiled for gfx906 on ROCm 7.10 with clang 22, all 161 targets,
+not run on a card). The Qwen3.6 family (`qwen35moe`) is not part of the gfx906 build: its engine calls cuBLAS entry points the compat
+layer does not map and its kernels assume 32-lane warps. `strata --families` lists what the binary runs (`qwen4exp`: Qwen3.8-Flash-Next).
+
**What differs from the CUDA build** (all under `STRATA_HIP_GFX906`; each A/B switch restores the CUDA layout):
| | gfx906 | switch |
diff --git a/tools/test_gfx906_build_files.py b/tools/test_gfx906_build_files.py
new file mode 100644
index 000000000..1c634757c
--- /dev/null
+++ b/tools/test_gfx906_build_files.py
@@ -0,0 +1,38 @@
+"""#3172 #3271: the gfx906 (HIP wave64 compat) build stays buildable. The real check is a compile for gfx906 (done on a box with ROCm: the
+`strata` target links); these cover what a text check can: the pieces of CMakeLists.txt a 0.1.44+ gfx906 build was missing."""
+import re
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+TEXT = (ROOT / "CMakeLists.txt").read_text(encoding="utf-8").replace("\r\n", "\n")
+
+
+class Gfx906CMake(unittest.TestCase):
+ def test_qwen35_is_not_built_for_gfx906(self):
+ # q36_engine.cu calls cublasSgemm / cublasGemmStridedBatchedEx, which the wave64 compat layer does not map; main() guards every use
+ # with STRATA_HAVE_QWEN35, so leaving the library out gives a gfx906 build that links
+ block = re.search(r"if\(NOT STRATA_HIP_GFX906\)\n add_library\(strata_qwen35.*?target_compile_definitions\(strata PRIVATE STRATA_HAVE_QWEN35=1\)\n endif\(\)", TEXT, re.S)
+ self.assertIsNotNone(block)
+ self.assertIn("add_executable(strata-q36 ", block.group(0))
+ self.assertIn("target_link_libraries(strata PRIVATE strata_qwen35)", block.group(0))
+
+ def test_every_use_of_qwen35_in_the_engine_is_guarded(self):
+ text = (ROOT / "src" / "program" / "generate.cpp").read_text(encoding="utf-8").replace("\r\n", "\n")
+ for match in re.finditer(r"qwen35::|strata/qwen35/engine\.hpp", text):
+ before = text[:match.start()]
+ self.assertGreater(before.rfind("#if defined(STRATA_HAVE_QWEN35)"), before.rfind("#endif"), match.group(0))
+
+ def test_the_w4a4_target_gets_the_hip_definition(self):
+ self.assertRegex(TEXT, r"if\(TARGET strata_mmq_w4a4\)\n\s+target_compile_definitions\(strata_mmq_w4a4 PRIVATE GGML_USE_HIP\)")
+
+ def test_overlay_sources_and_the_f16_stub_are_in_the_gfx906_build(self):
+ tail = TEXT[TEXT.index("# ---- HIP gfx906: every CUDA source"):]
+ self.assertIn("${_strata_tq_overlay_dir}/quantize.cu", tail)
+ self.assertIn("mmq-instance-${_t}.cu", tail)
+ self.assertIn("target_sources(strata_mmq PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/prefill/moe_f16_kq.cu)", tail)
+ self.assertLess(tail.index("moe_f16_kq.cu"), tail.index("set_source_files_properties(${_strata_cu} PROPERTIES LANGUAGE HIP)"))
+
+
+if __name__ == "__main__":
+ unittest.main()