triton
triton copied to clipboard
seems document error for TritonGPUAttrDefs.md
I was reading the https://github.com/triton-lang/triton/blob/9a0a7c2ccc6e6fd5f98c06476a0ca591b65758cf/include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td and found something confusing:
2. Multiple rows per phase
#shared<{vec=1, perPhase=2, maxPhase=4, order=[1,0]}>
[ 0, 1, 2, 3], // phase 0 (xor with 0)
[ 4, 5, 6, 7],
[ 9, 8, 11, 10], // phase 1 (xor with 1)
[13, 12, 15, 14]
Elements of row r are xor'ed with r/2. In other words, perPhase=2
means that pairs of 2 rows get the same swizzling.
3. Max-phase applied
$shared<{vec=1, perPhase=1, maxPhase=2, order=[1,0]}>
[ 0, 1, 2, 3], // phase 0 (xor with 0)
[ 5, 4, 7, 6], // phase 1 (xor with 1)
[ 8, 9, 10, 11], // phase 0
[13, 12, 15, 14], // phase 1
[16, 17, 18, 19], // ...
[21, 20, 23, 22],
[24, 25, 26, 27],
[29, 28, 31, 30]
Elements of row r are xor'ed with (r/2) % 2. In other words, maxPhase=m has the
effect of limiting the maximum value of the xor to m-1.
4. Max-phase and per-phase
#shared<{vec=1, perPhase=2, maxPhase=2, order=[1,0]}>
[ 0, 1, 2, 3], // phase 0 (xor with 0)
[ 4, 5, 6, 7], // phase 0
[ 9, 8, 11, 10], // phase 1 (xor with 1)
[13, 12, 15, 14], // phase 1
[16, 17, 18, 19], // phase 0
[20, 21, 22, 23], // phase 0
[25, 24, 27, 26], // phase 1
[29, 28, 31, 30]] // phase 1
Here the xor value (the "phase", I guess?) changes every perPhase rows, up to a
maximum value of maxPhase-1. In other words, elements of row r are xor'ed with
(r/2) % 2.
3. Max-phase applied
said that Elements of row r are xor'ed with (r/2) % 2
.
should it be Elements of row r are xor'ed with r % 2
?