[PR #289] [CLOSED] Start: name the GPU and stop at once when the build has no code for it; STRATA_EMULATE_CC #2555

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/289
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: pr/gpu-check-emulate


📝 Commits (1)

  • c504d14 Start: name the GPU and stop at once when the build has no code for it; STRATA_EMULATE_CC for tests

📊 Changes

9 files changed (+85 additions, -4 deletions)

View changed files

📝 include/strata/core/device.hpp (+4 -0)
➕ include/strata/core/emulate.hpp (+36 -0)
📝 src/core/device.cu (+9 -0)
📝 src/kernels/cuda/fused_gr.cu (+2 -0)
📝 src/kernels/cuda/qsa.cu (+2 -0)
📝 src/kernels/cuda/qsa_prompt_attn.cu (+6 -1)
📝 src/kernels/cuda/qsa_select.cu (+6 -1)
📝 src/prefill/ggml_cuda_host.cu (+3 -2)
📝 src/program/generate.cpp (+17 -0)

📄 Description

Summary

  • A clear stop for a wrong build. Before the expert arena loads, the engine names the card and its compute
    capability, and checks that the build has code for it (cudaFuncGetAttributes on a kernel). A binary built for
    other GPUs used to fail at its first kernel, after the whole arena had loaded. Now it stops in ~0.3 s, names the
    card and its sm_, and says to rebuild (setup does).
  • STRATA_EMULATE_CC=75|80|86|89, for tests. With a PTX build for an older generation (e.g.
    CMAKE_CUDA_ARCHITECTURES=86-virtual, JIT-compiled on a newer card), the host's device queries answer as that
    card: compute capability for ggml's MMQ configs and the QSA kernel choice, shared memory per block (64 KB on
    Turing). The kernels are then the real card's, so their results are too, though their speed is not. This is how
    the fork tested RTX 20/30/40 code paths on an RTX 5090.
  • STRATA_QSA_WARP=1|select|attn: the pre-sm_80 QSA kernels on any card, for A/B.

Measured

On the fork, an sm_86-only build on the RTX 5090 stops in 0.3 s with the card's name. Emulated sm_75/86/89 builds
give first-token KL to the native sm_120a build of 0.0005 (sm_89), 0.0003 (sm_86) and 0.0034 (sm_75), all with the
same top-1. On main (IQ2_XS) the check prints the card and changes nothing else.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 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/289 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/gpu-check-emulate` --- ### 📝 Commits (1) - [`c504d14`](https://github.com/Niko1221/Strata/commit/c504d147dd5c4d3b81f1af6dbc18effd86e37076) Start: name the GPU and stop at once when the build has no code for it; STRATA_EMULATE_CC for tests ### 📊 Changes **9 files changed** (+85 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/device.hpp` (+4 -0) ➕ `include/strata/core/emulate.hpp` (+36 -0) 📝 `src/core/device.cu` (+9 -0) 📝 `src/kernels/cuda/fused_gr.cu` (+2 -0) 📝 `src/kernels/cuda/qsa.cu` (+2 -0) 📝 `src/kernels/cuda/qsa_prompt_attn.cu` (+6 -1) 📝 `src/kernels/cuda/qsa_select.cu` (+6 -1) 📝 `src/prefill/ggml_cuda_host.cu` (+3 -2) 📝 `src/program/generate.cpp` (+17 -0) </details> ### 📄 Description ## Summary - **A clear stop for a wrong build.** Before the expert arena loads, the engine names the card and its compute capability, and checks that the build has code for it (`cudaFuncGetAttributes` on a kernel). A binary built for other GPUs used to fail at its first kernel, after the whole arena had loaded. Now it stops in ~0.3 s, names the card and its `sm_`, and says to rebuild (setup does). - **`STRATA_EMULATE_CC=75|80|86|89`**, for tests. With a PTX build for an older generation (e.g. `CMAKE_CUDA_ARCHITECTURES=86-virtual`, JIT-compiled on a newer card), the host's device queries answer as that card: compute capability for ggml's MMQ configs and the QSA kernel choice, shared memory per block (64 KB on Turing). The kernels are then the real card's, so their results are too, though their speed is not. This is how the fork tested RTX 20/30/40 code paths on an RTX 5090. - **`STRATA_QSA_WARP=1|select|attn`**: the pre-sm_80 QSA kernels on any card, for A/B. ## Measured On the fork, an sm_86-only build on the RTX 5090 stops in 0.3 s with the card's name. Emulated sm_75/86/89 builds give first-token KL to the native sm_120a build of 0.0005 (sm_89), 0.0003 (sm_86) and 0.0034 (sm_75), all with the same top-1. On main (IQ2_XS) the check prints the card and changes nothing else. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:17 +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#2555
No description provided.