|
| 1 | +; REQUIRES: dxil-1-9 |
| 2 | +; RUN: not %dxv %s 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +; Original Source: \tools\clang\test\CodeGenHLSL\linalg\outer-product-accumulate-matrix-layout.hlsl |
| 5 | +; The failing tests were generated by manually editing the IR produced from the IR from the passing |
| 6 | +; case generated by running the hlsl above (Original Source) |
| 7 | + |
| 8 | +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" |
| 9 | +target triple = "dxil-ms-dx" |
| 10 | + |
| 11 | +%dx.types.Handle = type { i8* } |
| 12 | +%dx.types.ResBind = type { i32, i32, i32, i8 } |
| 13 | +%dx.types.ResourceProperties = type { i32, i32 } |
| 14 | +%dx.types.ResRet.v8f16 = type { <8 x half>, i32 } |
| 15 | +%struct.ByteAddressBuffer = type { i32 } |
| 16 | +%struct.RWByteAddressBuffer = type { i32 } |
| 17 | + |
| 18 | +; As noted in other tests, the validation errors come out in |
| 19 | +; an order different from the IR. So listed them here in the |
| 20 | +; order they appear and added comments for correlation |
| 21 | + |
| 22 | +;CHECK: error: matrix stride must be a constant zero for optimal layouts |
| 23 | +;CHECK: error: matrix stride must be a constant zero for optimal layouts |
| 24 | +;CHECK-NOT: error: matrix layout value 'OuterProductOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 25 | +;CHECK: error: matrix layout value 'MulOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 26 | +;CHECK: error: matrix layout value 'ColumnMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 27 | +;CHECK: error: matrix layout value 'RowMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 28 | +; CHECK: Validation failed. |
| 29 | + |
| 30 | +define void @main() { |
| 31 | + %1 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 0, i32 0, i32 0, i8 1 }, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) |
| 32 | + %2 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 0 }, i32 1, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) |
| 33 | + %3 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind zeroinitializer, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) |
| 34 | + %4 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %3, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer |
| 35 | + %5 = call %dx.types.ResRet.v8f16 @dx.op.rawBufferVectorLoad.v8f16(i32 303, %dx.types.Handle %4, i32 0, i32 undef, i32 2) ; RawBufferVectorLoad(buf,index,elementOffset,alignment) |
| 36 | + %6 = extractvalue %dx.types.ResRet.v8f16 %5, 0 |
| 37 | + %7 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer |
| 38 | + %8 = call %dx.types.ResRet.v8f16 @dx.op.rawBufferVectorLoad.v8f16(i32 303, %dx.types.Handle %7, i32 0, i32 undef, i32 2) ; RawBufferVectorLoad(buf,index,elementOffset,alignment) |
| 39 | + %9 = extractvalue %dx.types.ResRet.v8f16 %8, 0 |
| 40 | + %10 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 4107, i32 0 }) ; AnnotateHandle(res,props) resource: RWByteAddressBuffer |
| 41 | + ; error: matrix layout value 'RowMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 42 | + call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %6, <8 x half> %9, %dx.types.Handle %10, i32 0, i32 8, i32 0, i32 0) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride) |
| 43 | + ; error: matrix layout value 'ColumnMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 44 | + call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %6, <8 x half> %9, %dx.types.Handle %10, i32 0, i32 8, i32 1, i32 0) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride) |
| 45 | + ; matrix layout value 'MulOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal' |
| 46 | + call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %6, <8 x half> %9, %dx.types.Handle %10, i32 0, i32 8, i32 2, i32 0) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride) |
| 47 | + ; error: matrix stride must be a constant zero for optimal layouts |
| 48 | + call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %6, <8 x half> %9, %dx.types.Handle %10, i32 0, i32 8, i32 3, i32 64) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride) |
| 49 | + ; error: matrix stride must be a constant zero for optimal layouts |
| 50 | + call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %6, <8 x half> %9, %dx.types.Handle %10, i32 0, i32 8, i32 3, i32 63) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride) |
| 51 | + ret void |
| 52 | +} |
| 53 | + |
| 54 | +; Function Attrs: nounwind readonly |
| 55 | +declare %dx.types.ResRet.v8f16 @dx.op.rawBufferVectorLoad.v8f16(i32, %dx.types.Handle, i32, i32, i32) #0 |
| 56 | + |
| 57 | +; Function Attrs: nounwind |
| 58 | +declare void @dx.op.outerProductAccumulate.v8f16.v8f16(i32, <8 x half>, <8 x half>, %dx.types.Handle, i32, i32, i32, i32) #1 |
| 59 | + |
| 60 | +; Function Attrs: nounwind readnone |
| 61 | +declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #2 |
| 62 | + |
| 63 | +; Function Attrs: nounwind readnone |
| 64 | +declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, i32, i1) #2 |
| 65 | + |
| 66 | +attributes #0 = { nounwind readonly } |
| 67 | +attributes #1 = { nounwind } |
| 68 | +attributes #2 = { nounwind readnone } |
| 69 | + |
| 70 | +!dx.version = !{!0} |
| 71 | +!dx.valver = !{!0} |
| 72 | +!dx.shaderModel = !{!1} |
| 73 | +!dx.resources = !{!2} |
| 74 | +!dx.entryPoints = !{!8} |
| 75 | + |
| 76 | +!0 = !{i32 1, i32 9} |
| 77 | +!1 = !{!"cs", i32 6, i32 9} |
| 78 | +!2 = !{!3, !6, null, null} |
| 79 | +!3 = !{!4, !5} |
| 80 | +!4 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} |
| 81 | +!5 = !{i32 1, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 1, i32 1, i32 11, i32 0, null} |
| 82 | +!6 = !{!7} |
| 83 | +!7 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} |
| 84 | +!8 = !{void ()* @main, !"main", null, !2, !9} |
| 85 | +!9 = !{i32 0, i64 8598323216, i32 4, !10} |
| 86 | +!10 = !{i32 1, i32 1, i32 1} |
0 commit comments