docs: add Tesla T4/Turing hardware notes (attn-impl, dtype, quantization) - #26
docs: add Tesla T4/Turing hardware notes (attn-impl, dtype, quantization)#26moduvoice wants to merge 1 commit into
Conversation
…ion) Documents behavior measured on a real Tesla T4 16GB (Turing, sm_75): - --attn-impl auto unconditionally resolves to flash_attention_2 on any CUDA device with no GPU-capability check, crashing with an ImportError on T4/other Turing GPUs at model load. Recommends --attn-impl sdpa, which is already a supported CLI value and works correctly. - There is no --dtype CLI flag; dtype is hardcoded to bf16 on CUDA. Notes this is suboptimal on T4 since SDPA's EFFICIENT_ATTENTION kernel rejects bf16 and falls back to the slower MATH path. - bitsandbytes int8 quantization does reduce VRAM (~43%) but makes batch=1 decode ~3.2x slower — documented as a real trade-off. - Notes the 0.6B model has ample VRAM headroom on T4 16GB (~4GB peak). No code changes.
Alichua
left a comment
There was a problem hiding this comment.
Hi @moduvoice ,
Thanks for testing this on a real T4. The core finding is useful: the current auto implementation selects flash_attention_2 for every CUDA device, and --attn-impl sdpa is the correct workaround on T4.
Before merging, could you please address these documentation issues?
-
Please remove L4 from the Turing scope. NVIDIA L4 is an Ada GPU (sm_89), not Turing, and the official FlashAttention 2 implementation supports Ada. The T4-specific bf16/SDPA and VRAM conclusions therefore should not be generalized to L4.
-
Please separate the two failure modes:
- If
flash-attnis not installed,--attn-impl autocan fail on any CUDA GPU. - On T4/sm_75, the official FlashAttention 2 implementation is unsupported even when installed, so
--attn-impl sdpashould be used.
- If
-
Please limit the benchmark and VRAM conclusions to the tested “Tesla T4 16GB + stated software versions/workload” environment. They should not be described as applying to every Turing-class GPU.
-
Minor wording issue:
flash-attnis commented out from the project dependency list inpyproject.toml;[tool.uv.extra-build-dependencies]is not an installable optional extra.
Once these points are corrected, this documentation change looks good to merge.
Motivation
Ran the GPA-v1.5 native infer Quick Start (
GPA_1.5/docs/infer.md) verbatim on a real Tesla T4 16GB (Turing, sm_75; driver 550.163.01 / CUDA 12.4, torch 2.6.0+cu124, transformers 5.13.0) and hit a crash the docs don't mention, plus found a couple of undocumented behaviors worth calling out for anyone on Turing-class GPUs (T4, similarly L4).Changes
Doc-only additions to
GPA_1.5/docs/infer.md— no code changes:--attn-impl autocrashes on Turing GPUs.inference/model_loader.py::normalize_attn_implreturnsflash_attention_2for anycuda*device with notorch.cuda.get_device_capability()check and no check thatflash-attnis even installed (it's commented out as an optional extra inpyproject.toml, not inrequirements.txt). Following the Quick Start as-is on T4 fails at model load with:Documented the fix: pass
--attn-impl sdpa(already a supported CLI value, no code change) — both ASR and TTS complete normally. Also corrected the "Fast Troubleshooting Data preparation files are missing #5" section, which previously only suggested falling back to--device cpu; now it points to--attn-impl sdpafirst so users don't need to give up the GPU.No
--dtypeCLI flag.--deviceand--attn-implare exposed as CLI args, but dtype is hardcoded totorch.bfloat16on CUDA inmodel_loader.py. Documented that this is measurably suboptimal on T4: PyTorch's SDPAEFFICIENT_ATTENTIONkernel rejectsbfloat16and silently falls back to the slowerMATHpath, whilefp16reachesEFFICIENT_ATTENTIONdirectly (per-token latency was within noise in our runs, but only fp16 hits the faster kernel on this GPU class).bitsandbytesint8 quantization trade-off. Not mentioned anywhere in the docs today. MeasuredBitsAndBytesConfig(load_in_8bit=True)reducing peak VRAM by ~43% (2317 MB → 1327 MB, reproduced twice) but making batch=1 autoregressive decode ~3.2x slower (≈36–39 ms/token → ≈121–125 ms/token, reproduced twice). Documented as a real trade-off rather than a free win.VRAM headroom note. The native infer path uses a 0.6B backbone; full-pipeline peak VRAM measured ≈4.0–4.2 GB (bf16/fp16) / ≈3.0–3.1 GB (int8) — roughly 74–81% of a T4's 16GB unused. Noted this so T4/L4 users know OOM isn't a practical concern here.
Testing
GPA_1.5/infer.py --task asrand--task ttsend-to-end on a Tesla T4 16GB with--attn-impl sdpa: both complete successfully (ASR transcript correct, TTS produces a valid wav).flash_attention_2ImportErrorwith the default--attn-impl autoon the same box (2 runs, deterministic).AutoModelForCausalLM/BitsAndBytesConfigAPIs (no repo code modified), each reproduced twice.GPA_1.5/docs/infer.md; no source files changed.