[TLE][NVIDIA] lower same-warp layout conversions with shuffles - #1047
[TLE][NVIDIA] lower same-warp layout conversions with shuffles#1047Kafka-Hatsune wants to merge 8 commits into
Conversation
Derive a same-block, same-warp source representative from LinearLayout instead of matching one fixed paged-pointer layout. Share the resulting plan between scratch allocation and lowering, and retain the shared-memory fallback when no valid or profitable route exists.
|
Thanks for working on this! Since |
Thank you for the suggestions. Based on those suggestions, the following code fixes have been made.
|
What For
for Layout Convertion
The LayoutConvert Analysis gives a LinearLayout matrix(Src) like:
Giving a logical row = 0d10 = 0b1010,physical position is solved to be that (l0,l1,l2,l3)=(0,1,0,1),and l4, w0, w1 are free variables. l4 can be 0 or 1, and warp can be 0, 1, 2, or 3. Thus, there are 2 lanes × 4 warps = 8 solutions. When there are multiple answers, all the unnecessary numbered ones should be set to 0. Therefore, it selects warp 0, lane 10. This is represented as warp 2 attempting to read data from warp 0. However, shuffle can only exchange registers within the same warp and cannot read from warp 0 from warp 2. Thus, the compiler wrongly concludes: shuffle is not possible and must go through shared memory.
improvement
Add constraints for Src&Dst LinearLayout matrix in the reverse solving: Among these positions, search for solutions that are in the same block and the same warp.
the linearLayout matrix of Src after adding constraints like:
So the result P in the S x P = D layout convertion computation is limited that warp ids that are the same in the src&dst. 8 solutions is reduced into 2 solutions. By default we use the first solution in the same warp, it is the time to use warp shuffle instead of smem load&store to do the layout convertion.
Triton code examples
Res: