Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrowing bit_cast fails vulkan validation #3983

Closed
pborsutzki opened this issue Apr 19, 2024 · 1 comment · Fixed by #3988
Closed

Narrowing bit_cast fails vulkan validation #3983

pborsutzki opened this issue Apr 19, 2024 · 1 comment · Fixed by #3988
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:enhancement a desirable new feature, option, or behavior

Comments

@pborsutzki
Copy link

pborsutzki commented Apr 19, 2024

Hi,

the following program fails vulkan validation when compiled using slang 2024.1.7 with the command slangc.exe -entry computeMain -stage compute -target spirv -O0 -emit-spirv-directly -o shader.spv && spirv-val.exe shader.spv:

uniform StructuredBuffer<uint64_t> in;
uniform RWStructuredBuffer<uint32_t> out;

[numthreads(4, 1, 1)]
[shader("compute")]
void computeMain() {
    out[0] = bit_cast<uint32_t>(in[0]);
}

Gives me the following SPIRV validation error (using spirv-val from the 1.3.280.0 Vulkan SDK):

error: line 50: Expected input to have the same total bit width as Result Type: Bitcast
  %23 = OpBitcast %uint %22

I'd rather have the warning already in slang's frontend instead of only during SPIRV validation.

Thanks for having a look!

@csyonghe
Copy link
Collaborator

There is a missing check on this, and this is a known issue to us.

This is the same issue with #3331.

@ArielG-NV ArielG-NV added kind:enhancement a desirable new feature, option, or behavior goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang labels Apr 19, 2024
@ArielG-NV ArielG-NV self-assigned this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:enhancement a desirable new feature, option, or behavior
Projects
None yet
3 participants