mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #741] [CLOSED] prefill: BF16 projections on FP16 tensor cores below sm_80 (+8-17% prefill on a 2080 Ti) #2798
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#2798
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/741
Author: @konijiwa110
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:prefill-bf16-as-f16-turing📝 Commits (10+)
b0dda4bAMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cardscc97fcdsetup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each)e9e2ba3pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decodecacffa9CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier statsa348c7aMerge branch 'f-131-srv' into r131-q4b93a00cMerge branch 'f-q4-on242' into r131-q48f5148cCS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on5ffda19CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)ed6c124#253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down450149d--split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV📊 Changes
4 files changed (+218 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+7 -0)📝
include/strata/prefill/gemm.hpp(+2 -0)📝
src/prefill/gemm.cu(+79 -0)➕
tests/cuda/prefill_bf16_gemm_test.cpp(+130 -0)📄 Description
What
Cards below sm_80 (RTX 20, GTX 16, V100) have FP16 tensor cores but none for BF16, so cuBLAS runs the prefill's BF16
GEMMs (
Gemm::bf16: hyper-connection down/up, inject, SSM alpha/beta, indexer projections) on the CUDA cores. On anRTX 2080 Ti at those shapes (T = 4096) that is 6-7 TFLOPS in BF16 against 34-48 TFLOPS in FP16.
There,
Gemm::bf16now converts W and X to FP16 in the existing dequantization scratch (W at its start, X in slices ofat least 256 rows) and calls
cublasGemmExin FP16 with the same FP32 accumulation:(absolute error <= 2^-25), larger ones saturate to +-65504 and are counted (
STRATA_PREFILL_BF16_F16_CHECK=1printsthe count; none in the prompts measured below)
STRATA_PREFILL_BF16_F16=0keeps the BF16 GEMM;=1takes the FP16 path on any card (used by the test).New test
prefill_bf16_gemm_test(CUDA, skips without a device): the call shapes above incl. a sliced X,beta = 1accumulation into a strided
ldywith an offset, and the scratch-too-small fallback, against an FP64 reference(tolerance 1e-5), and cells outside the product left untouched.
Measured
Swift 1.5 IQ3_XXS on an RTX 2080 Ti 22 GB, same build A/B with
STRATA_PREFILL_BF16_F16=0/ unset, prefill tok/safter warm-up:
The
hc readphase (STRATA_PREFILL_TIMING) at 128K: 29.8 s -> 13.8 s. Decode unchanged. No saturation in any ofthese prompts. Greedy output differs from the BF16 path after a few dozen characters, which is the same level as two
runs of the unchanged engine differ from each other (16-105 characters); answer quality looked the same.
prefill_bf16_gemm_test: all cases PASS, max error 4e-8 to 2.8e-7.Only tested on sm_75 (2080 Ti); cards at sm_80+ never take the path unless the env forces it.
Developed with an AI coding assistant; all numbers measured on an RTX 2080 Ti 22 GB / i5-12490F / 64 GB.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.