Skip to content

[HLSL] Improve diagnostics for implicit resource bindings that cannot be assigned #137868

Closed
@hekota

Description

@hekota

When an implicit binding cannot be assigned to a resource the diagnostic should include the name of the affected resource variable.

RWBuffer<float> A : register(u1);
RWBuffer<float> B[];     // gets u6 (unbounded range)
RWBuffer<float> C : register(u5);
RWBuffer<float> D[4];    // error - does not fit in the remaining descriptor ranges in space0 

[numthreads(4,1,1)]
void main() {
  A[0] = D[2][0] + C[0] + B[10][0];
}

https://godbolt.org/z/6bYoG599P

Expected:

<source>:4:1: error: resource D could not be allocated

The diagnostic is going to be issued from DXILResourceImplicitBindings pass (implementation in progress) and currently does not include the resource variable name. Since global resource variables are declared as internal, they are optimized away by the time this pass runs, so it cannot just grab the name from the global.
This task is to figure out if there is a way to get the name is the resource variable from debug information.

If the debug information is not present the message should be:

<unknown>:0:0: error: Resource could not be allocated. Compile with debug info to get a more informative error message.

Related task: #105059

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions