mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3128] [CLOSED] Bound Qwen3.6 Windows CUDA placement by dedicated VRAM headroom #4468
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#4468
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/3128
Author: @kbc20f11
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:fix/windows-q36-resident-vram📝 Commits (1)
28d9bb9Bound Qwen3.6 Windows CUDA placement by resident VRAM📊 Changes
1 file changed (+94 additions, -6 deletions)
View changed files
📝
src/qwen35/q36_engine.cu(+94 -6)📄 Description
Qwen3.6 currently uses
cudaMemGetInfodirectly when sizing prompt chunks, admitting session caches and placing routed Experts. Under Windows/WDDM, the reported allocation budget can exceed the dedicated VRAM available on the adapter, so an automatic configuration can put Experts in CUDA allocations that require OS paging instead of the intended CPU/GPU hybrid placement.An instrumented process using the same Qwen3.6 placement logic reported CUDA free memory of 12.85 GiB while its simultaneous NVML reading showed only 0.91 GiB of dedicated VRAM free. This was on an RTX PRO 4000 Blackwell SFF 24 GB with another process holding a touched 16 GiB allocation. The counters have different meanings; this change does not treat the CUDA API itself as defective.
The Windows CUDA path now bounds each startup free-memory estimate by
min(CUDA free, NVML dedicated free). NVML is loaded dynamically from System32 and the active adapter is selected by its CUDA PCI bus address, avoiding assumptions about CUDA/NVML device numbering. Missing NVML, failed queries and inconsistent counters fall back to the previous CUDA estimate.STRATA_Q36_PLACE_DEBUGprints the two readings and the selected value. Linux/HIP retain their existing query behavior.The existing Expert placement algorithm, packed-weight release, MTP-only CPU placement, 768 MiB default reserve and conditional 256 MiB near-fit reserve remain unchanged. This is a startup budget correction; it cannot guarantee future residency or reserve VRAM against other applications.
Related: #1911 addresses the same Windows memory-accounting problem in the common Expert-cache path. This change covers the separate Qwen3.6 path, which that PR does not modify.
Draft status: the Windows CUDA build and the checks below passed. Other GPU backends have not been compiled, and a successful upstream real-model run remains outstanding because the installed mixed-quant GGUF is rejected by upstream before these queries. This is not ready for a final merge decision on the evidence available here.
Validation:
strata-q36target successfully with CUDA 13.2, sm120, portable AVX2 and Release configuration on Windows.Reproduction on Windows with an upstream-supported Qwen3.6 GGUF:
strata-q36using the project's normal Windows CUDA build procedure. Run the same supported GGUF with and without this patch. Keep the context, chunk, MTP and other options identical; leave--expert-vramand--expert-slotsunset so Expert placement remains automatic.resident VRAM budgetlines print CUDA free memory, device-wide dedicated free memory and the selected value. The selected value must not exceed either reading. The existing Expert placement log shows whether the result is all-GPU or CPU/GPU hybrid. NVML must be available for the clamp to apply; otherwise the diagnostic explicitly reports the CUDA fallback.nvidia-smi --query-gpu=pci.bus_id,memory.free,memory.total --format=csv. Keep the other GPU workload live throughout the test. A separate allocation on a larger card is not a fixed physical smaller-card profile, and this correction does not prevent WDDM from paging other allocations later.The source change introduces no external SDK or test-file dependency. Driver-failure and counter-edge cases were tested with a separate deterministic host harness; those tests are described above rather than being required to reproduce the real Windows memory-accounting discrepancy.
References:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.