The Wayback Machine - https://web.archive.org/web/20201128060415/https://github.com/google/clspv/issues/530
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 generated from program-scope global variables #530

Open
jrprice opened this issue Mar 18, 2020 · 1 comment
Open

Invalid SPIR-V generated from program-scope global variables #530

jrprice opened this issue Mar 18, 2020 · 1 comment

Comments

@jrprice
Copy link
Collaborator

@jrprice jrprice commented Mar 18, 2020

Compiling this with -cl-std=CL2.0 -inline-entry-points:

const int data = 42;
kernel void foo() {}

produces SPIR-V that fails to validate:

error: line 22: StorageBuffer OpVariable <id> '11[%11]' has illegal type.
From Vulkan spec, section 14.5.2:
Variables identified with the StorageBuffer storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type
  %11 = OpVariable %_ptr_StorageBuffer_uint StorageBuffer %uint_42

Program-scope variables default to the global address space in OpenCL 2.x. Marking the variable as either static or constant fixes it.

@alan-baker alan-baker added this to the OpenCL 2.x Support milestone Mar 19, 2020
@alan-baker alan-baker added this to Bugs in General Mar 19, 2020
@alan-baker
Copy link
Collaborator

@alan-baker alan-baker commented Mar 19, 2020

These should likely be treated similarly to how constant data initializers are treated currently. Allocate a descriptor and binding and record the initializer if any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.