This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Eliminating intermediate arrays/copies in toCOO
AbandonedPublic

Authored by wrengr on Jan 12 2022, 3:51 PM.

Details

Summary

Superseded by D122060

Diff Detail

Event Timeline

wrengr created this revision.Jan 12 2022, 3:51 PM
wrengr requested review of this revision.Jan 12 2022, 3:51 PM

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....

wrengr edited the summary of this revision. (Show Details)Mar 21 2022, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 3:54 PM
wrengr abandoned this revision.Mar 21 2022, 3:54 PM

Superseded by D122060