mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2769] [CLOSED] [Engine] add experimental Muse Spark CPU/CUDA reference runtime #4256
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#4256
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/2769
Author: @BColsey
Created: 10/16/2026
Status: ❌ Closed
Base:
main← Head:feature/muse-spark-reference-2762📝 Commits (10+)
7feaa59feat: add opt-in Muse Spark GGUF streaming reference runtimecb0119fbuild: reserve opt-in Muse reference runtime boundary9688c64test: add independent Muse Spark numerical oracle34bb730Merge reviewed Muse native runtime4362806Merge reviewed independent Muse oracle3955c25docs: describe experimental Muse reference runtime and limits91bfd2e[Docs] refresh Muse build prerequisites for current mainbb9ef5b[Engine] isolate Muse adapter backend and Windows build policy405b506[Engine] exercise Muse CUDA execution through opt-in tests6b92a49[Docs] describe explicit Muse CUDA regression checks📊 Changes
18 files changed (+2329 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+10 -0)📝
README.md(+3 -0)📝
docs/MODELS.md(+3 -0)➕
docs/MUSE_SPARK.md(+144 -0)➕
include/strata/muse/model.hpp(+55 -0)➕
src/muse/CMakeLists.txt(+23 -0)➕
src/muse/cuda_matvec.cpp(+54 -0)➕
src/muse/cuda_matvec.hpp(+17 -0)➕
src/muse/main.cpp(+20 -0)➕
src/muse/model.cpp(+573 -0)➕
src/muse/model_test.cpp(+473 -0)➕
src/muse/test_allocations.cpp(+27 -0)➕
tools/muse/__init__.py(+1 -0)➕
tools/muse/compare.py(+77 -0)➕
tools/muse/fixture.py(+152 -0)➕
tools/muse/reference.py(+185 -0)➕
tools/muse/test_build.py(+157 -0)➕
tools/muse/test_oracle.py(+355 -0)📄 Description
Problem and result
Strata has no Muse Spark text execution path. This PR adds a separate, opt-in
strata-musereference CLI for existingmuse-sparkGGUF shards. It accepts token IDs and evaluates the text graph with file-backed weights and bounded decoded row tiles, on CPU or through an optional NVIDIA CUDA/cuBLAS adapter.This is an experimental numerical reference runtime. It does not claim full 816B checkpoint inference, model quality, usable speed, or installer/chat/API integration.
Related discussion
Refs #2762; this does not close that broader feature request. Broader integration still needs agreed scope. Independent baseline fixture failures found during validation are fixed separately in #3778 (setup, referencing #1935) and #3782 (Terminal portability).
Approach
STRATA_ENABLE_MUSEdefaults toOFF. The runtime uses the existing GGUF reader and pinned GGML row converters independently of the normal Qwen numerical path. Existing model inventories, setup defaults, server code and dependency pins are unchanged.Muse's NVIDIA adapter is excluded from HIP gfx906 compatibility mode, which retains the CPU path. An explicit Muse/SYCL combination fails before entering the separate SYCL project. Both Muse executables use the existing Windows UTF-8 manifest helper. Four CMake graph regressions protect these boundaries and the missing-row-converter diagnostic; they do not simulate backend compilation or Windows runtime execution.
An independent NumPy oracle checks the full text graph. The explicit
muse_model_test --cudamode adds device checks for F32, F16/Q8_0 and synthetic IQ1_S/Q6_K/Q8_0 rows, four greedy steps, separate EOS/EOT stops and zero-step output. The normal CTest remains CPU-only. Build/run instructions are indocs/MUSE_SPARK.md.Validation
Submitted and tested revision:
af1c8b2706033b6878023b0a0fcdf86794e3ad7e, based on main011c9e600a93bbc9fd451c563501b5831c32bbca. GGML pin:3cf03257f219afbe7334045ff7c6a06ac68c627d. The original source archive and updated test-file SHA-256 were checked after transfer. The final change frome0002b04only releases mapped fixture/read handles before file mutation on Windows; production and CMake inputs are unchanged.Linux x86-64, Ubuntu 26.04.1 LTS; AMD Ryzen 9 3900X (12 cores/24 threads), about 60 GiB usable RAM; NVIDIA driver 580.178.04. Isolated Ubuntu 24.04.2 build container: GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1, CUDA toolkit 13.0 (
nvcc13.0.48), Python 3.12.3, NumPy 1.26.4. These are system test packages, not a check of the pinned Python requirements.Passed:
atol=rtol=2e-5:1.60896658e-61.162e-61.60896658e-61.19e-61.60896658e-61.19e-6Both CPU paths also passed (
max_abs=1.66910654e-6). These are separate single-GPU checks.Focused build and device commands
Run from
/src, pinned GGML at/llama, writable outputs at/out:ASan/UBSan with leak detection: 5/5 focused CTests passed, including host allocation-failure/recovery checks. Built CPU-only with
RelWithDebInfo, bothCMAKE_C_FLAGSandCMAKE_CXX_FLAGSset to-fsanitize=address,undefined -fno-omit-frame-pointer, andCMAKE_EXE_LINKER_FLAGS=-fsanitize=address,undefined; ran the same CTest filter withASAN_OPTIONS=detect_leaks=1:halt_on_error=1andUBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1.Actual RTX 3060 CUDA memory check:
Observed:
LEAK SUMMARY: 0 bytes leaked in 0 allocations;ERROR SUMMARY: 0 errors.Unavailable CPU-build CUDA backend and an invalid CUDA device ordinal both exited 1 before creating an output file.
git diff --check origin/main...HEADpassed. The public CLI, numerical runtime, CUDA adapter and oracle sources are unchanged from the earlier validated revision; the new changes are build integration, regression checks, fixture lifetimes and documentation.Default-off validation now includes the complete CUDA engine target. Built main and the submitted revision with the same image, dependency sources, internal paths and compiler cache, leaving Muse off:
Both builds completed. After the final test-only change, the CUDA target again reported
ninja: no work to doand retained the same hashes. Artifacts matched byte-for-byte:Actual oneAPI/SYCL default-off engine build passed: 134/134 build steps, including the final
sycl/stratalink. Ubuntu 26.04 build container; IntelLLVMicx/icpx2026.1.0 (20260617), CMake 4.2.3, Ninja 1.13.2. Built generic SPIR-V/JIT with no AOT target or GPU access:The same real toolchain also rejects
STRATA_ENABLE_SYCL=ONwithSTRATA_ENABLE_MUSE=ONat the intended top-level diagnostic, before entering the SYCL subproject. This is compilation/configuration evidence; no Intel GPU execution or optional SYCL NumPy parity tests were run.Actual HIP gfx906 compilation also passed with the documented community ROCm 7.14.60850 image (Ubuntu 24.04.5): Clang 23.0.0, CMake 3.28.3 and Ninja 1.11.1. Built all six focused Muse/artifact targets with Muse enabled, then ran 5/5 CPU CTests without an NVIDIA toolkit. The complete default-off gfx906 engine built in 158/158 steps. On final head
af1c8b27, the changed Muse test was rebuilt and all five tests passed again; the default engine target then reported no work. No AMD GPU was exposed to these containers, and no HIP hardware execution is claimed. The oneAPI default-off engine also passed an incremental final-head check with its executable hash unchanged.HIP gfx906 configuration and build commands
The base image was
mixa3607/rocm-gfx906@sha256:83d0b8ba6c98512a05b0d306b0875f0c696632a9015821f739d5698d982ce9fb, with CMake/Ninja build packages added in an isolated image.For the default engine, the same configuration used
/out/build-default,STRATA_ENABLE_MUSE=OFFandSTRATA_BUILD_TESTS=OFF, thencmake --build /out/build-default --target strata --parallel 2.Windows CPU validation passed in the exact-source MSVC run, checking out final
af1c8b27and the same GGML pin. Hardware: AMD EPYC 9V45 virtual machine, two cores/four logical CPUs, about 16 GiB RAM; Windows Server 2025 build 26100. Toolchain: Visual Studio 18.11.12315.225, MSVC 19.51.36260.0, SDK 10.0.26100.0, CMake 4.4.4, Ninja 1.13.2, Python 3.12.10 and NumPy 1.26.4.mt.exeand verifiedactiveCodePage=UTF-8.max_abs=1.41593384e-6,atol=rtol=2e-5.The linked workflow preserves commands and artifacts. Its Unicode oracle step explicitly uses
PYTHONUTF8=1andPYTHONIOENCODING=utf-8for redirected Python fixture logs; actual stdout/stderr were verified as UTF-8. This does not substitute for the executable manifests or native Unicode-path checks.The complete Terminal suite passed on combined validation revision
dcb54ca39104f77695c3820b8597b7a5af4bfd95: earlier Musee0002b04plus the test-only companions #3778 and #3782. It reported 1,312 passed, 42 skipped, 226 subtests passed, exit 0, in 632.64 seconds. Environment: Linux x86-64, Xeon E5-2690 v2, Python 3.11.2, pytest 9.1.1, pytest-asyncio 1.4.0, Textual 8.2.8, Rich 15.0.0; isolated container with standard site-packages, read-only source, no network and--init. Command:python3 -m pytest -q -p no:cacheprovider tests/terminal.These are combined-branch results; the companion fixes have not merged into this MR or main. The final Muse change only adjusts a C++ test fixture; Terminal source inputs are unchanged from this run. The run emitted six warnings: three invalid-escape deprecations and three TUI worker/closed-loop warnings, which are not claimed fixed here. The same three worker/coroutine warnings reproduce on unmodified main in the ordered TUI test pair (two tests pass there and on the companion branch). The Terminal fixture failures were reproduced on main and repaired in #3782.
Failed before fixes:
At
e0002b04, MSVC built all six targets and verified both manifests, but the Muse native test attempted to delete a shard while its model still held the mapping. The final test-only commit releases that model first and closes consumed output readers before rewriting the JSON file. All assertions and production file-sharing behavior are retained. Final-head native tests pass on Linux CPU/CUDA, HIP CPU fallback and MSVC.Independent baseline fixture failures were reproduced before repair.
The four original setup-test errors were reproduced on unmodified main on an AVX-only Xeon E5-2690 v2. They came from host-dependent cached-engine fixtures, and are repaired in the separate test-only #3778: the same command passes 79/79 tests there on Python 3.12.3. Production ISA checks are unchanged.
Terminal portability failures were also reproduced on main and are fixed separately in #3782; the passing combined results above include that companion.
Not run:
Limits
The independent fixture has two layers, four experts/top2, local-window crossing and 448 logits. Synthetic quantized rows do not validate published weights. The CUDA adapter uses cuBLAS over decoded tiles; it is not Strata's optimized expert cache or a native quantized GPU kernel. Unsupported row encodings and scaled RoPE fail explicitly.
Mapped-file/page-cache residency, headers, allocator and library overhead are outside the calculated KV/scratch bound. Input shards must remain unchanged; a failed run can leave partial JSON. This PR covers the experimental reference CLI; it does not complete #2762's broader integration.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.