Skip to content

Commit 7d3d638

Browse files
authored
Merge pull request #162 from JuliaGPU/tb/benchmarks
Update benchmark times.
2 parents f5d3031 + 29a52e2 commit 7d3d638

4 files changed

Lines changed: 13 additions & 18 deletions

File tree

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,17 @@ julia --project=examples examples/benchmarks.jl # Julia
9292
uv run python examples/benchmarks.py # Python (for comparison)
9393
```
9494

95-
Benchmarks comparing cuTile.jl against cuTile Python on an RTX 5080 (20 runs, 5 warmup,
96-
min time reported):
95+
Benchmarks comparing cuTile.jl against cuTile Python on an RTX 5080 (`tileiras` 13.2.51,
96+
20 runs, 5 warmup, min time reported):
9797

9898
| Kernel | Size | Julia | Python | Status |
9999
|--------|------|-------|--------|--------|
100-
| Vector Addition | 2^27 f32 | 841 GB/s | 847 GB/s | OK (=) |
101-
| Matrix Transpose | 8192² f32 | 773 GB/s | 817 GB/s | -5% |
102-
| Layer Normalization | 4096² f32 fwd | 615 GB/s | 761 GB/s | -19% |
103-
| Matrix Multiplication | 4096³ f32 | 47.6 TFLOPS | 50.2 TFLOPS | -5% |
104-
| Batch Matrix Multiply | 1024×512×2048 ×8 f32 | 28.7 TFLOPS | 40.0 TFLOPS | -28% |
105-
| FFT (3-stage Cooley-Tukey) | 512-pt ×64 c64 | 465 μs | 486 μs | OK (+4%) |
106-
107-
With the same tileiras, all kernels compile to identical register counts, block sizes, and
108-
occupancy. The remaining gap is from **1→0 indexing overhead**: Julia's 1-based `bid()` and
109-
load indices generate extra `subi` ops in the Tile IR that perturb tileiras's SASS
110-
instruction scheduling (e.g. missing `.reuse` operand collector flags on HMMA, different
111-
address computation instruction selection). This affects all kernels proportional to loop
112-
count (layernorm 174 vs 128 IR lines across 3 loops; batchmatmul L1 hit 9.5% vs 41.3%
113-
from cascading scheduling differences).
100+
| Vector Addition | 2^27 f32 | 841 GB/s | 845 GB/s | OK (=) |
101+
| Matrix Transpose | 8192² f32 | 805 GB/s | 811 GB/s | OK (-1%) |
102+
| Layer Normalization | 4096² f32 fwd | 652 GB/s | 720 GB/s | -9% |
103+
| Matrix Multiplication | 4096³ f32 | 43.4 TFLOPS | 43.5 TFLOPS | OK (=) |
104+
| Batch Matrix Multiply | 1024×512×2048 ×8 f32 | 30.5 TFLOPS | 30.9 TFLOPS | OK (-1%) |
105+
| FFT (3-stage Cooley-Tukey) | 1024-pt ×64 c64 | 3280 μs | 3131 μs | -5% |
114106

115107

116108
## Supported Operations

examples/fft.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ end
192192

193193
function prepare(; benchmark::Bool=false,
194194
batch::Int=benchmark ? 64 : 2,
195-
factors::NTuple{3,Int}=benchmark ? (8, 8, 8) : (2, 2, 2),
195+
factors::NTuple{3,Int}=benchmark ? (8, 8, 16) : (2, 2, 2),
196196
atom_packing_dim::Int=min(64, 2 * prod(factors)))
197197
n = prod(factors)
198198
@assert (n * 2) % atom_packing_dim == 0 "N*2 must be divisible by atom_packing_dim"

examples/fft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def prepare(*, benchmark: bool = False, batch: int = None, factors: tuple = None
116116
if batch is None:
117117
batch = 64 if benchmark else 2
118118
if factors is None:
119-
factors = (8, 8, 8) if benchmark else (2, 2, 2)
119+
factors = (8, 8, 16) if benchmark else (2, 2, 2)
120120
F0, F1, F2 = factors
121121
N = F0 * F1 * F2
122122
D = min(64, N * 2) if atom_packing_dim is None else atom_packing_dim

src/compiler/passes/rewrite.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ function apply_rewrite!(driver::RewriteDriver, block, val::SSAValue, rule, match
458458
typ = block.body.types[pos]
459459
operands = Any[resolve_rhs(driver, block, val, op, match.bindings, typ)
460460
for op in rule.rhs.operands]
461+
# Recompute pos: resolve_rhs may insert instructions before val
462+
# (e.g. negf in subf→fma), shifting positions.
463+
pos = findfirst(==(val.id), block.body.ssa_idxes)
461464
block.body.stmts[pos] = Expr(:call, rule.rhs.func, operands...)
462465
# Update defs, re-add self and users to worklist (statement changed)
463466
driver.defs[val] = DefEntry(block, val, rule.rhs.func)

0 commit comments

Comments
 (0)