Measured on Tesla T4
A softmax wrapper fault on Tesla T4, fixed to pass 48 of 48.
The Triton fused softmax tutorial failed on narrow rows before the kernel ever ran. The correction changed the host wrapper, and the result was measured against PyTorch on the same GPU.
Get started See the enginePlatform deliverable of the Bare Metal Performance Engine: acceptance checks, attempt history, verification record.
Record and environment
This public study summarizes the five notebook runs (01-add through 05-fair) measured on Tesla T4 x2, compute capability 7.5 (PyTorch 2.11.0+cu128, CUDA 12.8, Triton 3.6.0, driver 580.178.04). All timings and pass counts are tabulated directly on this page; for downloadable JSON sample records from the same Tesla T4 environment, see /evidence/t4-copy-overlap/run-report.json and /evidence/recorded-repair.json.
Softmax cases, run 02 and run 04Measured
Same shapes, input patterns and dtypes in both runs. Tolerances unchanged.
The workload
Five runs, 80 distinct configurations.
Vector add and fused softmax from the Triton tutorials, each against a PyTorch control, in float32 and float16. Every notebook had two Tesla T4 GPUs, compute capability 7.5, with the work on cuda:0.
- Coverage. 80 distinct configurations of operation, shape, dtype, input pattern and implementation, 128 passing case records and 384 repeat observations.
- Shapes. Add lengths from 1 to 1,048,577. Softmax from 1×1 to 256×1025 with random, ×100 and zero inputs.
- Stack. PyTorch 2.11.0+cu128, CUDA 12.8, Triton 3.6.0, driver 580.178.04.
Run sequenceMeasured
01-add
Vector add, lengths 1 to 65,537
20 of 20 passed
02-softmax
Softmax 1×1 to 31×1025
36 passed
03-bench
Timing, add and softmax
16 of 16 passed
04-corrected
Run 02 again, fixed wrapper
48 of 48 passed
05-fair
Equal preallocated outputs
8 of 8 passed
Run 02 errors were preserved, then rerun on the corrected wrapper in run 04.
What changed
One division by zero, fixed on the host.
The tutorial wrapper estimates occupancy by dividing by the shared memory each program needs. Softmax widths 1 and 7 compiled to zero shared memory bytes in both dtypes, so the wrapper raised ZeroDivisionError before dispatch. Width 129 used 32 bytes and ran.
- Change. When the requirement is zero, skip only the shared memory term. Keep the register limit and cap residency by the thread limit the device reports.
- Kernel. GPU arithmetic, precision and the kernel algorithm stay the same. The masked row loop still visits each row once.
- Upstream. The tutorial wrapper recorded for this study carries the same division.
Occupancy pathRecorded
Original wrapper, occupancy estimate
occupancy = shared memory / size_smem
widths 1 and 7, size_smem = 0 bytes, ZeroDivisionError
Corrected wrapper
size_smem = 0, skip the shared memory term
register limit kept
capped by device thread limit
Run 04 reran every run 02 case on the corrected wrapper.
Compared
Where the time goes, host or GPU.
The fair rerun gave both sides the same inputs and preallocated outputs, alternated the order, and timed two ways. End to end includes Python dispatch and synchronization. GPU graph timing captures only the GPU work.
End to end middle run time, µsMeasured
Two Tesla T4 allocated, run on cuda:0. 30 synchronized host samples per side, includes Python dispatch and sync.
GPU graph middle run time, µsMeasured
20 GPU graph averages per side from triton.testing.do_bench_cudagraph. Excludes Python dispatch and allocation.
- End to end. PyTorch is lower in all four pairs. The host wrapper costs more than the kernel saves at these sizes.
- GPU graph. Triton softmax runs about 1.31× faster in float32 and 1.35× faster in float16. Triton add stays slower under both methods.
- Reading it. Softmax work on the GPU is faster, so the next gain sits in dispatch and launch on the host side.
Checked
Correctness checks with fixed tolerances.
Each recorded case ran three times and had to match tolerance, stay finite and repeat bit for bit.
- Tolerances. Allowed error for float32 is 0.000001 absolute and 0.00001 relative. For float16 it is 0.001 absolute and 0.002 relative. The original and corrected run logs record the same tolerances.
- Largest add error. 2.3841858e−7 in float32 and 0.001953125 in float16, both inside tolerance.
- Code versions. Original and corrected modules each carry their own SHA-256.
- Coverage. The check covers 48 of 48 shapes, and GPU graph timing is reported apart from host wrapper time.
CorrectnessMeasured
Three repeats per case, exact repeat equality required.
FAQ
Questions engineers ask.
What exactly was measured?
Correctness of Triton vector add and fused softmax against PyTorch on Tesla T4 GPUs, and middle run time per call for add at 1,048,577 elements and softmax at 256×1025, end to end and in GPU graph replay.
Did the fix change the kernel?
No. Only the host wrapper changed. GPU arithmetic, precision and the kernel algorithm are the same, and the tolerances stayed fixed.
Why is PyTorch faster end to end?
End to end timing includes Python dispatch and synchronization. In GPU graph replay, which removes that host cost, Triton softmax is about 1.31× and 1.35× faster.
How can an engineer check this?
Compare the recorded software versions, tolerances and timing methods above. Original and corrected code version records tell the tested source versions apart.
Next step
Bring the kernel that fails or stalls.
The Bare-Metal Engine ports code, checks results and measures performance across chip vendors. See how the engine works or get started.
Get started See the engine