|
| 1 | +; This is an adapted copy of test/transcoding/SPV_INTEL_joint_matrix/joint_matrix.ll |
| 2 | + |
| 3 | +; RUN: llvm-as < %s -o %t.bc |
| 4 | +; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_cooperative_matrix,+SPV_INTEL_joint_matrix -o %t.spv |
| 5 | +; RUN: llvm-spirv %t.spv -to-text -o %t.spt |
| 6 | +; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV |
| 7 | + |
| 8 | +; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.rev.ll |
| 9 | +; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM |
| 10 | + |
| 11 | +; CHECK-SPIRV-DAG: Capability CooperativeMatrixKHR |
| 12 | +; CHECK-SPIRV-DAG: Capability CooperativeMatrixPrefetchINTEL |
| 13 | +; CHECK-SPIRV-DAG: Extension "SPV_KHR_cooperative_matrix" |
| 14 | +; CHECK-SPIRV-DAG: Extension "SPV_INTEL_joint_matrix" |
| 15 | +; CHECK-SPIRV-DAG: TypeInt [[#Int8Ty:]] 8 0 |
| 16 | +; CHECK-SPIRV-DAG: TypeInt [[#Int32Ty:]] 32 0 |
| 17 | +; CHECK-SPIRV-DAG: Constant [[#Int32Ty]] [[#Const12:]] 12 |
| 18 | +; CHECK-SPIRV-DAG: Constant [[#Int32Ty]] [[#Const48:]] 48 |
| 19 | +; CHECK-SPIRV-DAG: Constant [[#Int32Ty]] [[#Const0:]] 0 |
| 20 | +; CHECK-SPIRV-DAG: Constant [[#Int32Ty]] [[#Const3:]] 3 |
| 21 | +; CHECK-SPIRV-DAG: Constant [[#Int32Ty]] [[#Const2:]] 2 |
| 22 | +; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#MatTy1:]] [[#Int8Ty]] [[#Const0]] [[#Const12]] [[#Const48]] [[#Const3]] |
| 23 | +; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#MatTy2:]] [[#Int32Ty]] [[#Const3]] [[#Const12]] [[#Const12]] [[#Const3]] |
| 24 | +; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#MatTy3:]] [[#Int8Ty]] [[#Const2]] [[#Const48]] [[#Const12]] [[#Const3]] |
| 25 | + |
| 26 | +; CHECK-SPIRV: CooperativeMatrixPrefetchINTEL |
| 27 | +; CHECK-SPIRV: CooperativeMatrixLoadKHR [[#MatTy1]] [[#Load1:]] |
| 28 | +; TODO: Pass Matrix Type Id instead of Matrix Id to CooperativeMatrixLengthKHR. |
| 29 | +; CHECK-SPIRV: CooperativeMatrixLengthKHR [[#Int32Ty]] [[#]] [[#Load1]] |
| 30 | +; CHECK-SPIRV: CompositeConstruct [[#MatTy2]] |
| 31 | +; CHECK-SPIRV: CooperativeMatrixPrefetchINTEL |
| 32 | +; CHECK-SPIRV: CooperativeMatrixLoadKHR [[#MatTy3]] |
| 33 | +; CHECK-SPIRV: CooperativeMatrixMulAddKHR [[#MatTy2]] |
| 34 | +; CHECK-SPIRV: CooperativeMatrixStoreKHR |
| 35 | + |
| 36 | +; CHECK-LLVM: call spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4siiiiiil(i16 addrspace(4)* %{{.*}}, i32 0, i32 0, i32 12, i32 48, i32 0, i32 0, i64 %_arg_1) |
| 37 | +; CHECK-LLVM: call spir_func %spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(1)* @_Z86__spirv_CooperativeMatrixLoadKHR_RPU3AS144__spirv_CooperativeMatrixKHR__char_0_12_48_3PU3AS4slii |
| 38 | +; CHECK-LLVM: call spir_func i32 @_Z34__spirv_CooperativeMatrixLengthKHRPU3AS144__spirv_CooperativeMatrixKHR__char_0_12_48_3(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(1)* |
| 39 | +; CHECK-LLVM: call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(1)* @_Z26__spirv_CompositeConstructi(i32 42) |
| 40 | +; CHECK-LLVM: call spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4ciiiiiil(i8 addrspace(4)* %{{.*}}, i32 0, i32 0, i32 12, i32 48, i32 0, i32 0, i64 %_arg_1) |
| 41 | +; CHECK-LLVM: call spir_func %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(1)* @_Z86__spirv_CooperativeMatrixLoadKHR_RPU3AS144__spirv_CooperativeMatrixKHR__char_2_48_12_3PU3AS4cl |
| 42 | +; CHECK-LLVM: call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(1)* @_Z34__spirv_CooperativeMatrixMulAddKHRPU3AS144__spirv_CooperativeMatrixKHR__char_0_12_48_3PU3AS144__spirv_CooperativeMatrixKHR__char_2_48_12_3PU3AS143__spirv_CooperativeMatrixKHR__int_3_12_12_3i(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(1)* %{{.*}}, %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(1)* %{{.*}}, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(1)* |
| 43 | +; CHECK-LLVM: call spir_func void @_Z33__spirv_CooperativeMatrixStoreKHRPU3AS4sPU3AS143__spirv_CooperativeMatrixKHR__int_3_12_12_3ili(i16 addrspace(4)* %add.ptr7.i, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(1)* |
| 44 | +; CHECK-LLVM: call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(1)* @_Z26__spirv_CompositeConstructi(i32 %zero) |
| 45 | + |
| 46 | +; ModuleID = 'test-matrix-opaque.bc' |
| 47 | +source_filename = "matrix-int8-test.cpp" |
| 48 | +target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 49 | +target triple = "spir64-unknown-unknown" |
| 50 | + |
| 51 | +%spirv.CooperativeMatrixKHR._int_3_12_12_3 = type { [12 x [12 x i32]]* } |
| 52 | +%spirv.CooperativeMatrixKHR._char_0_12_48_3 = type { [12 x [48 x i8]]* } |
| 53 | +%spirv.CooperativeMatrixKHR._char_2_48_12_3 = type { [48 x [12 x i8]]* } |
| 54 | + |
| 55 | +$_ZTSZ4mainE11matrix_test = comdat any |
| 56 | + |
| 57 | +@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32 |
| 58 | +@__spirv_BuiltInLocalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32 |
| 59 | + |
| 60 | +; Function Attrs: convergent norecurse |
| 61 | +define weak_odr dso_local spir_kernel void @_ZTSZ4mainE11matrix_test(i16 addrspace(1)* %_arg_, i64 %_arg_1, i8 addrspace(1)* %_arg_3, i8 addrspace(1)* %_arg_5) local_unnamed_addr #0 comdat !kernel_arg_buffer_location !5 !intel_reqd_sub_group_size !6 { |
| 62 | +entry: |
| 63 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInGlobalInvocationId to <3 x i64> addrspace(4)*), align 32, !noalias !7 |
| 64 | + %1 = extractelement <3 x i64> %0, i64 1 |
| 65 | + %2 = extractelement <3 x i64> %0, i64 0 |
| 66 | + %3 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInLocalInvocationId to <3 x i64> addrspace(4)*), align 32, !noalias !14 |
| 67 | + %4 = extractelement <3 x i64> %3, i64 1 |
| 68 | + %5 = extractelement <3 x i64> %3, i64 0 |
| 69 | + %cmp.i.i = icmp ult i64 %1, 2147483648 |
| 70 | + tail call void @llvm.assume(i1 %cmp.i.i) |
| 71 | + %cmp.i45.i = icmp ult i64 %2, 2147483648 |
| 72 | + tail call void @llvm.assume(i1 %cmp.i45.i) |
| 73 | + %cmp.i43.i = icmp ult i64 %4, 2147483648 |
| 74 | + tail call void @llvm.assume(i1 %cmp.i43.i) |
| 75 | + %sub.i = sub nsw i64 %1, %4 |
| 76 | + %cmp.i41.i = icmp ult i64 %5, 2147483648 |
| 77 | + tail call void @llvm.assume(i1 %cmp.i41.i) |
| 78 | + %sub5.i = sub nsw i64 %2, %5 |
| 79 | + %mul6.i = shl nsw i64 %sub.i, 6 |
| 80 | + %add.ptr.i51 = getelementptr inbounds i16, i16 addrspace(1)* %_arg_, i64 %mul6.i |
| 81 | + %add.ptr7.i52 = getelementptr inbounds i16, i16 addrspace(1)* %add.ptr.i51, i64 %sub5.i |
| 82 | + %add.ptr7.i = addrspacecast i16 addrspace(1)* %add.ptr7.i52 to i16 addrspace(4)* |
| 83 | + tail call spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4siiiiiil(i16 addrspace(4)* noundef %add.ptr7.i, i32 noundef 0, i32 noundef 0, i32 noundef 12, i32 noundef 48, i32 noundef 0, i32 noundef 0, i64 noundef %_arg_1) |
| 84 | + %call8.i = tail call spir_func %spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* @_Z32__spirv_CooperativeMatrixLoadKHR_1(i16 addrspace(4)* %add.ptr7.i, i64 %_arg_1, i32 0, i32 3) #3 |
| 85 | + %add.ptr11.i53 = getelementptr inbounds i8, i8 addrspace(1)* %_arg_3, i64 %mul6.i |
| 86 | + %add.ptr16.i55 = getelementptr inbounds i8, i8 addrspace(1)* %_arg_5, i64 %sub5.i |
| 87 | + %len = tail call spir_func noundef i32 @_Z34__spirv_CooperativeMatrixLengthKHR(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* %call8.i) |
| 88 | + |
| 89 | + %C.0.i = call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* @_Z26__spirv_CompositeConstruct(i32 42) #1 |
| 90 | + %add.ptr12.i54 = getelementptr inbounds i8, i8 addrspace(1)* %add.ptr11.i53, i64 0 |
| 91 | + %add.ptr12.i = addrspacecast i8 addrspace(1)* %add.ptr12.i54 to i8 addrspace(4)* |
| 92 | + tail call spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4ciiiiiil(i8 addrspace(4)* noundef %add.ptr12.i, i32 noundef 0, i32 noundef 0, i32 noundef 12, i32 noundef 48, i32 noundef 0, i32 noundef 0, i64 noundef %_arg_1) |
| 93 | + %call13.i = tail call spir_func %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(4)* @_Z32__spirv_CooperativeMatrixLoadKHR_2(i8 addrspace(4)* %add.ptr12.i, i64 %_arg_1) #3 |
| 94 | + %add.ptr17.i56 = getelementptr inbounds i8, i8 addrspace(1)* %add.ptr16.i55, i64 0 |
| 95 | + %add.ptr17.i = addrspacecast i8 addrspace(1)* %add.ptr17.i56 to i8 addrspace(4)* |
| 96 | + %call19.i = tail call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* @_Z34__spirv_CooperativeMatrixMulAddKHR(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* %call8.i, %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(4)* %call13.i, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* %C.0.i, i32 3) #3 |
| 97 | + tail call spir_func void @_Z33__spirv_CooperativeMatrixStoreKHR(i16 addrspace(4)* %add.ptr7.i, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* %C.0.i, i32 0, i64 %_arg_1, i32 3) #3 |
| 98 | + |
| 99 | + %ref.tmp = alloca i32, align 4 |
| 100 | + %ref.tmp.ascast = addrspacecast i32* %ref.tmp to i32 addrspace(4)* |
| 101 | + store i32 0, i32 addrspace(4)* %ref.tmp.ascast, align 4 |
| 102 | + %zero = load i32, i32 addrspace(4)* %ref.tmp.ascast, align 8 |
| 103 | + %C.0.i.new.load = call spir_func %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* @_Z26__spirv_CompositeConstruct(i32 %zero) #1 |
| 104 | + |
| 105 | + ret void |
| 106 | +} |
| 107 | + |
| 108 | +; Function Attrs: convergent |
| 109 | +declare dso_local spir_func noundef %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* @_Z26__spirv_CompositeConstruct(i32 noundef) local_unnamed_addr #2 |
| 110 | + |
| 111 | +; Function Attrs: convergent |
| 112 | +declare dso_local spir_func noundef i32 @_Z34__spirv_CooperativeMatrixLengthKHR(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* noundef) |
| 113 | + |
| 114 | +; Function Attrs: convergent |
| 115 | +declare dso_local spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4siiiiiil(i16 addrspace(4)* noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr |
| 116 | + |
| 117 | +; Function Attrs: convergent |
| 118 | +declare dso_local spir_func void @_Z38__spirv_CooperativeMatrixPrefetchINTELPU3AS4ciiiiiil(i8 addrspace(4)* noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr |
| 119 | + |
| 120 | +; Function Attrs: convergent |
| 121 | +declare dso_local spir_func noundef %spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* @_Z32__spirv_CooperativeMatrixLoadKHR_1(i16 addrspace(4)* noundef, i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2 |
| 122 | + |
| 123 | +; Function Attrs: convergent |
| 124 | +declare dso_local spir_func noundef %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(4)* @_Z32__spirv_CooperativeMatrixLoadKHR_2(i8 addrspace(4)* noundef, i64 noundef) local_unnamed_addr #2 |
| 125 | + |
| 126 | +; Function Attrs: convergent |
| 127 | +declare dso_local spir_func noundef %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* @_Z34__spirv_CooperativeMatrixMulAddKHR(%spirv.CooperativeMatrixKHR._char_0_12_48_3 addrspace(4)* noundef, %spirv.CooperativeMatrixKHR._char_2_48_12_3 addrspace(4)* noundef, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* noundef, i32 noundef) local_unnamed_addr #2 |
| 128 | + |
| 129 | +; Function Attrs: convergent |
| 130 | +declare dso_local spir_func void @_Z33__spirv_CooperativeMatrixStoreKHR(i16 addrspace(4)* noundef, %spirv.CooperativeMatrixKHR._int_3_12_12_3 addrspace(4)* noundef, i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #2 |
| 131 | + |
| 132 | +; Function Attrs: inaccessiblememonly nofree nosync nounwind willreturn |
| 133 | +declare void @llvm.assume(i1 noundef) #2 |
| 134 | + |
| 135 | +attributes #0 = { convergent norecurse "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="./joint_matrix_test.cpp" "uniform-work-group-size"="true" } |
| 136 | +attributes #1 = { convergent "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 137 | +attributes #2 = { inaccessiblememonly nofree nosync nounwind willreturn } |
| 138 | +attributes #3 = { convergent } |
| 139 | + |
| 140 | +!llvm.module.flags = !{!0, !1} |
| 141 | +!opencl.spir.version = !{!2} |
| 142 | +!spirv.Source = !{!3} |
| 143 | +!llvm.ident = !{!4} |
| 144 | + |
| 145 | +!0 = !{i32 1, !"wchar_size", i32 4} |
| 146 | +!1 = !{i32 7, !"frame-pointer", i32 2} |
| 147 | +!2 = !{i32 1, i32 2} |
| 148 | +!3 = !{i32 4, i32 100000} |
| 149 | +!4 = !{!"clang version 13.0.0 (https://github.com/intel/llvm.git b3243d9f711a1cd80681530d6017324796668d51)"} |
| 150 | +!5 = !{i32 -1, i32 -1, i32 -1, i32 -1} |
| 151 | +!6 = !{i32 16} |
| 152 | +!7 = !{!8, !10, !12} |
| 153 | +!8 = distinct !{!8, !9, !"_ZN7__spirv29InitSizesSTGlobalInvocationIdILi2EN2cl4sycl2idILi2EEEE8initSizeEv: %agg.result"} |
| 154 | +!9 = distinct !{!9, !"_ZN7__spirv29InitSizesSTGlobalInvocationIdILi2EN2cl4sycl2idILi2EEEE8initSizeEv"} |
| 155 | +!10 = distinct !{!10, !11, !"_ZN7__spirvL22initGlobalInvocationIdILi2EN2cl4sycl2idILi2EEEEET0_v: %agg.result"} |
| 156 | +!11 = distinct !{!11, !"_ZN7__spirvL22initGlobalInvocationIdILi2EN2cl4sycl2idILi2EEEEET0_v"} |
| 157 | +!12 = distinct !{!12, !13, !"_ZN2cl4sycl6detail7Builder10getElementILi2EEEKNS0_7nd_itemIXT_EEEPS5_: %agg.result"} |
| 158 | +!13 = distinct !{!13, !"_ZN2cl4sycl6detail7Builder10getElementILi2EEEKNS0_7nd_itemIXT_EEEPS5_"} |
| 159 | +!14 = !{!15, !17, !12} |
| 160 | +!15 = distinct !{!15, !16, !"_ZN7__spirv28InitSizesSTLocalInvocationIdILi2EN2cl4sycl2idILi2EEEE8initSizeEv: %agg.result"} |
| 161 | +!16 = distinct !{!16, !"_ZN7__spirv28InitSizesSTLocalInvocationIdILi2EN2cl4sycl2idILi2EEEE8initSizeEv"} |
| 162 | +!17 = distinct !{!17, !18, !"_ZN7__spirvL21initLocalInvocationIdILi2EN2cl4sycl2idILi2EEEEET0_v: %agg.result"} |
| 163 | +!18 = distinct !{!18, !"_ZN7__spirvL21initLocalInvocationIdILi2EN2cl4sycl2idILi2EEEEET0_v"} |
| 164 | +!19 = distinct !{!19, !20, !21} |
| 165 | +!20 = !{!"llvm.loop.mustprogress"} |
| 166 | +!21 = !{!"llvm.loop.unroll.disable"} |
0 commit comments