Split a new mem module (for "memory" ops/passes/etc.), out of qptr.
#25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is mainly a reshuffling of terminology and organization, though an important one IMO.
The rough split is along the lines of:
[MaybeUninit<u8>]- or[Byte]given thisBytedefinition)MemOpis mainly accesses likeLoadandStore(alsoCopy, maybe atomics, in the future)mem::layout/mem::shapecould use more reorganization, but are a better fit thanqptr(because they describe the contents of memory, e.g. as viewed through some data type)
mem::analyzecollectingMemAccessesinto#[mem.accesses(...)]attributes, which can be turned into data types (and typed pointers in e.g.qptr::lift)mem::analyzecollects (and there is potential for reusing thestruct-like "disjoint partitioning")(or not even be needed, e.g. memory accesses could take a memory declaration and an offset)
qptrand SPIR-VOpTypePointer(maybe aptrmodule in the future?)qptr::legalizepass is going to rewrite dynamic pointers (what SPIR-V calls "variable pointers") into e.g. pairs of integers (which memory declaration, and what offset), and that is purely about the pointer values (as opposed to the memory they refer to)The motivation for this refactor was a combination of:
qptr::legalizedesign making it clear that there should be a split between it, and (what is now)mem::analyze- the latter should only have to infer "typed memory" from direct accesses (and never have to worry about dynamic pointer values)SPV_KHR_untyped_pointers, that only simplifies/removes the need for "typed memory", but it does not remove restrictions on pointer values, soqptr::legalizewould remain mostly unchanged, even ifmem::analyze(and the worst ofqptr::lift) could be skippedqptr(e.g. the OpenCL model, or even justPhysicalStorageBuffer64), without having to duplicate/complicate the memory access partsOpLoad/OpStoretomem.load/mem.storewhile keeping the SPIR-VOpTypePointer, would even be doable (if limited to scalar/vector types - anything else would still have to be lowered in a separate pass that needs access tomem::layout, but that's less obvious without thedisaggregatechanges)