Conversation
2661ecd to
f30dd2e
Compare
This was referenced Apr 18, 2023
eddyb
added a commit
that referenced
this pull request
Apr 21, 2023
This is an easy way to annotate the IR (anything that supports attributes) with diagnostics that would otherwise have a hard time being reported in a way that correlates with the definition they relate to (without a full-on diagnostic system). Example from an WIP version of #24: 
Contributor
Author
|
In the interest of releasing Rust-GPU 0.7 today, we'll try to get this merged as-is, and defer further polish. |
oisyn
previously approved these changes
Apr 21, 2023
This was referenced Nov 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
qptris the first major SPIR-T feature/departure from SPIR-V, and represents a vision for memory/pointers:quasi-pointer" (alternatively, "quantum"), in the sense of "not quite (a pointer)"ptrs)ptrsGenericphysical pointers (but more flexible and without runtime behavior)qptrcan replace Rust-GPU's "Storage Class" inference pass)VariablePointers)VariablePointers) can't be stored to memory, returned from functions or passed throughOpPhis, each "logical pointer" is strictly a static alias of some variable, with a maybe-dynamic offsetqptr.offsetnodes, andqptr.load/qptr.storeleaves), and all such "trees" are disjoint between pointer definitions - such a "tree"-like structure can be seen reified in theqptr.usageattribute (produced byqptr::analyze)T addrspace(AS)*pointer types (via OpenCL SPIR)int2ptrcasts, loads of physical pointers etc. - not implemented yet)QPtrOp- shown asqptr.*below)qptr::lower: SPIR-VOpTypePointertypes/instructions are lowered toqptrandqptr.*opsOpAccessChains on composite types become pointer arithmetic (erasing those types)qptroperations directly)qptr::analyze:qptruses are analyzed to generateqptr.usageattributesunion-like uses that were illegal in the SPIR-V input ofqptr::lower- Rust-GPU could use this to support many more shapes ofenums)qptr::lift:qptr.*ops are lifted back to SPIR-VOpTypePointertypes/instructionsqptr.usageattributes are used to generate pointee types that support all (transitive) usesqptr::lower- Rust-GPU could use this to replace its "Storage Class" inference pass)qptrs can point to either:qptr.handle_array_indexto select a single handle (i.e. "descriptor indexing")qptr.buffer_datato obtain aqptrto the memory contentsOpImageTexelPointerin SPIR-V, on a pointer to anOpTypeImage)qptr.buffer_dyn_lencan query the size of dynamically-sized buffers (replacingOpArrayLength)Block-decoratedOpTypeStructs in specific "Storage Class"es (Uniform,StorageBuffer,ShaderRecordBufferKHR) to encode buffers "syntactically" (i.e. mimicking their GLSL declaration syntax)qptr.offsetandqptr.dyn_offsetOpAccessChain)qptr.dyn_offsetincludes an immediate stride (in the extreme this could be generalized to a kind of "integer dot product", if N-dimensional arrays ever require it)qptr.load/qptr.storeExample (
qptrpasses onkajiya'sassets/shaders/wrc/wrc_see_through.rgen.hlsl):(type information like
OpMemberNamecan be seen to be erased, and only used offsets are recreated)(
qptr.*ops can be seen as blue against the backdrop of orangespv.*ops, thanks to #21)FIXME(@eddyb): move/copy some of this description into the library documentation (maybe a design document?)