Superseded by D122060
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Even though this potentially saves an array copy, I find it much easier to reason about invariants in the original structure with the factory method that permutes from original order.
I think the logic will become a lot more transparent once I finish the differential for introducing the Permutation type, since then the code becomes just: Permutation reord = perm.compose(rev); Permutation permsz = reord.dirImg(sizes); (or if we just store the original permutation directly rather than inverting it in the constructor: Permutation reord = oldPerm.dirImg(newPerm);).
I'm fine postponing this differential until after the Permutation type is introduced, I only factored it out to keep the logic change separate from the type change
Not trying to be difficult, since I am all in favor of better code, but before, the code had the nice invariant of having the original sizes in the factory method, so I could set a breakpoint there and check it against the sizes in the MLIR tensor for correctness. We lose that invariant now, and I doubt this runs noticeable faster than the original for real-life tensors. So, keep it for now and send the me next differential to give me a better idea where this is going....