[PR #532] [CLOSED] tests: prefill_mmq_kquant_test waits for its uploads before the kernels #2681

Closed
opened 2026-11-04 02:02:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/532
Author: @eadra
Created: 10/2/2026
Status: ❌ Closed

Base: main ← Head: fix/mmq-kquant-test-sync


📝 Commits (10+)

  • 9bbee42 server (#208 follow-up): a request stamps last_request_at in load() (the idle thread cannot unload between load and run); unload() sends QUIT before terminate; the VRAM guard checks the first GPU (docs); #163's test engine answers poll()
  • a94fe10 Docker build (#96): the engine compiled in docker build, STRATA_EXECV so the server is PID 1, SIGTERM stops it cleanly, KV/GPUS/LOW_RAM as env vars
  • 01bca8a Pascal (sm_60): bring the engine up on compute capability 6.0
  • dfa2bda core: add guarded shared expert arena backing
  • f9dad01 docs: limit shared arena backing to dev shm
  • 77709ef Multi-GPU: the session carve and the per-stage prompt loans
  • 1f5db5f wip: version 0.1.30
  • 01df436 STATE_HASH: pooled= keeps its 0.1.29 meaning (the completed indexer rows); the extent with the spare row is pooled_full=
  • 93d81fb qsa: the table indexer's spare rotates at position 0 like the native one (TODO 7)
  • 71f031f rope: one validity rule for the resolved config; none passes the identity constants to every analytic site

📊 Changes

1 file changed (+3 additions, -0 deletions)

View changed files

📝 tests/cuda/prefill_mmq_kquant_test.cpp (+3 -0)

📄 Description

What

prefill_mmq_kquant_test uploads its inputs and sets the NaN sentinel with cudaMemcpy / cudaMemset on the legacy
stream, then runs the MMQ kernels on a cudaStreamNonBlocking stream, which does not wait for the legacy stream. A
pageable copy (or the sentinel memset) can still be in flight when the kernels start. This adds a
cudaDeviceSynchronize() before the kernels, the same fix the fused tests got in 0.1.36
(prefill_fused_moe_test.cpp, prefill_fused_iq_test.cpp). Test-only: the engine is unchanged.

Measured

RTX 4090 (sm_89, 128 SMs), Windows 11, CUDA 13.3, a -DSTRATA_MMQ_KQUANTS=ON -DSTRATA_BUILD_TESTS=ON build:

runs result
without the sync 3 3 failed: "unwritten or non-finite output", in a different product each run (Q4_K, Q5_K, Q5_1 in the multi-expert batches)
with the sync 5 5 passed, every product inside the screen

The failing outputs were whole 128-row tiles left at the sentinel (NaN), or zero when the sentinel was skipped. The
kernels themselves are fine: the same products pass once the inputs are guaranteed to be on the device.

Note

#478 (Q6_K) edits the same file, in the header comment and main().
This change is inside product(), so the two apply independently.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/532 **Author:** [@eadra](https://github.com/eadra) **Created:** 10/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/mmq-kquant-test-sync` --- ### 📝 Commits (10+) - [`9bbee42`](https://github.com/Niko1221/Strata/commit/9bbee42720cc40cab1d18efd32e57b7ec6ba34ea) server (#208 follow-up): a request stamps last_request_at in load() (the idle thread cannot unload between load and run); unload() sends QUIT before terminate; the VRAM guard checks the first GPU (docs); #163's test engine answers poll() - [`a94fe10`](https://github.com/Niko1221/Strata/commit/a94fe1064a5e464f367d78d42747e7f7c0ce9655) Docker build (#96): the engine compiled in docker build, STRATA_EXECV so the server is PID 1, SIGTERM stops it cleanly, KV/GPUS/LOW_RAM as env vars - [`01bca8a`](https://github.com/Niko1221/Strata/commit/01bca8a4eabd9897c5e6b5facbc707020697d9bb) Pascal (sm_60): bring the engine up on compute capability 6.0 - [`dfa2bda`](https://github.com/Niko1221/Strata/commit/dfa2bda72ec9bb309e2047d759de361cc66490f8) core: add guarded shared expert arena backing - [`f9dad01`](https://github.com/Niko1221/Strata/commit/f9dad017b53f9a1e0660786f69265bf20976ef0a) docs: limit shared arena backing to dev shm - [`77709ef`](https://github.com/Niko1221/Strata/commit/77709ef32060ebc46800f5b63db04965660ac4e0) Multi-GPU: the session carve and the per-stage prompt loans - [`1f5db5f`](https://github.com/Niko1221/Strata/commit/1f5db5fc5adde2e7379bc200223ebb6beace3ce5) wip: version 0.1.30 - [`01df436`](https://github.com/Niko1221/Strata/commit/01df4363acafd46b4e08674607732ca7e3daf95d) STATE_HASH: pooled= keeps its 0.1.29 meaning (the completed indexer rows); the extent with the spare row is pooled_full= - [`93d81fb`](https://github.com/Niko1221/Strata/commit/93d81fb147a13f9613715d56b0ba0d04260de734) qsa: the table indexer's spare rotates at position 0 like the native one (TODO 7) - [`71f031f`](https://github.com/Niko1221/Strata/commit/71f031f63f08ca18b0a2d47ba27e960f3fc098df) rope: one validity rule for the resolved config; none passes the identity constants to every analytic site ### 📊 Changes **1 file changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/cuda/prefill_mmq_kquant_test.cpp` (+3 -0) </details> ### 📄 Description ## What `prefill_mmq_kquant_test` uploads its inputs and sets the NaN sentinel with `cudaMemcpy` / `cudaMemset` on the legacy stream, then runs the MMQ kernels on a `cudaStreamNonBlocking` stream, which does not wait for the legacy stream. A pageable copy (or the sentinel memset) can still be in flight when the kernels start. This adds a `cudaDeviceSynchronize()` before the kernels, the same fix the fused tests got in 0.1.36 (`prefill_fused_moe_test.cpp`, `prefill_fused_iq_test.cpp`). Test-only: the engine is unchanged. ## Measured RTX 4090 (sm_89, 128 SMs), Windows 11, CUDA 13.3, a `-DSTRATA_MMQ_KQUANTS=ON -DSTRATA_BUILD_TESTS=ON` build: | | runs | result | | --- | ---: | --- | | without the sync | 3 | 3 failed: "unwritten or non-finite output", in a different product each run (Q4_K, Q5_K, Q5_1 in the multi-expert batches) | | with the sync | 5 | 5 passed, every product inside the screen | The failing outputs were whole 128-row tiles left at the sentinel (NaN), or zero when the sentinel was skipped. The kernels themselves are fine: the same products pass once the inputs are guaranteed to be on the device. ## Note [#478](https://github.com/Niko1221/Strata/pull/478) (Q6_K) edits the same file, in the header comment and `main()`. This change is inside `product()`, so the two apply independently. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:20 +07:00
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#2681
No description provided.