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 engine

Platform 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

Run 02, original wrapper36 passedRun 04, corrected wrapper48 of 48

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

  1. 01-add

    Vector add, lengths 1 to 65,537

    20 of 20 passed

  2. 02-softmax

    Softmax 1×1 to 31×1025

    36 passed

  3. 03-bench

    Timing, add and softmax

    16 of 16 passed

  4. 04-corrected

    Run 02 again, fixed wrapper

    48 of 48 passed

  5. 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

  1. Original wrapper, occupancy estimate

  2. occupancy = shared memory / size_smem

    widths 1 and 7, size_smem = 0 bytes, ZeroDivisionError

    Corrected wrapper

  3. size_smem = 0, skip the shared memory term

  4. register limit kept

  5. 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

add 1,048,577 float32PyTorch 71.08 µsTriton 98.94 µsadd 1,048,577 float16PyTorch 42.61 µsTriton 90.65 µssoftmax 256×1025 float32PyTorch 36.73 µsTriton 82.57 µssoftmax 256×1025 float16PyTorch 37.59 µsTriton 85.33 µs
PyTorchTriton

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

add 1,048,577 float32PyTorch 53.87 µsTriton 65.06 µsadd 1,048,577 float16PyTorch 25.54 µsTriton 54.60 µssoftmax 256×1025 float32PyTorch 17.28 µsTriton 13.18 µssoftmax 256×1025 float16PyTorch 19.20 µsTriton 14.19 µs
PyTorchTriton

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

48 of 48 cases passed after the correction24 Triton softmax cases and 24 PyTorch controls
8 of 8 fair comparison checks passed4 Triton and 4 PyTorch, equal preallocated outputs

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