[PR #88] [CLOSED] Pascal port: lower the CUDA floor to sm_61 (GTX 10 series) #2448

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/88
Author: @hireymage
Created: 9/28/2026
Status: ❌ Closed

Base: main ← Head: pascal-sm61


📝 Commits (2)

  • e89bda3 Turing port: run on RTX 20 (sm_75) and newer
  • 833f5f6 Pascal port: lower the floor to sm_61 (GTX 10 series)

📊 Changes

11 files changed (+182 additions, -23 deletions)

View changed files

📝 CMakeLists.txt (+6 -4)
📝 include/strata/artifact/gguf_reader.hpp (+3 -0)
📝 include/strata/kernels/ngram.hpp (+6 -6)
📝 include/strata/prefill/gemm.hpp (+10 -1)
📝 setup.py (+2 -2)
📝 src/core/device.cu (+8 -6)
📝 src/kernels/cuda/elementwise.cu (+6 -0)
📝 src/kernels/cuda/fused_gr.cu (+36 -3)
📝 src/kernels/cuda/native_qsa_score.cu (+39 -1)
📝 src/kernels/cuda/verify_kernels.cu (+6 -0)
📝 src/prefill/gemm.cu (+60 -0)

📄 Description

Follow-up to #87 (Turing port, sm_75) - this one is stacked on that branch, so the diff below shows both; once #87 merges, this PR's diff shrinks to just the Pascal delta. Files touched by this branch: CMakeLists.txt, setup.py, src/core/device.cu, src/prefill/gemm.{hpp,cu}, src/kernels/cuda/{elementwise,verify_kernels}.cu, include/strata/{artifact/gguf_reader,kernels/ngram}.hpp.

What Pascal (sm_61) is missing, and what this adds

Developed and measured on a GTX 1080 Ti (sm_61, CUDA 12.6, Linux), running the 125B Q2_0 pack end to end. All changes are runtime-guarded, so the sm_80+ path stays bit-identical.

  1. Gemm::bf16 - cuBLAS has no BF16 GEMM below sm_80. On cc < 70 both operands are converted to FP32 (a lossless 16-bit shift per element) and the same GEMM runs over CUDA_R_32F. Converted weights are cached per device pointer (the arena keeps weight pointers stable); activations are converted per call into a grown-on-demand buffer. Measured prefill slowdown ~2x on Pascal - expected, FP32 GEMM without tensor cores.
  2. doorbell_wait_kernel / wait_flag_ge_kernel - __nanosleep landed with Volta (sm_70); pre-sm_70 builds spin with a bare __threadfence() instead (one thread, waiting on host-published memory).
  3. GgufFile::open (Linux) - madvise(MADV_RANDOM) on the GGUF mapping: token gathers 16 rows scattered over the whole file, so read-ahead is pure waste. Guarded by #ifdef MADV_RANDOM. The ngram.hpp comment now documents the Linux/Windows split instead of claiming there is no Linux.
  4. Floor 75 -> 61 in CMake, the runtime device check, and the setup.py GPU check. Compiling for pre-sm_61 is still refused.

Verification on the 1080 Ti

  • Full engine build with -DCMAKE_CUDA_ARCHITECTURES=61: 181/181 targets, 0 errors.
  • strata-device on the card: compute capability 6.1 (sm_61).
  • 20/20 runnable parity selftests pass on the real card (iq/native_expert/ple parity binaries are fixture-dependent and not shipped, so skipped).

Same note as #87: the sm_120 card I developed on is the author's documented target, so the Ampere+ path is unchanged by construction - every fallback sits behind a __CUDA_ARCH__ >= 700 / cc_major < 70 / cc_major < 80 guard.


🔄 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/88 **Author:** [@hireymage](https://github.com/hireymage) **Created:** 9/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pascal-sm61` --- ### 📝 Commits (2) - [`e89bda3`](https://github.com/Niko1221/Strata/commit/e89bda3f25bfaf648fb9c57c0edf1ed3422a6ab6) Turing port: run on RTX 20 (sm_75) and newer - [`833f5f6`](https://github.com/Niko1221/Strata/commit/833f5f61644eaf2f902cebbb9bf1c664206c4213) Pascal port: lower the floor to sm_61 (GTX 10 series) ### 📊 Changes **11 files changed** (+182 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+6 -4) 📝 `include/strata/artifact/gguf_reader.hpp` (+3 -0) 📝 `include/strata/kernels/ngram.hpp` (+6 -6) 📝 `include/strata/prefill/gemm.hpp` (+10 -1) 📝 `setup.py` (+2 -2) 📝 `src/core/device.cu` (+8 -6) 📝 `src/kernels/cuda/elementwise.cu` (+6 -0) 📝 `src/kernels/cuda/fused_gr.cu` (+36 -3) 📝 `src/kernels/cuda/native_qsa_score.cu` (+39 -1) 📝 `src/kernels/cuda/verify_kernels.cu` (+6 -0) 📝 `src/prefill/gemm.cu` (+60 -0) </details> ### 📄 Description Follow-up to #87 (Turing port, sm_75) - this one is **stacked on that branch**, so the diff below shows both; once #87 merges, this PR's diff shrinks to just the Pascal delta. Files touched by *this* branch: CMakeLists.txt, setup.py, src/core/device.cu, src/prefill/gemm.{hpp,cu}, src/kernels/cuda/{elementwise,verify_kernels}.cu, include/strata/{artifact/gguf_reader,kernels/ngram}.hpp. ## What Pascal (sm_61) is missing, and what this adds Developed and measured on a **GTX 1080 Ti (sm_61, CUDA 12.6, Linux)**, running the 125B Q2_0 pack end to end. All changes are runtime-guarded, so the sm_80+ path stays bit-identical. 1. **`Gemm::bf16` - cuBLAS has no BF16 GEMM below sm_80.** On cc < 70 both operands are converted to FP32 (a lossless 16-bit shift per element) and the same GEMM runs over `CUDA_R_32F`. Converted weights are cached per device pointer (the arena keeps weight pointers stable); activations are converted per call into a grown-on-demand buffer. Measured prefill slowdown ~2x on Pascal - expected, FP32 GEMM without tensor cores. 2. **`doorbell_wait_kernel` / `wait_flag_ge_kernel`** - `__nanosleep` landed with Volta (sm_70); pre-sm_70 builds spin with a bare `__threadfence()` instead (one thread, waiting on host-published memory). 3. **`GgufFile::open` (Linux)** - `madvise(MADV_RANDOM)` on the GGUF mapping: token gathers 16 rows scattered over the whole file, so read-ahead is pure waste. Guarded by `#ifdef MADV_RANDOM`. The `ngram.hpp` comment now documents the Linux/Windows split instead of claiming there is no Linux. 4. **Floor 75 -> 61** in CMake, the runtime device check, and the setup.py GPU check. Compiling for pre-sm_61 is still refused. ## Verification on the 1080 Ti - Full engine build with `-DCMAKE_CUDA_ARCHITECTURES=61`: **181/181 targets, 0 errors**. - `strata-device` on the card: `compute capability 6.1 (sm_61)`. - **20/20 runnable parity selftests pass** on the real card (iq/native_expert/ple parity binaries are fixture-dependent and not shipped, so skipped). Same note as #87: the sm_120 card I developed on is the author's documented target, so the Ampere+ path is unchanged by construction - every fallback sits behind a `__CUDA_ARCH__ >= 700` / `cc_major < 70` / `cc_major < 80` guard. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:00:12 +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#2448
No description provided.