|
| 1 | +; This test checks that the post-link tool properly generates "assert used" |
| 2 | +; property - it should include only kernels that call assertions in their call |
| 3 | +; graph. |
| 4 | + |
| 5 | +; RUN: sycl-post-link -split=auto -symbols -S %s -o %t.table |
| 6 | +; RUN: FileCheck %s -input-file=%t_0.prop |
| 7 | + |
| 8 | +; SYCL source: |
| 9 | +; void foo() { |
| 10 | +; assert(0); |
| 11 | +; } |
| 12 | +; void bar() { |
| 13 | +; assert(1); |
| 14 | +; } |
| 15 | +; void baz() { |
| 16 | +; foo(); |
| 17 | +; } |
| 18 | +; |
| 19 | +; int main() { |
| 20 | +; queue Q; |
| 21 | +; Q.submit([&] (handler& CGH) { |
| 22 | +; CGH.parallel_for<class TheKernel>(range<2>{2, 10}, [=](item<2> It) { |
| 23 | +; foo(); |
| 24 | +; }); |
| 25 | +; CGH.parallel_for<class TheKernel2>(range<2>{2, 10}, [=](item<2> It) { |
| 26 | +; bar(); |
| 27 | +; }); |
| 28 | +; CGH.parallel_for<class TheKernel3>(range<2>{2, 10}, [=](item<2> It) { |
| 29 | +; baz(); |
| 30 | +; bar(); |
| 31 | +; }); |
| 32 | +; }); |
| 33 | +; Q.wait(); |
| 34 | +; return 0; |
| 35 | +; } |
| 36 | + |
| 37 | +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" |
| 38 | +target triple = "spir64_x86_64-unknown-unknown-sycldevice" |
| 39 | + |
| 40 | +%"class._ZTSN2cl4sycl5rangeILi2EEE.cl::sycl::range" = type { %"class._ZTSN2cl4sycl6detail5arrayILi2EEE.cl::sycl::detail::array" } |
| 41 | +%"class._ZTSN2cl4sycl6detail5arrayILi2EEE.cl::sycl::detail::array" = type { [2 x i64] } |
| 42 | +%"class._ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEEUlNS1_4itemILi2ELb1EEEE_.anon" = type { i8 } |
| 43 | + |
| 44 | +@.str = private unnamed_addr addrspace(1) constant [2 x i8] c"0\00", align 1 |
| 45 | +@.str.1 = private unnamed_addr addrspace(1) constant [11 x i8] c"assert.cpp\00", align 1 |
| 46 | +@__PRETTY_FUNCTION__._Z3foov = private unnamed_addr addrspace(1) constant [11 x i8] c"void foo()\00", align 1 |
| 47 | +@__spirv_BuiltInGlobalInvocationId = external dso_local addrspace(1) constant <3 x i64>, align 32 |
| 48 | +@__spirv_BuiltInLocalInvocationId = external dso_local addrspace(1) constant <3 x i64>, align 32 |
| 49 | +@_ZL10assert_fmt = internal addrspace(2) constant [85 x i8] c"%s:%d: %s: global id: [%lu,%lu,%lu], local id: [%lu,%lu,%lu] Assertion `%s` failed.\0A\00", align 1 |
| 50 | + |
| 51 | +; CHECK: [SYCL/assert used] |
| 52 | + |
| 53 | +; Function Attrs: convergent norecurse nounwind mustprogress |
| 54 | +define dso_local spir_func void @_Z3foov() { |
| 55 | +entry: |
| 56 | + tail call spir_func void @__assert_fail(i8 addrspace(4)* getelementptr inbounds ([2 x i8], [2 x i8] addrspace(4)* addrspacecast ([2 x i8] addrspace(1)* @.str to [2 x i8] addrspace(4)*), i64 0, i64 0), i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @.str.1 to [11 x i8] addrspace(4)*), i64 0, i64 0), i32 8, i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @__PRETTY_FUNCTION__._Z3foov to [11 x i8] addrspace(4)*), i64 0, i64 0)) |
| 57 | + ret void |
| 58 | +} |
| 59 | + |
| 60 | +; CHECK: _ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE9TheKernel |
| 61 | +; Function Attrs: convergent norecurse |
| 62 | +define weak_odr dso_local spir_kernel void @"_ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE9TheKernel"() #0 { |
| 63 | +entry: |
| 64 | + call spir_func void @_Z3foov() |
| 65 | + ret void |
| 66 | +} |
| 67 | + |
| 68 | +; Function Attrs: nofree norecurse nosync nounwind readnone willreturn mustprogress |
| 69 | +define dso_local spir_func void @_Z3barv() { |
| 70 | +entry: |
| 71 | + ret void |
| 72 | +} |
| 73 | + |
| 74 | +; CHECK-NOT: _ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE10TheKernel2 |
| 75 | +; Function Attrs: norecurse |
| 76 | +define weak_odr dso_local spir_kernel void @"_ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE10TheKernel2"() #1 { |
| 77 | +entry: |
| 78 | + call spir_func void @_Z3barv() |
| 79 | + ret void |
| 80 | +} |
| 81 | + |
| 82 | +; Function Attrs: convergent inlinehint norecurse nounwind mustprogress |
| 83 | +define internal spir_func void @"_ZZZ4mainENK3$_0clERN2cl4sycl7handlerEENKUlNS1_4itemILi2ELb1EEEE1_clES5_"() unnamed_addr #8 align 2 { |
| 84 | +entry: |
| 85 | + call spir_func void @_Z3bazv() |
| 86 | + call spir_func void @_Z3barv() |
| 87 | + ret void |
| 88 | +} |
| 89 | + |
| 90 | +; Function Attrs: convergent norecurse nounwind mustprogress |
| 91 | +define dso_local spir_func void @_Z3bazv() { |
| 92 | +entry: |
| 93 | + tail call spir_func void @__assert_fail(i8 addrspace(4)* getelementptr inbounds ([2 x i8], [2 x i8] addrspace(4)* addrspacecast ([2 x i8] addrspace(1)* @.str to [2 x i8] addrspace(4)*), i64 0, i64 0), i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @.str.1 to [11 x i8] addrspace(4)*), i64 0, i64 0), i32 8, i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @__PRETTY_FUNCTION__._Z3foov to [11 x i8] addrspace(4)*), i64 0, i64 0)) |
| 94 | + ret void |
| 95 | +} |
| 96 | + |
| 97 | +; CHECK: _ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE10TheKernel3 |
| 98 | +; Function Attrs: convergent norecurse |
| 99 | +define weak_odr dso_local spir_kernel void @"_ZTSZZ4mainENK3$_0clERN2cl4sycl7handlerEE10TheKernel3"() #0 { |
| 100 | +entry: |
| 101 | + call spir_func void @"_ZZZ4mainENK3$_0clERN2cl4sycl7handlerEENKUlNS1_4itemILi2ELb1EEEE1_clES5_"() |
| 102 | + ret void |
| 103 | +} |
| 104 | + |
| 105 | +; Function Attrs: convergent norecurse mustprogress |
| 106 | +define weak dso_local spir_func void @__assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func) { |
| 107 | +entry: |
| 108 | + %call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
| 109 | + %call1 = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_yv() |
| 110 | + %call2 = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_zv() |
| 111 | + %call3 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_xv() |
| 112 | + %call4 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_yv() |
| 113 | + %call5 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_zv() |
| 114 | + tail call spir_func void @__devicelib_assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %call, i64 %call1, i64 %call2, i64 %call3, i64 %call4, i64 %call5) |
| 115 | + ret void |
| 116 | +} |
| 117 | + |
| 118 | +; Function Attrs: inlinehint norecurse mustprogress |
| 119 | +declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() local_unnamed_addr |
| 120 | + |
| 121 | +; Function Attrs: inlinehint norecurse mustprogress |
| 122 | +declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_yv() local_unnamed_addr |
| 123 | + |
| 124 | +; Function Attrs: inlinehint norecurse mustprogress |
| 125 | +declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_zv() local_unnamed_addr |
| 126 | + |
| 127 | +; Function Attrs: inlinehint norecurse mustprogress |
| 128 | +declare dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_xv() local_unnamed_addr |
| 129 | + |
| 130 | +; Function Attrs: inlinehint norecurse mustprogress |
| 131 | +declare dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_yv() local_unnamed_addr |
| 132 | + |
| 133 | +; Function Attrs: inlinehint norecurse mustprogress |
| 134 | +declare dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_zv() local_unnamed_addr |
| 135 | + |
| 136 | +; Function Attrs: convergent norecurse mustprogress |
| 137 | +define weak dso_local spir_func void @__devicelib_assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %gid0, i64 %gid1, i64 %gid2, i64 %lid0, i64 %lid1, i64 %lid2) { |
| 138 | +entry: |
| 139 | + %call = tail call spir_func i32 (i8 addrspace(2)*, ...) @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)* getelementptr inbounds ([85 x i8], [85 x i8] addrspace(2)* @_ZL10assert_fmt, i64 0, i64 0), i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %gid0, i64 %gid1, i64 %gid2, i64 %lid0, i64 %lid1, i64 %lid2, i8 addrspace(4)* %expr) |
| 140 | + ret void |
| 141 | +} |
| 142 | + |
| 143 | +; Function Attrs: convergent |
| 144 | +declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)*, ...) |
| 145 | + |
| 146 | +attributes #0 = { convergent norecurse "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="assert.cpp" "uniform-work-group-size"="true" } |
| 147 | +attributes #1 = { norecurse "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="assert.cpp" "uniform-work-group-size"="true" } |
| 148 | + |
| 149 | +!opencl.spir.version = !{!0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0} |
| 150 | +!spirv.Source = !{!1, !1, !1, !1, !1, !1, !1, !1, !1, !1, !1} |
| 151 | +!llvm.ident = !{!2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2} |
| 152 | +!llvm.module.flags = !{!3, !4} |
| 153 | + |
| 154 | +!0 = !{i32 1, i32 2} |
| 155 | +!1 = !{i32 4, i32 100000} |
| 156 | +!2 = !{!"clang version 13.0.0 (https://github.com/intel/llvm)"} |
| 157 | +!3 = !{i32 1, !"wchar_size", i32 4} |
| 158 | +!4 = !{i32 7, !"frame-pointer", i32 2} |
| 159 | +!5 = !{i32 -1, i32 -1} |
0 commit comments