Skip to content

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++

Turing port: run on RTX 20 (sm_75) and newer

Hozák Martinddfb98a6eabd
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfe390956..0f8a646f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,14 +62,15 @@ if(STRATA_ENABLE_CUDA)
endif()
foreach(_a IN LISTS CMAKE_CUDA_ARCHITECTURES)
string(REGEX REPLACE "-.*$" "" _base "${_a}") # 120-real / 120-virtual are still 120
- # Plan v0.3 P6: developed and measured on sm_120 (RTX 50); the kernels need sm_80 or newer (tf32 mma in
- # the attention scorer, bf16 math), so RTX 30 (86) and RTX 40 (89) build too. Older cards are refused.
+ # Turing port: developed and measured on sm_120 (RTX 50); the tf32 mma in the QSA scorer has a
+ # portable fp32-FMA fallback, so RTX 20 (75), 30 (86), RTX 40 (89) and RTX 50 (120) build too.
+ # Pre-sm_75 is refused.
if(_base STREQUAL "native" OR _base STREQUAL "all" OR _base STREQUAL "all-major")
continue()
endif()
- if(_base LESS 80 AND NOT STRATA_EXPERIMENTAL_SM75) # the A/B of a Turing card as a layer-split stage
+ if(_base LESS 75)
message(FATAL_ERROR
- "Strata needs an NVIDIA GPU of compute capability 8.0 or newer (RTX 30 / 40 / 50 series), but "
+ "Strata needs an NVIDIA GPU of compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series), but "
"CMAKE_CUDA_ARCHITECTURES is '${CMAKE_CUDA_ARCHITECTURES}'.")
endif()
endforeach()
diff --git a/docs/MULTI_GPU.md b/docs/MULTI_GPU.md
index 5ec3f4f68..e8177277c 100644
--- a/docs/MULTI_GPU.md
+++ b/docs/MULTI_GPU.md
@@ -96,8 +96,8 @@ into the card that owns the layer.
capped to leave room for them.
- On Windows only 8 GiB of the expert arena is pinned (more, mapped into two GPU contexts, leaves WDDM refusing
allocations); the PCIe share covers those layers.
-- Every card needs compute capability 8.0 (RTX 30 or newer). A Turing card (RTX 20, sm_75) builds only with the
- experimental `-DSTRATA_EXPERIMENTAL_SM75=ON`.
+- Every card needs compute capability 7.5 (RTX 20 or newer). The pre-sm_80 QSA scorer path is fp32 FMAs, so a
+ Turing card runs the same kernels instead of the tensor-core prompt attention.
## Measured
diff --git a/setup.py b/setup.py
index 2fccca020..de90eba5d 100644
--- a/setup.py
+++ b/setup.py
@@ -285,8 +285,8 @@ def cc(g) -> str:
def gpu_problem(g, together=False):
"""Why Strata cannot use this card, in plain words (None: it can)."""
- if int(g["arch"]) < 80:
- return (f"not supported - older than the RTX 30 series (compute capability {cc(g)}; Strata needs 8.0 or "
+ if int(g["arch"]) < 75:
+ return (f"not supported - older than the RTX 20 series (compute capability {cc(g)}; Strata needs 7.5 or "
"newer)")
if together and g["vram_gb"] < SPLIT_MIN_VRAM_GB - 0.5:
return (f"not supported together with other GPUs - {g['vram_gb']:.0f} GB of VRAM (a card sharing the model "
@@ -349,7 +349,7 @@ def check_gpus(sel, found, what="") -> None:
ones = " or ".join(f"--gpu {x['index']}" for x in single)
both = "--gpus " + ",".join(str(x["index"]) for x in can) if can else ""
hint = ((f"use these together: {both}" + (f" (or one card: {ones})" if not together else "")) if can else
- f"use one card: {ones}" if single else "Strata needs an NVIDIA RTX 30 series or newer card")
+ f"use one card: {ones}" if single else "Strata needs an NVIDIA RTX 20 series or newer card")
fail(f"GPU {i}{'' if g is None else ' (' + g['name'] + ')'} {what}cannot be used: {p}", hint)
@@ -384,7 +384,7 @@ def choose_gpus(a, found) -> list:
single = sorted([g for g in found if gpu_problem(g) is None], key=lambda x: (-round(x["vram_gb"]), x["index"]))
if not single:
gpu_table(found)
- fail("none of your GPUs can run Strata", "it needs an NVIDIA RTX 30 series or newer (compute capability 8.0+)")
+ fail("none of your GPUs can run Strata", "it needs an NVIDIA RTX 20 series or newer (compute capability 7.5+)")
can = together_ok(found)
if not can:
return [single[0]["index"]]
diff --git a/src/core/device.cu b/src/core/device.cu
index 523497fbb..64a837350 100644
--- a/src/core/device.cu
+++ b/src/core/device.cu
@@ -33,7 +33,7 @@ DeviceInfo device_info(int ordinal) {
#if defined(STRATA_USE_HIP)
throw CudaError("no HIP device is present; this backend targets gfx1100 wave32", -1);
#else
- throw CudaError("no CUDA device is present; Strata needs an NVIDIA GPU of compute capability 8.0 or newer", -1);
+ throw CudaError("no CUDA device is present; Strata needs an NVIDIA GPU (RTX 20 series or newer)", -1);
#endif
}
if (ordinal < 0 || ordinal >= count) {
@@ -60,19 +60,20 @@ DeviceInfo device_info(int ordinal) {
check(cudaDriverGetVersion(&d.driver_version), "cudaDriverGetVersion");
check(cudaRuntimeGetVersion(&d.runtime_version), "cudaRuntimeGetVersion");
- // The kernels need sm_80 or newer (tf32 mma in the attention scorer, bf16 math) - the same floor the
- // arch guard in CMakeLists enforces at build time (RTX 30 / 40 / 50). Anything older is caught here,
- // because a binary can be carried to a machine with an older card and would otherwise silently take
- // whatever path the driver chose. The HIP backend is validated on gfx1100 (wave32) only.
+ // The engine supports compute capability 7.5 and newer (Turing: the QSA scorer's tf32 mma has a portable
+ // fp32-FMA fallback below sm_80, the tensor-core prompt kernels refuse and fall back). Compiling for a
+ // supported arch is enforced by CMake; RUNNING on an older card is caught here, because a binary can be carried
+ // to a machine with an older card and would otherwise silently take whatever path the driver chose. The HIP
+ // backend is validated on gfx1100 (wave32) only.
#if defined(STRATA_USE_HIP)
if (std::strncmp(p.gcnArchName, "gfx1100", 7) != 0 || p.warpSize != 32) {
throw CudaError("HIP backend requires validated gfx1100 wave32 hardware", -1);
}
#else
- if (d.cc_major < 8) {
+ if (d.cc_major * 10 + d.cc_minor < 75) {
throw CudaError("device " + d.name + " reports compute capability " + std::to_string(d.cc_major) +
"." + std::to_string(d.cc_minor) +
- "; Strata needs an NVIDIA GPU of compute capability 8.0 or newer (RTX 30 / 40 / 50)",
+ "; Strata needs compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series)",
-1);
}
#endif
diff --git a/src/kernels/cuda/fused_gr.cu b/src/kernels/cuda/fused_gr.cu
index 34afe59a2..f56e152bc 100644
--- a/src/kernels/cuda/fused_gr.cu
+++ b/src/kernels/cuda/fused_gr.cu
@@ -325,19 +325,40 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
// the shared-memory opt-in is a per-DEVICE setting: once per device, not once per process (a layer split
// runs this kernel on two cards)
static bool attr[64] = {};
+ static int chunk[64] = {}; // Turing port: tokens the down kernel may carry in one launch on this card
int dev = 0;
cudaGetDevice(&dev);
- if (dev < 0 || dev >= 64 || !attr[dev]) {
+ if (dev >= 0 && dev < 64 && !attr[dev]) {
// at most what the card allows (Turing: 64 KB - enough for windows of up to 6 tokens)
int optin = 0;
cudaDeviceGetAttribute(&optin, cudaDevAttrMaxSharedMemoryPerBlockOptin, dev);
int want = (int) (kFusedGrMaxT * TILE * sizeof(float));
if (optin > 0 && want > optin) want = optin;
cudaFuncSetAttribute(gr_down_multi_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, want);
- cudaGetLastError();
- if (dev >= 0 && dev < 64) attr[dev] = true;
+ cudaGetLastError(); // drop any error the attempt left behind
+ // Turing port: the down kernel stages n_tok*TILE floats of dynamic shared memory - 80 KB at the full
+ // 8 tokens. A card whose opt-in is below that (Turing: 64 KB, so 7+ tokens fail to launch as
+ // "invalid argument") processes the tokens in slices that fit; a card that reports no opt-in gets what
+ // fits the 48 KB default (4 tokens of the CUDA tile; all 8 of HIP's smaller tile). The down kernel's
+ // outputs (lo, inject_out) are strictly per-token, so the chunk boundaries are safe, and the up kernel
+ // below still sees every token of the batch in one launch.
+ const int capacity = (optin > 0 ? optin : 48 * 1024) / (int) (TILE * sizeof(float));
+ chunk[dev] = capacity < 1 ? 1 : (capacity > kFusedGrMaxT ? kFusedGrMaxT : capacity);
+ attr[dev] = true;
+ }
+ const int chunk_tok = (dev >= 0 && dev < 64 && chunk[dev]) ? chunk[dev] : kFusedGrMaxT;
+ if (chunk_tok >= n_tok) {
+ gr_down_multi_kernel<<<DOWN_BLOCKS + 1, THREADS, (size_t) n_tok * TILE * sizeof(float), st>>>(m);
+ } else {
+ for (int c0 = 0; c0 < n_tok; c0 += chunk_tok) {
+ const int ct = n_tok - c0 < chunk_tok ? n_tok - c0 : chunk_tok;
+ GrMulti c{};
+ c.xn = xn_scratch + (size_t) c0 * D;
+ c.T = ct;
+ for (int k = 0; k < ct; ++k) c.a[k] = a[c0 + k];
+ gr_down_multi_kernel<<<DOWN_BLOCKS + 1, THREADS, (size_t) ct * TILE * sizeof(float), st>>>(c);
+ }
}
- gr_down_multi_kernel<<<DOWN_BLOCKS + 1, THREADS, (size_t) n_tok * TILE * sizeof(float), st>>>(m);
if (stamp_buf) gpu_stamp(stamp_buf, stamp_i0 + 1, stream);
gr_up_multi_kernel<<<UPM_BLOCKS, THREADS, 0, st>>>(m);
const cudaError_t e = cudaGetLastError();