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
{{ message }}
Repository navigation
[SPIR-V][Feature Request] Implement Buffer Pointers in HLSL With vk::BufferPointer #6489
changed the title [-][Feature Request] Implement Buffer Pointers in HLSL With vk::BufferPointer[/-][+][SPIR-V][Feature Request] Implement Buffer Pointers in HLSL With vk::BufferPointer[/+]on Apr 3, 2024
devshgraphicsprogramming commented on Apr 16, 2024
I've looked at this more closely. We might be able to implement something similar to the proposal using inline spir-v, but it cannot implement is properly. The main reason is the get() is suppose to return a reference, but that cannot be expressed in HLSL at this time. When references are added to HLSL properly, then we could implement it in inline spir-v.
I don't think we should wait until them.
The reason this is such a big deal is that if you cannot return a reference, then the number of operations you will need to define in inline spir-v grows to a huge number. You will have to define specific load and store instruction. You'll have to redefine all of the atomic operations. Just in general the syntax will not be as clean.
We still need to do a builtin definition of the class to be able to get the reference semantics right.
Hmm, the only thing I'm wondering here though is that if that proposal relies on references, do we need an implementation of references proper to actually make that work anyway? Or do you think it's possible to implement that proposal without doing so?
Good question. I do not think that is a problem because we have precedent for having builtin functions that return a reference. It might not be described that way, but that is what it is.
For example RWStructuredBuffer::operator[] really returns a reference. The same for any operator[]. We will essentially implement the same concept.
devshgraphicsprogramming commented on Jun 24, 2024
The reason this is such a big deal is that if you cannot return a reference, then the number of operations you will need to define in inline spir-v grows to a huge number. You will have to define specific load and store instruction. You'll have to redefine all of the atomic operations. Just in general the syntax will not be as clean.
Steven Perron (@s-perron) its worse thank you think, you can't define a reference with current inline SPIR-V hence my request for #6578 (which follows/supersedes my #5675 request)
It's one of the big points of incompatibility preventing people from fully migrating off of GLSL.
AFAIK, not in development for DXC, probably in dev for Clang-HLSL. Already implemented in Slang.
I've been able to make my own BDA with vk::SpirvType and Inline Spir-V intrinsics, HOWEVER they only work for is_fundamental_v<T> (scalar and vector) and I've been banging the drum over and over again that if only this little issue (DXC not being able to figure out/annotate the offsets/layouts for a struct type T#6541) got fixed I'd be able to make BDA for all types.
Now, if I remove some parts, then things starts to fail:
Case 1: changing the typedef above to use a different alignment.
This should have no effect since the ctor I used below is using the type defined in the main function with a 32 byte alignent.
error: type mismatch
vk::BufferPointer<uint, 32> test = vk::BufferPointer<uint, 32>(addr);
error: cannot convert from 'uint64_t' to 'vk::BufferPointer<uint, 32>'
vk::BufferPointer<uint, 32> test = vk::BufferPointer<uint, 32>(addr);
Another weirdness:
Removing the push constant prevents me from using the uint64_t ctor.
error: type mismatch
vk::BufferPointer<uint, 32> test = vk::BufferPointer<uint, 32>(addr);
error: cannot convert from 'uint64_t' to 'vk::BufferPointer<uint, 32>'
vk::BufferPointer<uint, 32> test = vk::BufferPointer<uint, 32>(addr);
Activity
[-][Feature Request] Implement Buffer Pointers in HLSL With vk::BufferPointer[/-][+][SPIR-V][Feature Request] Implement Buffer Pointers in HLSL With vk::BufferPointer[/+]devshgraphicsprogramming commentedon Apr 16, 2024
Here's the deal, given that Proposal 0011 is merged, I could implement proposal 0010 as a pure header-only library.
Provided this issue is fixed#5784devshgraphicsprogramming commentedon Apr 17, 2024
I'm actually quite close to getting it working, blocked by #6541 though
s-perron commentedon Jun 21, 2024
I've looked at this more closely. We might be able to implement something similar to the proposal using inline spir-v, but it cannot implement is properly. The main reason is the
get()is suppose to return a reference, but that cannot be expressed in HLSL at this time. When references are added to HLSL properly, then we could implement it in inline spir-v.I don't think we should wait until them.
The reason this is such a big deal is that if you cannot return a reference, then the number of operations you will need to define in inline spir-v grows to a huge number. You will have to define specific load and store instruction. You'll have to redefine all of the atomic operations. Just in general the syntax will not be as clean.
We still need to do a builtin definition of the class to be able to get the reference semantics right.
Tobski commentedon Jun 21, 2024
Hmm, the only thing I'm wondering here though is that if that proposal relies on references, do we need an implementation of references proper to actually make that work anyway? Or do you think it's possible to implement that proposal without doing so?
s-perron commentedon Jun 21, 2024
Good question. I do not think that is a problem because we have precedent for having builtin functions that return a reference. It might not be described that way, but that is what it is.
For example RWStructuredBuffer::operator[] really returns a reference. The same for any
operator[]. We will essentially implement the same concept.devshgraphicsprogramming commentedon Jun 24, 2024
Steven Perron (@s-perron) its worse thank you think, you can't define a reference with current inline SPIR-V hence my request for #6578 (which follows/supersedes my #5675 request)
buzmeg commentedon Nov 12, 2024
Anybody know what the status of this is?
It's one of the big points of incompatibility preventing people from fully migrating off of GLSL.
devshgraphicsprogramming commentedon Nov 12, 2024
AFAIK, not in development for DXC, probably in dev for Clang-HLSL. Already implemented in Slang.
I've been able to make my own BDA with
vk::SpirvTypeand Inline Spir-V intrinsics, HOWEVER they only work foris_fundamental_v<T>(scalar and vector) and I've been banging the drum over and over again that if only this little issue (DXC not being able to figure out/annotate the offsets/layouts for a struct typeT#6541) got fixed I'd be able to make BDA for all types.I mean, heck, I even have atomics on my BDAs!
See our counting sort https://github.com/Devsh-Graphics-Programming/Nabla/blob/d37770f6dfab7f19de6c798ddd2c5a93256ee7ae/include/nbl/builtin/hlsl/bda/bda_accessor.hlsl#L39
Again I'm not a dev so they can probably tell you more about the roadmap
11 remaining items
[spirv] Implements vk::BufferPointer proposal
[SPIRV] Implements vk::BufferPointer proposal (microsoft#7163)
Keenuts commentedon Apr 4, 2025
Hello!
It looks like part of the proposal was missed:
Thus reopening this issue
danbrown-amd commentedon Apr 4, 2025
Not so. See vk.buffer-pointer.linked-list.hlsl, line 60:
block_p copy1 = block_p(addr);The RHS constructs a buffer pointer from a
uint_64tvalue.Keenuts commentedon Apr 4, 2025
Mmm interesting, it looks like there is something going on.
The following code does work.
Now, if I remove some parts, then things starts to fail:
Case 1: changing the typedef above to use a different alignment.
This should have no effect since the ctor I used below is using the type defined in the main function with a 32 byte alignent.
Another weirdness:
Removing the push constant prevents me from using the uint64_t ctor.
[spirv] Fixes vk::BufferPointer constructor expression construction.
danbrown-amd commentedon Apr 10, 2025
I've submitted a PR to fix #7302 as well.
danbrown-amd commentedon Apr 14, 2025
Steven Perron (@s-perron) could you look at PRs #7302 and #7331 as well?
[spirv] Fixes vk::BufferPointer constructor expression construction. (m…