Skip to content

Commit baa4376

Browse files
Add Check for invalid matrix stride, add source correlation strings
1 parent 8b2170b commit baa4376

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

tools/clang/test/CodeGenHLSL/linalg/outer-product-accumulate-matrix-layout.hlsl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML=MATRIX_LAYOUT_ROW_MAJOR -DSTRIDE=64 2>&1| FileCheck %s --check-prefixes DXIL-0
2-
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML=MATRIX_LAYOUT_COLUMN_MAJOR -DSTRIDE=64 2>&1 | FileCheck %s --check-prefixes DXIL-1
3-
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML=MATRIX_LAYOUT_MUL_OPTIMAL -DSTRIDE=64 2>&1 | FileCheck %s --check-prefixes DXIL-2
4-
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML= MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL = 3 -DSTRIDE=64 2>&1 | FileCheck %s --check-prefixes DXIL-3
5-
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML= MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL = 3 -DSTRIDE=0 2>&1 | FileCheck %s --check-prefixes DXIL-4
1+
// RUN: %dxc -I %hlsl_headers -T cs_6_9 %s -enable-16bit-types -DML= MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL = 3 -DSTRIDE=0 2>&1 | FileCheck %s
62

3+
//Source file for the IR in \tools\clang\test\LitDXILValidation\outer-product-accumulate-matrix-layout-failing.ll
4+
//Source file for the IR in \tools\clang\test\LitDXILValidation\outer-product-accumulate-matrix-layout-passing.ll
75

86
ByteAddressBuffer input_vector_buffer;
97
ByteAddressBuffer input_vector_buffer2;
108
RWByteAddressBuffer matrix_buffer;
119

1210
#include <dx/linalg.h>
1311

14-
// DXIL-0: error: matrix layout value 'RowMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
15-
// DXIL-1: error: matrix layout value 'ColumnMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
16-
// DXIL-2: error: matrix layout value 'MulOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
17-
// DXIL-3-NOT: error: matrix layout value 'OuterProductOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
18-
// DXIL-3: error: matrix stride must be zero for optimal layouts
19-
// DXIL-4: call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %{{[^ ]+}}, <8 x half> %{{[^ ]+}}, %dx.types.Handle %{{[^ ]+}}, i32 0, i32 8, i32 3, i32 0)
12+
// CHECK: call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %{{[^ ]+}}, <8 x half> %{{[^ ]+}}, %dx.types.Handle %{{[^ ]+}}, i32 0, i32 8, i32 3, i32 0)
2013
using namespace dx::linalg;
2114

2215
[Numthreads(1,1,1)]

tools/clang/test/LitDXILValidation/outer-product-accumulate-matrix-layout-failing.ll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
; REQUIRES: dxil-1-9
22
; RUN: not %dxv %s 2>&1 | FileCheck %s
33

4+
;Original Source: D:\git\github\DirectXShaderCompiler-acFork\DirectXShaderCompiler\tools\clang\test\CodeGenHLSL\linalg\outer-product-accumulate-matrix-layout.hlsl
5+
46
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"
57
target triple = "dxil-ms-dx"
68

@@ -15,7 +17,7 @@ target triple = "dxil-ms-dx"
1517
; an order different from the IR. So listed them here in the
1618
; order they appear and added comments for correlation
1719

18-
20+
;CHECK: error: matrix stride must be zero for optimal layouts
1921
;CHECK: error: matrix stride must be zero for optimal layouts
2022
;CHECK-NOT: error: matrix layout value 'OuterProductOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
2123
;CHECK: error: matrix layout value 'MulOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
@@ -42,6 +44,8 @@ define void @main() {
4244
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)
4345
; error: matrix stride must be zero for optimal layouts
4446
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)
47+
; error: matrix stride must be 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 63) ; OuterProductAccumulate(inputVector1,inputVector2,matrixBuffer,matrixOffset,matrixIntepretation,matrixLayout,matrixStride)
4549
ret void
4650
}
4751

tools/clang/test/LitDXILValidation/outer-product-accumulate-matrix-layout-passing.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
; REQUIRES: dxil-1-9
22
; RUN: %dxv %s 2>&1 | FileCheck %s
33

4+
;Original Source: D:\git\github\DirectXShaderCompiler-acFork\DirectXShaderCompiler\tools\clang\test\CodeGenHLSL\linalg\outer-product-accumulate-matrix-layout.hlsl
5+
46
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"
57
target triple = "dxil-ms-dx"
68

0 commit comments

Comments
 (0)