Skip to content

[HLSL][SPIRV] NonUniformResourceIndex lowering #161852

@s-perron

Description

@s-perron

We need to implement handle the spv intrinsic add in #159608 in the SPIR-V backend. This intrinsic is used to indicate that the index to the resource array is non uniform. For SPIR-V, this means that we have to add the appropriate capability to the module. Which capability depends on the type of the resource array, and add the decoration to the index, and the access chain that does the indexing.

Most of the code for this is already in the SPIR-V backend. During ISel, in SPIRVInstructionSelector::buildPointerToResource, the IsNonUniform is used to trigger all everything. For now, that value is always false.

The new implementation can be:

  1. When we see the new intrinsic, apply create a OpCopyObject and add the decoration SPIRV::Decoration::NonUniformEXT to the index.
  2. In SPIRVInstructionSelector::buildPointerToResource, remove the IsNonUniform parameter. If the index register has the SPIRV::Decoration::NonUniformEXT decoration, then add the decoration to the access chain as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions