Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/openaccel-lab/blob/main/workloads/vecadd/triton_kernel.py # openaccel-lab aien-dev/openaccel-lab Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `openaccel-lab / workloads / vecadd / triton_kernel.py` 15 lines ยท 398 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 2 import triton 3 import triton.language as tl 4 5 6 @triton.jit 7 def _vecadd(a, b, y, n, BLOCK: tl.constexpr): 8 i = tl.program_id(0) * BLOCK + tl.arange(0, BLOCK) 9 m = i < n 10 tl.store(y + i, tl.load(a + i, mask=m) + tl.load(b + i, mask=m), mask=m) 11 12 13 def launch(p, t): 14 n = p["n"] 15 _vecadd[(triton.cdiv(n, 1024),)](t["a"], t["b"], t["y"], n, BLOCK=1024)