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
Upstream and IREE have several , sometimes half-baked, copies of "make all N > 0-D memrefs 1D, exposing their indexing math".
Upstream has one in EmulateNarrowTypes
... and GPU/DecomposeMemRefs, which is throwing away size information for no good reason
... and I wouldn't be surprised if there's one in the SPIR-V lowering somewhere.
IREE definitely has its own flattener over in the SPIR-V path, and, if I remember right, has a different one in the VMVX path.
Tasks
This has gone on long enough. So, we must:
Add an upstream pass, something like -memref-flatten, that rewrites N-D memrefs to 1-D memrefs where possible
Refactor the memref narrow type emulator to either use those flattening patterns or to have it as a prerequisite that they've been run
Probably put up a deprecation notice on GPU's decompose-memrefs saying folks should migrate to running the flattener on their gpu.module
Find all the cases where IREE uses a custom memref flattener and replace them with a unified -iree-memref-flatten (that'll grow patterns for HAL subspan bindings)
Note: subviews
During this sort of flattening, there're two approaches to subviews that are noticable. They roughly correspond to the two functions in ExtractStridedMetadata - the one that has the subview -> reinterpret_cast fold (populateExpandStridedMetadataPatterns) and the one that assumes that subviews have already been dealt with by -memref-fold-alias-ops (populateResolveExtractStridedMetadataPatterns)
That is, one can either rewrite a subview into a reinterpret_cast, adding the base of the subview to the offset of your memref, or you can declare that subview is not allowed this far down the lowering pipeline.
Different pipelines might have different opinions on this, so I figure this pass should implement both options.
The text was updated successfully, but these errors were encountered:
Context
Upstream and IREE have several , sometimes half-baked, copies of "make all N > 0-D memrefs 1D, exposing their indexing math".
Upstream has one in EmulateNarrowTypes
... and GPU/DecomposeMemRefs, which is throwing away size information for no good reason
... and I wouldn't be surprised if there's one in the SPIR-V lowering somewhere.
IREE definitely has its own flattener over in the SPIR-V path, and, if I remember right, has a different one in the VMVX path.
Tasks
This has gone on long enough. So, we must:
-memref-flatten
, that rewrites N-D memrefs to 1-D memrefs where possible-iree-memref-flatten
(that'll grow patterns for HAL subspan bindings)Note: subviews
During this sort of flattening, there're two approaches to subviews that are noticable. They roughly correspond to the two functions in ExtractStridedMetadata - the one that has the subview -> reinterpret_cast fold (
populateExpandStridedMetadataPatterns
) and the one that assumes that subviews have already been dealt with by-memref-fold-alias-ops
(populateResolveExtractStridedMetadataPatterns
)That is, one can either rewrite a
subview
into areinterpret_cast
, adding the base of the subview to theoffset
of your memref, or you can declare thatsubview
is not allowed this far down the lowering pipeline.Different pipelines might have different opinions on this, so I figure this pass should implement both options.
The text was updated successfully, but these errors were encountered: