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
{{ message }}
Repository navigation
[LLVMCPU] Gather codegen for gather on strided access is numerically incorrect #19749
Note that the vector.gather takes in linearized indices (which is actually not the best thing). But after LLVMCPUVirtualVector lowering, we seem to not take the strides into account for the linearized indices:
I think we end up with the same observation. :) I took a look at it in Ian's issue: #20011 (comment) The other repro is smaller, so I left a comment here. We can collapse two issues though.
Activity
Groverkss commentedon Jan 21, 2025
After some investigation, it looks like this is coming from vector.gather virtual vector lowering.
Before lowering:
Note that the vector.gather takes in linearized indices (which is actually not the best thing). But after LLVMCPUVirtualVector lowering, we seem to not take the strides into account for the linearized indices:
Groverkss commentedon Jan 21, 2025
Another interesting thing about this IR, it's effectively doing a sliced index_select, which in numpy can be written as:
This error does not appear if we do not do the strided access on dim=1:
MLIR IR produced for the above numpy file actually works correctly, which points to a strided memref access issue
Groverkss commentedon Jan 21, 2025
This IR was generated using iree-turbine with the following file: https://gist.github.com/Groverkss/08b291c62572abe6578e79590df2db30 in case you want to play around with the IR to see how the strides affect the output.
hanhanW commentedon Feb 19, 2025
I think we end up with the same observation. :) I took a look at it in Ian's issue: #20011 (comment) The other repro is smaller, so I left a comment here. We can collapse two issues though.
hanhanW commentedon Mar 17, 2026
Confirmed that it is fixed by llvm/llvm-project#184706, closing the issue.