feat(vpto): add A2/A3 gather lowering#971
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements tile-level gather lowering (pto.tgather and pto.tgatherb) for the A2/A3 vpto backend, introducing new flat UB-pointer gather ops (pto.ub.vgather and pto.ub.vgatherb) and their lowerings to LLVM intrinsics with packed config words. It also adds synchronization macro models, extensive end-to-end tests, and lit verification tests. The review feedback suggests several improvements: emitting a compilation error instead of silently skipping lowering when srcAddr cannot be resolved, using safer defensive checks for validCol, explicitly casting mixed signed/unsigned types to prevent compiler warnings, and using castOp->getOperand(0) to avoid potential C++ name hiding issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
904cb44 to
15c3b9e
Compare
Summary
pto.tgatherbthroughpto.ub.vgatherbto packedllvm.hivm.VGATHERB.b16/.b32calls.pto.tgatherindex form throughvmuls + vgather, preserving count-mode mask lifetime and chunking wide rows.tgatherbas a 32-byte block gather with one compact i32 block address per output block, padded to eight entries per repeat.tgatherbsupport merged in Add TGATHERB #932 without duplicating its wrapper or namespace registration.Notes
tgatherbis a 32-byte block gather, not scalar element gather.tgatherindex form andvgather.mgatheris supported by PTO-ISA/EmitC; GM-to-UB VPTO lowering is intentionally split into a stacked follow-up because it requires scalar index/OOB handling and MTE2 decomposition.Validation
ptoasbuild: passed.Covered NPU shapes:
tgatherbf32:1x8,1x64,1x96,2x64,1x128,4x64tgatherbf16:1x16,1x128,1x192tgatherf32/f16:1x64,2x64,2x128