Issue 150534
Summary [DirectX] PostOptimizationValidation asserts on overlapping bindings when the free space is out of order with the overlapping binding
Labels backend:DirectX
Assignees
Reporter bogner
    Consider:
```llvm
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s

; Check overlap with a gap in the binding space.

; A overlaps with B
; RWBuffer<float> A[3] : register(u0);
; RWBuffer<float> B[] : register(u4);
; RWBuffer<float> C : register(u17);

; CHECK: error: resource C at register 17 overlaps with resource B at register 4 in space 0

@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 1
@C.str = private unnamed_addr constant [2 x i8] c"C\00", align 1

define void @test_overlapping() {
entry:
  %h1 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 3, i32 0, i1 false, ptr @A.str)
  %h2 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 4, i32 -1, i32 0, i1 false, ptr @B.str)
  %h3 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 17, i32 1, i32 0, i1 false, ptr @C.str)
  ret void
}
```

We should see an overlapping binding error here, but we currently trigger an assert instead: https://github.com/llvm/llvm-project/blob/c66f401e1eb6157cd0114634b27004cd78cfe5aa/llvm/lib/Analysis/DXILResource.cpp#L978

This needs to correctly report that there's an overlap instead of asserting.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to