[SPIR-V] Intrinsics returning vk::SpirvOpaqueType</*spv::OpTypePointer*/32,
don't codegen properly
#6978
Labels
Milestone
Description
DXC gets mightly confused by Inline SpirV intrinsics.
@s-perron this will probably spoil your fun with Workgroup storage class pointers.
Steps to Reproduce
If we make no temporary
image_ptr_t
like so it works : https://godbolt.org/z/sEGKrGaaoHowever if we try to make the intrinsic actually return a Spir-V pointer type we run into trouble https://godbolt.org/z/bjjGo5xGM
Actual Behavior
Insight provided by
-Vd
https://godbolt.org/z/4z44joGqEgenerates
But what is
_ptr_Image__ptr_Image_float
you might ask?Pointer of Image Storage class to Pointer of Image Storage Class!
The compiler seems to expect that the Inline SPIRV intrinsic always return a non-SPIR-V type
T
which is supposed to be a variable, so the SPIR-V codegen makes a "pointer to T" declaration.Its because it slaps an extra layer of pointer on your return type, thats why it worked for the above original "wrong" return type of "just"
T
. Frankly I am amazed it guessed the storage class right.This is obviously wrong for an intrinsic you'd want to return an actual SPIR-V pointer. Why would you want to return an inline SPIR-V pointer? Because you don't want DXC's codegen to guess the storage class for you / be in control!
Example:
velImgF32
is a Function Storage Class pointer ofOpTypeImage %float 3D 2 0 0 2 R32f
type, andOpImageTexelPointer
produces an Image Storage Class pointer tofloat
out of it.Environment
The text was updated successfully, but these errors were encountered: