Skip to content
New issue

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

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

Already on GitHub? # to your account

Invlid spirv generated from buffer pointer #3621

Closed
Ipotrick opened this issue Feb 23, 2024 · 5 comments
Closed

Invlid spirv generated from buffer pointer #3621

Ipotrick opened this issue Feb 23, 2024 · 5 comments
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang

Comments

@Ipotrick
Copy link

After having this fixed,
the generated spirv i get is invalid according to the vulkan validation layers (my app also crashes when i still run):

VUID-VkShaderModuleCreateInfo-pCode-08737(ERROR / SPEC): msgNum: -1520283006 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282 | vkCreateShaderModule(): pCreateInfo->pCode is not valid SPIR-V: OpVariable 159: expected AliasedPointer or RestrictPointer for PhysicalStorageBuffer pointer.
  %159 = OpVariable %_ptr_Function__ptr_PhysicalStorageBuffer_PP Function
. The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08737)
    Objects: 0

The repro is the same as in the issue i linked.

@swoods-nv swoods-nv added the goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang label Feb 23, 2024
@csyonghe csyonghe self-assigned this Feb 23, 2024
@csyonghe
Copy link
Collaborator

It appears that this is a spirv-opt bug. Run slangc with -O0 to disable spirvopt and you will get a valid SPIRV. I suggest you open an issue for spirvopt, and provide the slang output using -O0.

@csyonghe

This comment was marked as outdated.

@csyonghe csyonghe reopened this Feb 23, 2024
@csyonghe
Copy link
Collaborator

I can confirm that this is a spirv-opt bug.

Steps to reproduce:

> slangc test.slang -target spirv -emit-spriv-directly -O0 -o test.spv
> spirv-val test.spv             // should pass validation here
> spirv-opt test.spv --inline-entry-points-exhaustive -o out.spv
> spirv-val out.spv            // broken!

@csyonghe
Copy link
Collaborator

Closing this issue now since there isn't much we can do in the Slang codebase.

@csyonghe
Copy link
Collaborator

Update: I filed a bug for spirv-opt here: KhronosGroup/SPIRV-Tools#5607

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang
Projects
None yet
Development

No branches or pull requests

3 participants