Split a new mem module (for "memory" ops/passes/etc.), out of qptr.#25
Split a new mem module (for "memory" ops/passes/etc.), out of qptr.#25eddyb wants to merge 2 commits intoRust-GPU:mainfrom
mem module (for "memory" ops/passes/etc.), out of qptr.#25Conversation
|
Does this have the infra to support CUDA's model as well? |
This comment was marked as resolved.
This comment was marked as resolved.
Just had to rebase, fixed now.
To be clear, there's no functional changes in this PR, only moves, renames and documentation changes. However, supporting the OpenCL/CUDA model (or Vulkan w/ We will likely never get to map Rust (data) pointers to one specific address space, even in the OpenCL/CUDA model, but having real pointers would mean |
LegNeato
left a comment
There was a problem hiding this comment.
Looks fairly mechanical 🚀
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)