You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am playing with https://triton-lang.org/main/getting-started/tutorials/01-vector-add.html.
I changed the block_size=4 and the len(x)=len(y)=10.
In the kernel function, I try to print out the pid
importtorchimporttritonimporttriton.languageastl@triton.jitdefadd_kernel(
x_ptr, # *Pointer* to first input vector.y_ptr, # *Pointer* to second input vector.output_ptr, # *Pointer* to output vector.n_elements, # Size of the vector.BLOCK_SIZE: tl.constexpr, # Number of elements each program should process.# NOTE: `constexpr` so it can be used as a shape value.
):
pid=tl.program_id(axis=0)
tl.printf("pid:", pid). # print the program idblock_start=pid*BLOCK_SIZEoffsets=block_start+tl.arange(0, BLOCK_SIZE)
mask=offsets<n_elementsx=tl.load(x_ptr+offsets, mask=mask)
y=tl.load(y_ptr+offsets, mask=mask)
output=x+ytl.store(output_ptr+offsets, output, mask=mask)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am playing with
https://triton-lang.org/main/getting-started/tutorials/01-vector-add.html
.I changed the
block_size=4
and thelen(x)=len(y)=10
.In the kernel function, I try to print out the
pid
After runing one add op,
I got output like this
After counting, I found that
I can understand there are 3 different program id since
10(i.e., inp len)//4(i.e., block_size) + 1 = 3
But why each pid is repeated by 128 times?
Beta Was this translation helpful? Give feedback.
All reactions