fix(a2a3): correct TCOLEXPAND pipe from PIPE_V to PIPE_MTE1 - #212
fix(a2a3): correct TCOLEXPAND pipe from PIPE_V to PIPE_MTE1#212georgebisbas wants to merge 2 commits into
Conversation
2d36c3a to
0117c76
Compare
TCOLEXPAND (plain broadcast) uses pto_copy_ubuf_to_ubuf (copy engine / PIPE_MTE1) in its a2a3 implementation, not a pure vector-unit op. A pipe_barrier(PIPE_V) after TCOLEXPAND does NOT wait for the copy-engine broadcast to complete, so a subsequent vector read can see stale data. This is a regression from commit 021789c ("refactor: extract Event CRTP base class and replace opPipeList with OpPipeEntry template"), which tagged all expand-family ops as PIPE_V. Before that refactoring, TCOLEXPAND was not in the old opPipeList and defaulted to PIPE_ALL. All other TCOLEXPAND* / TROWEXPAND* variants use vector instructions (vadd, vdiv, vmul, vector_dup, vbrcb, etc.) and remain correctly on PIPE_V. Co-authored-by: Vladimir Loncar <vloncar@users.noreply.github.com>
0117c76 to
ab06a21
Compare
|
@Crystal-wzy please have a look wwhen you have available time, thanks |
Sorry for the late reply. The GitHub pto-isa repository no longer accepts merge requests. Please submit your pull request at https://gitcode.com/cann/pto-isa instead. Thank you! |
Hi we have submitted this already, please have a look when you have time, thanks @Crystal-wzy ! |
1 similar comment
Hi we have submitted this already, please have a look when you have time, thanks @Crystal-wzy ! |
Summary
TCOLEXPAND(plain broadcast) usespto_copy_ubuf_to_ubuf(copy engine / PIPE_MTE1) in its a2a3 implementation, not a pure vector-unit op. Apipe_barrier(PIPE_V)after TCOLEXPAND does NOT wait for the copy-engine broadcast to complete, so a subsequent vector read can see stale data.The race is data-size dependent on real hardware: C=32 fails (consumer wins the race), C=128 passes (copy is slow enough).
Root cause
This is a regression from commit
021789c0("refactor: extract Event CRTP base class and replace opPipeList with OpPipeEntry template", 2026-06-23), which tagged all expand-family ops asPIPE_Vduring the array-to-template conversion. Before that refactoring,TCOLEXPANDwas not in the oldopPipeListat all and defaulted toPIPE_ALL, so barriers were safe.What was checked
TCOLEXPANDuses the copy engine — every otherTCOLEXPAND*/TROWEXPAND*variant uses vector instructions (vadd, vdiv, vmul, vector_dup, vbrcb, etc.) and remains correctly onPIPE_V.event.hpp.opPipeList(pre-refactoring) confirmsTCOLEXPANDhad no entry.Test plan
set_flag/wait_flagand are unaffected by the pipe declaration)tests/npu/a2a3/src/st/testcase/tcolexpand_pipe_bug_mfe/for real-hardware regression testing (cannot reproduce on functional simulator)Related
pipe_barrier(PIPE_V)under-synchronization after TCOLEXPAND in GLAchunk_h_prepkernel produces wrong results at C=32 on a2a3 hardwarechunk_h_prepusespipe_barrier(PIPE_ALL)instead/cc @vloncar