interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / controls / gemm_offbyone / triton_kernel.py

18 lines · 598 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0
2import triton
3import triton.language as tl
4
5
6@triton.jit
7def _tmatmul16(a, b, c, KN: tl.constexpr):
8 t = tl.program_id(0)
9 r = tl.arange(0, 16)
10 km = r < KN
11 av = tl.load(a + t * 256 + r[:, None] * 16 + r[None, :], mask=km[None, :], other=0.0)
12 bv = tl.load(b + t * 256 + r[:, None] * 16 + r[None, :], mask=km[:, None], other=0.0)
13 acc = tl.dot(av, bv, input_precision="ieee", out_dtype=tl.float32)
14 tl.store(c + t * 256 + r[:, None] * 16 + r[None, :], acc)
15
16
17def launch(p, t):
18 _tmatmul16[(p["TILES"],)](t["a"], t["b"], t["c"], KN=15)