Skip to content

[DirectX] Add support for resource arrays to DXIL resource metadata #145422

@hekota

Description

@hekota

This task is to add support for resource arrays to DXIL resource metadata.

When the IR code includes llvm.dx.resource.handlefrombinding call to initialize a resource handle from an array, the value of the range argument will be greater than 1, or it will be -1 for unbounded arrays. We need to reflect that in the DXIL resource metadata.

This llvm.dx.resource.handlefrombinding call has range set to 4:

  %1 = tail call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0_0t(i32 0, i32 10, i32 4, i32 2, i1 false, ptr nonnull @A.str)

and the DXIL resource metadata looks like this:

!8 = !{i32 1, ptr @A, !"A", i32 0, i32 10, i32 4, i32 10, i1 false, i1 false, i1 false, !9}

where

@A = external constant %"RWBuffer<float>".

The type of @A should be changed to an array:

@A = external constant [4 x %"RWBuffer<float>"].

Multi-dimensional resource arrays can show up as flattened arrays in the metadata.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportbackend:DirectXllvm:analysisIncludes value tracking, cost tables and constant folding

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions