interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / workloads / saxpy / triton_kernel.py

16 lines · 451 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0
2import triton
3import triton.language as tl
4
5
6@triton.jit
7def _saxpy(alpha, x, y_in, y, n, BLOCK: tl.constexpr):
8 i = tl.program_id(0) * BLOCK + tl.arange(0, BLOCK)
9 m = i < n
10 a = tl.load(alpha)
11 tl.store(y + i, a * tl.load(x + i, mask=m) + tl.load(y_in + i, mask=m), mask=m)
12
13
14def launch(p, t):
15 n = p["n"]
16 _saxpy[(triton.cdiv(n, 1024),)](t["alpha"], t["x"], t["y_in"], t["y"], n, BLOCK=1024)