MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / add_kernel

Function add_kernel

examples/triton/default.py:7–21  ·  view source on GitHub ↗
(
    x_ptr,
    y_ptr,
    output_ptr,
    n_elements,
    BLOCK_SIZE: tl.constexpr,
)

Source from the content-addressed store, hash-verified

5
6@triton.jit
7def add_kernel(
8 x_ptr,
9 y_ptr,
10 output_ptr,
11 n_elements,
12 BLOCK_SIZE: tl.constexpr,
13):
14 pid = tl.program_id(axis=0)
15 block_start = pid * BLOCK_SIZE
16 offsets = block_start + tl.arange(0, BLOCK_SIZE)
17 mask = offsets < n_elements
18 x = tl.load(x_ptr + offsets, mask=mask)
19 y = tl.load(y_ptr + offsets, mask=mask)
20 output = x + y
21 tl.store(output_ptr + offsets, output, mask=mask)
22
23
24x = torch.rand(1024)

Callers

nothing calls this directly

Calls 1

loadMethod · 0.65

Tested by

no test coverage detected