mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2515] [CLOSED] setup: pin -DSTRATA_Q6K_EXPERTS=ON and -DSTRATA_MMQ_KQUANTS=ON in the CUDA and HIP engine builds (stale CMake cache silently drops the K-quant kernels) #4089
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#4089
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/2515
Author: @p3lusa
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:fix/stale-cmake-cache-q6k-experts📝 Commits (2)
b89b213setup: pin -DSTRATA_Q6K_EXPERTS=ON in the CUDA engine build4b9793dsetup: pin -DSTRATA_MMQ_KQUANTS=ON too, on CUDA and HIP (qiuzan2001:465cd61dflipped both options the same way)📊 Changes
4 files changed (+39 additions, -3 deletions)
View changed files
📝
Dockerfile(+1 -1)📝
setup.py(+5 -2)📝
tools/test_setup_amd.py(+2 -0)📝
tools/test_setup_choices.py(+31 -0)📄 Description
Summary
setup.pycompiles the CUDA engine without ever passing-DSTRATA_Q6K_EXPERTS, relying on the CMakeoption()default. That default wasOFFwhen the option was introduced (ac7db2e5, 2026-10-05) and flipped toONin465cd61d(2026-10-12). CMake does not rewrite an option that is already inCMakeCache.txt, so abuild/folder first configured while the default wasOFFkeepsSTRATA_Q6K_EXPERTS:BOOL=OFFforever — even aftergit pullbrings the newCMakeLists.txtwith theONdefault.source_hash(ENGINE_SOURCES)fingerprints the source files (so setup does recompile after the pull), but it does not cover CMake option values. The result: setup recompiles the engine, silently, with the Q6_K gate/up grouped expert kernels still disabled.This PR pins
-DSTRATA_Q6K_EXPERTS=ONexplicitly in the CUDA engine build (setup.py) and in the Dockerfile build, so a stale cache entry can no longer override the default the build promises.The failure (exact startup error)
Starting the model
Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf(Unsloth UD-Q4_K_XL, whose routed experts are Q4_K gate/up + Q6_K down) through./setup.sh --host 0.0.0.0 --port 6001 --setup(choice 6 → 1), the engine started and immediately refused to load the model:The engine binary in
engine/had been built withSTRATA_Q6K_EXPERTS=OFF, soK::native_expert_supported()(src/qwen35/q36_engine.cu:973) rejected the Q6_K expert layout and the model never loaded. Retrying with smaller--max-context(131072 → 65536 → 32768 → 8192) did not help — it is not a memory issue, the kernels were simply absent from the binary.Root cause
build/CMakeCache.txton the affected machine hadSTRATA_Q6K_EXPERTS:BOOL=OFF.296b59d2, 2026-10-14) does contain theON-default commit465cd61d, and itsCMakeLists.txt:83readsoption(STRATA_Q6K_EXPERTS ... ON).build/folder predates that flip: it was configured when the default was stillOFF. CMake keeps the cached value and ignores the new default on re-configure.setup.py's recompile trigger (source_hash) saw the changed sources and recompiled — but recompiled with the cachedOFF, so the Q6_K kernels were never compiled in.Verified with a minimal CMake reproduction:
-DSTRATA_Q6K_EXPERTS=OFF→ cacheOFFCMakeLists.txttoON, re-configure without the flag → cache staysOFF(the bug)-DSTRATA_Q6K_EXPERTS=ON→ cache becomesON(the fix)Is it hardware-specific?
No. It is a CMake cache-staleness issue, independent of GPU, architecture, or OS. The only requirements to hit it are:
build/folder configured before the default flipped toON(i.e. before465cd61d), andblk.34here).The affected machine was an RTX 3080 Ti (sm_86, 12 GB VRAM), 26 GB RAM, Linux (Ubuntu), running the model in Strata's hybrid-experts mode (51/256 experts per layer in VRAM, the rest in pinned host RAM). The hardware only determines how the model runs (hybrid experts on a 12 GB card); it does not cause the failure. Any platform with a stale
build/cache and a Q6_K-expert model hits the same error.The patch
setup.py(build_engine, CUDA path): add-DSTRATA_Q6K_EXPERTS=ONand-DSTRATA_MMQ_KQUANTS=ONto the enginecmake_builddefinitions. An explicit-Don the configure command line overrides the stale cache entry, so the engine always has the Q6_K gate/up kernels and thestrata_kqK-quant MMQ library its default build promises. (465cd61dflipped both options OFF→ON the same way and CMake caches both the same way — qiuzan2001's review; pinning only one leaves the other stale.)setup.py(build_engine_hip): both pins on the HIP configure too.build-hiphas the same stale-cache case — theONdefault never reaches an existing cache. Safe for the gfx906/#1396 concern:setup.pynever builds gfx906 (its AMD path is gfx1100/gfx1101/gfx1102/gfx1200/gfx1201), and both flags match themaindefaults, so a clean HIP configure is byte-identical — the-Donly overrides a stale entry.Dockerfile: same pins, for consistency (the Docker build starts from a clean cache, so it already getsONfrom the default; the explicit flags document intent and are robust if the default ever changes).tools/test_setup_choices.py/tools/test_setup_amd.py: assert both flags reach the CUDA and HIP engine def lists, so a future edit that drops a pin fails a test.Verification
On the affected machine, after reconfiguring with
-DSTRATA_Q6K_EXPERTS=ONand rebuilding, the engine binary gained the Q6_K grouped-kernel instances (native_gu_kernel<14>/native_down_kernel<14>; template instantiations went from 102 → 143), and the same startup line that previously failed now reaches:The
blk.34.experts ... do not takeerror is gone.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.