Skip to content

[SPIR-V] Get on an immediate return value of a function of type vk::BufferPointer misgenerates code #7302

@devshgraphicsprogramming

Description

Description

I OpBitcast with inline SPIR-V intrinsics my integer addresses to PhysicalStoragePointers to get equivalent behaviour of old vk::RawBuffer.

Steps to Reproduce

Full Godbolt, uncomment the commented lines https://godbolt.org/z/nKj5PT4xj and remove -Vd flag.

Actual Behavior

For some reason there's an extra OpLoad of the struct type being emitted on the pointer before the access chain that resolves the .Get().a which is then done an a SSA return value and not the thing loaded

fatal error: generated SPIR-V is invalid: The Base <id> '20[%20]' in OpAccessChain instruction must be a pointer. %21 = OpAccessChain %_ptr_Function_int %20 %int_0 

The load is gabage anyway because .Get() isn't supposed to result in a load to Function storage space, and member access is just supposed to form access chains which are still in the PhysicalStorageBuffer space.

If I save the return value of the bitcast function, it fixes the problem.

Tag @danbrown-amd

Environment

  • DXC version 3b1a29b
  • Host Operating System Godbolt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triagespirvWork related to SPIR-V

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions