Issue |
137868
|
Summary |
[HLSL] Report diagnostics for implicit resource bindings that cannot be assigned
|
Labels |
HLSL
|
Assignees |
|
Reporter |
hekota
|
Report diagnostics for implicit resource bindings that cannot be assigned, such as:
```
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 error should be reported from `DXILPostOptimizationValidation` pass which can take the time and can depend on all completed resource analyses and/or debug info to lookup the resource variable name.
Implicit bindings are assigned by the `DXILResourceImplicitBinding` pass fairly early in the LLVM pipeline. It replaces `dx.resource.handlefromimplicitbinding` calls with `dx.resource.handlefrombinding` calls for all resources that can be allocated (= assigned a binding).
If a binding cannot be assigned, the pass will leave the `dx.resource.handlefromimplicitbinding` call associated with the resource in the IR to be picked up by the `DXILPostOptimizationValidation` pass for diagnostic. If there are no such resources (= all resources have binding), the `DXILResourceImplicitBinding` pass clear the `ContainsImplicitBindings` flag on `DXILResourceBindingAnalysis`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs