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] Declaration of the Image Type for RWTexture has explicit format but image writes and stores emit unformatted. #6979
DXC declares the image type with a "guessed" format e.g. rg32f for a float32_t but then does unformatted writes.
Edit: the guessing isn't a problem, I can correct with e.g. [[vk::image_format("rg16f")]] attribute
The SPIR-V legalization pass should probably "patch in" the actual format into the read and write ops from the image type declaration (by following the access and pointer chains).
I think I see the problem, the drivers can already do this
The SPIR-V legalization pass should probably "patch in" the actual format into the read and write ops from the image type declaration (by following the access and pointer chains).
Hence the reads/writes are never truly unformatted.
That doesn't change the fact that if the SPIR-V validators were actually to care about the ops being legal, they'd need the formats patched in.
devshgraphicsprogramming commented on Oct 21, 2024
%type_3d_image = OpTypeImage %float 3D 2 0 0 2 Rg32f
but a following store op is used
OpImageWrite %15 %17 %9 None
The Image Format must not be Unknown, unless the StorageImageWriteWithoutFormat Capability was declared.
I don't see the issue here.
(Aside the OpUndef caused by the static), the OpImageWrite image has a format Rg32f, which is not unknown. Meaning we can emit this write without the capability.
Am I missing something here?
devshgraphicsprogramming commented on Oct 22, 2024
%type_3d_image = OpTypeImage %float 3D 2 0 0 2 Rg32f
but a following store op is used
OpImageWrite %15 %17 %9 None
The Image Format must not be Unknown, unless the StorageImageWriteWithoutFormat Capability was declared.
I don't see the issue here. (Aside the OpUndef caused by the static), the OpImageWrite image has a format Rg32f, which is not unknown. Meaning we can emit this write without the capability. Am I missing something here?
Two issues:
SPIR-V Spec says that you can't emit a write with None without the capability, doesn't matter if the format is known on the actual descriptor (unless I'm reading the spec wrong?)
There's no way for me to declare None on the OpTypeImage
SPIR-V Spec says that you can't emit a write with None without the capability, doesn't matter if the format is known on the actual descriptor (unless I'm reading the spec wrong?)
Seems like one of us misunderstand something. My understanding:
OpTypeImage -> if Unknown + OpImageWrite, caps is required. Otherwise, not.
The None of the OpImageWrite is not the format, but marks that there are no additional operands.
Here, the OpTypeImage is generated with Rg32f, meaning the capability is not required. Code seems valid to me.
There's no way for me to declare None on the OpTypeImage
You mean Unknown ?
That's another issue. I'm currently investigating. Seems like DXC was never able to generate Unknown with this attribute, as we used Unknown to mark the absence of attribute and guess a format.
This meant we always tried to guess, and it hid another bug later down the road with the capability.
I'm working on a fix to allow "unknown" in the image_format attribute & fix the capability.
But this issue it not the same as the one originally reported. (I'll track it in a new issue)
OpTypeImage -> if Unknown + OpImageWrite, caps is required. Otherwise, not.
The None of the OpImageWrite is not the format, but marks that there are no additional operands.
You mean Unknown ?
Ugh I misred the spec/SPIR-V disassembly None and Unknown have the same enum, the None on the ImageWrite and Load is just no-extra operands. Sorry about that
Activity
devshgraphicsprogramming commentedon Oct 21, 2024
I think I see the problem, the drivers can already do this
Hence the reads/writes are never truly unformatted.
That doesn't change the fact that if the SPIR-V validators were actually to care about the ops being legal, they'd need the formats patched in.
devshgraphicsprogramming commentedon Oct 21, 2024
Nathan Gauër (@Keenuts) did you accidentally break
[[vk::image_format("unknown")]]with some of your PRs ?https://godbolt.org/z/97vhvz9vP
Also did you ever emit the
WriteWithoutFormatandReadWtihoutFormatcapabilities if such a type was also used in a store/load op?Keenuts commentedon Oct 22, 2024
I don't see the issue here.
(Aside the OpUndef caused by the static), the OpImageWrite image has a format Rg32f, which is not unknown. Meaning we can emit this write without the capability.
Am I missing something here?
devshgraphicsprogramming commentedon Oct 22, 2024
Two issues:
Nonewithout the capability, doesn't matter if the format is known on the actual descriptor (unless I'm reading the spec wrong?)Noneon theOpTypeImageKeenuts commentedon Oct 22, 2024
Seems like one of us misunderstand something. My understanding:
OpTypeImage-> ifUnknown+OpImageWrite, caps is required. Otherwise, not.Noneof theOpImageWriteis not the format, but marks that there are no additional operands.Here, the OpTypeImage is generated with
Rg32f, meaning the capability is not required. Code seems valid to me.You mean
Unknown?That's another issue. I'm currently investigating. Seems like DXC was never able to generate Unknown with this attribute, as we used Unknown to mark the absence of attribute and guess a format.
This meant we always tried to guess, and it hid another bug later down the road with the capability.
I'm working on a fix to allow "unknown" in the
image_formatattribute & fix the capability.But this issue it not the same as the one originally reported. (I'll track it in a new issue)
devshgraphicsprogramming commentedon Oct 23, 2024
Ugh I misred the spec/SPIR-V disassembly None and Unknown have the same enum, the
Noneon the ImageWrite and Load is just no-extra operands. Sorry about that