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

Invalid SPIR-V generation for vector<X, 8>/vector<X, 16> usage #6012

Open
jtytgat opened this issue Jan 6, 2025 · 2 comments
Open

Invalid SPIR-V generation for vector<X, 8>/vector<X, 16> usage #6012

jtytgat opened this issue Jan 6, 2025 · 2 comments
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should

Comments

@jtytgat
Copy link

jtytgat commented Jan 6, 2025

Slightly related to #5987 but the resolution might be different for the following:

When using vector<X, 8>/vector<X, 16>, Slang doesn't generate a warning nor error but generates invalid SPIR-V output instead.

StructuredBuffer<vector<float, 8>> bufferIn;
RWStructuredBuffer<float> resultOut;

[shader("compute")]
[numthreads(1,1,1)]
void computeMain(uint3 threadId : SV_DispatchThreadID)
{
	uint index = threadId.x;
	
	resultOut[index] = bufferIn[index][0] + bufferIn[index][4];
}
$ slangc test.slang -target spirv -o test.spv
$ spirv-val test.spv
error: line 37: Having 8 components for TypeVector requires the Vector16 capability
  %v8float = OpTypeVector %float 8

Marking the SPIR-V output with Vector16 capability is not an option as this is a kernel execution only capability.

Could one of the following be done?

  • Generate an error for all output types where this is not supported.
  • Split the vector<X,8>/vector<X,16> access into vector<X,4> access.
@jtytgat
Copy link
Author

jtytgat commented Jan 7, 2025

Looks like this issue is actually superseded by the proposal https://github.com/shader-slang/slang/blob/master/docs/proposals/014-extended-length-vectors.md
Am I right @expipiplus1 ?

@bmillsNV
Copy link
Collaborator

bmillsNV commented Jan 7, 2025

For now, let's just generate errors. Marking for current quarter.

@bmillsNV bmillsNV added this to the Q1 2025 (Winter) milestone Jan 7, 2025
@bmillsNV bmillsNV added goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should labels Jan 7, 2025
@aleino-nv aleino-nv assigned bmillsNV and unassigned aleino-nv Mar 12, 2025
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:bug something doesn't work like it should
Projects
None yet
Development

No branches or pull requests

3 participants