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/transpose/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 / transpose / triton_kernel.py` 17 lines ยท 560 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 _transpose(a, b, R, C, BR: tl.constexpr, BC: tl.constexpr): 8 r = tl.program_id(0) * BR + tl.arange(0, BR) 9 c = tl.program_id(1) * BC + tl.arange(0, BC) 10 m = (r[:, None] < R) & (c[None, :] < C) 11 tile = tl.load(a + r[:, None] * C + c[None, :], mask=m) 12 tl.store(b + c[None, :] * R + r[:, None], tile, mask=m) 13 14 15 def launch(p, t): 16 R, C = p["R"], p["C"] 17 _transpose[(triton.cdiv(R, 32), triton.cdiv(C, 32))](t["a"], t["b"], R, C, BR=32, BC=32)