Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
#1825 qsa_select: the thread-per-head prompt scorer is on for the Turing series (STRATA_SM75_PERF=1) or STRATA_SCORES_THREAD=1, not a default elsewhere
Niko1221f116778bd59b
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 9cb9c7074..ba4556c1a 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -413,7 +413,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)target_include_directories(qsa_scores_parity PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})target_link_libraries(qsa_scores_parity PRIVATE strata_kernels CUDA::cudart)add_test(NAME qsa_scores_parity COMMAND qsa_scores_parity)- set_tests_properties(qsa_scores_parity PROPERTIES SKIP_RETURN_CODE 77)+ set_tests_properties(qsa_scores_parity PROPERTIES SKIP_RETURN_CODE 77 ENVIRONMENT "STRATA_SCORES_THREAD=1")endif()# the QSA selection (block scores on the warp kernel and the tensor-core one, top-k): a GPU bench with a# scorer-vs-scorer comparison and an FP64 accuracy gate (synthetic, no model); the ctest runs a 32K context under adiff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex a07c135a1..9c1ad3a23 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -2057,9 +2057,10 @@ variable, which wins in both directions (`=0` off, `=1` on): `STRATA_SM75_IL` (i`STRATA_SM75_EXP` (expert layout mode 4), `STRATA_GR_UP75` / `STRATA_GR_DOWN_TG` (hyper-connection read), `STRATA_SCORES_HALVE`and `STRATA_TOPK_SPLIT` (decode QSA selection), `STRATA_TOPK_SAMPLE` (prompt top-k, one read of the scores), `STRATA_ATTN_V3`(decode attention), `STRATA_Q2_WARP` (Q2_0 matvec), `STRATA_FUSE_WAIT=2` and `STRATA_QIL` (fewer launches per decode layer),-`STRATA_TC_SM75` (BF16 dequant, 16-byte stores), `STRATA_PA_V1_PREFETCH` (prompt attention v1 prefetch).+`STRATA_TC_SM75` (BF16 dequant, 16-byte stores), `STRATA_PA_V1_PREFETCH` (prompt attention v1 prefetch),+`STRATA_SCORES_THREAD` (#1825: the prompt path's thread-per-head block scorer, bitwise the warp kernel's scores; `=1` takes it on any+CUDA card, where it measured +1..3 % prompt speed on a Tesla P100 at 30-60K tokens, so it is not a default there).Options that change answers (other summation order) are separate and explicit: `STRATA_SELECT_SIMT=1|2` (FP32 tiled block scorer,KL 0.01 against the warp scorer per #2071), `STRATA_PA_V2T=1` (v2 prompt attention, #2092/#2146), `STRATA_PF_FUSED=1-STRATA_PF_FUSED_SM75=1` (fused int8 prompt experts, #2145), `STRATA_BF16_TC=1` with `STRATA_XN_F16` (#2091).-`STRATA_NO_PCIE_GROUP=1` (#2223, any CUDA card) drops the empty PCIe-share stage and needs `--pcie-frac 0`.+STRATA_PF_FUSED_SM75=1` (fused int8 prompt experts for the Q2_0 pack, #2145; only on a 7.5 card, sm_80+ is unchanged), `STRATA_BF16_TC=1` with `STRATA_XN_F16` (#2091).diff --git a/src/kernels/cuda/qsa_select.cu b/src/kernels/cuda/qsa_select.cuindex 5e7a223b2..2651982d4 100644--- a/src/kernels/cuda/qsa_select.cu+++ b/src/kernels/cuda/qsa_select.cu@@ -1375,6 +1375,24 @@ __global__ void __launch_bounds__(SCORE_WARPS * 32) block_scores_halve_kernel(co}}+// #1825: the prompt path's thread-per-head scorer (bitwise the warp kernel's scores). Default: Turing with+// STRATA_SM75_PERF=1 (the P100 gain measured here is +1..3% at 30-60K tokens, under the 3% bar for a new default);+// STRATA_SCORES_THREAD=1 turns it on, =0 off, on any CUDA card+bool scores_thread_on() {+ static const int env = [] { const char* v = std::getenv("STRATA_SCORES_THREAD"); return v ? (std::atoi(v) != 0 ? 1 : 0) : -1; }();+ if (env >= 0) return env != 0;+ static int ok[64] = {}; // 0 unknown, 1 yes, 2 no+ int dev = 0;+ if (cudaGetDevice(&dev) != cudaSuccess || dev < 0 || dev >= 64) { cudaGetLastError(); return false; }+ if (ok[dev] == 0) {+ int major = 0, minor = 0;+ cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev);+ cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, dev);+ ok[dev] = strata::sm75_default(major, minor) ? 1 : 2; // Turing, STRATA_SM75_PERF=1+ }+ return ok[dev] == 1;+}+bool scores_halve_on() {static const int env = [] { const char* v = std::getenv("STRATA_SCORES_HALVE"); return v ? (std::atoi(v) != 0 ? 1 : 0) : -1; }();if (env >= 0) return env != 0;@@ -1429,10 +1447,9 @@ void qsa_block_scores(const float* pooled, const float* dead, const float* q_idx}const int64_t reach = active_blocks > 0 && active_blocks < max_blocks ? active_blocks : max_blocks;#if !defined(__HIPCC__)- // prompt calls (an active-block count): the thread-per-head kernel, the same bits. STRATA_SCORES_THREAD=0: the warp- // kernel below- static const bool thread = [] { const char* v = std::getenv("STRATA_SCORES_THREAD"); return v == nullptr || std::atoi(v) != 0; }();- if (thread && active_blocks > 0) {+ // prompt calls (an active-block count): the thread-per-head kernel, the same bits (opt-in: scores_thread_on); else the+ // warp kernel below+ if (active_blocks > 0 && scores_thread_on()) {const dim3 tgrid((unsigned) ((reach + TS_BR - 1) / TS_BR), (unsigned) ((nq + TS_Q - 1) / TS_Q));block_scores_thread_kernel<<<tgrid, 256, 0, (cudaStream_t) stream>>>(pooled, q_idx, steps, nq, max_blocks, reach,scores);