| 1 |
;; Can be compiled using https://github.com/intel/llvm SYCL compiler from: |
| 2 |
;; class Foo { |
| 3 |
;; public: |
| 4 |
;; [[intel::no_global_work_offset, |
| 5 |
;; intel::max_global_work_dim(1), |
| 6 |
;; intel::max_work_group_size(1,1,1), |
| 7 |
;; intel::num_simd_work_items(8), |
| 8 |
;; intel::stall_enable, |
| 9 |
;; intel::scheduler_target_fmax_mhz(1000), |
| 10 |
;; intel::loop_fuse_independent(3), |
| 11 |
;; intel::initiation_interval(10), |
| 12 |
;; intel::max_concurrency(12), |
| 13 |
;; intel::disable_loop_pipelining]] void operator()() {} |
| 14 |
;; }; |
| 15 |
;; |
| 16 |
;; template <typename name, typename Func> |
| 17 |
;; __attribute__((sycl_kernel)) void kernel(Func kernelFunc) { |
| 18 |
;; kernelFunc(); |
| 19 |
;; } |
| 20 |
;; |
| 21 |
;; void bar() { |
| 22 |
;; Foo boo; |
| 23 |
;; kernel<class kernel_name>(boo); |
| 24 |
;; kernel<class kernel_name2>([]() [[intel::no_global_work_offset(0)]]{}); |
| 25 |
;; } |
| 26 |
|
| 27 |
; UNSUPPORTED: system-windows |
| 28 |
; REQUIRES: llvm-spirv, regkeys, dg2-supported |
| 29 |
|
| 30 |
; RUN: llvm-as %s -o %t.bc |
| 31 |
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_kernel_attributes,+SPV_INTEL_fpga_cluster_attributes,+SPV_INTEL_loop_fuse,+SPV_INTEL_fpga_invocation_pipelining_attributes -o %t.spv |
| 32 |
; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM |
| 33 |
|
| 34 |
; CHECK-LLVM: define spir_kernel void {{.*}}kernel_name() |
| 35 |
; CHECK-LLVM-SAME: !stall_enable ![[ONEMD:[0-9]+]] !loop_fuse ![[FUSE:[0-9]+]] |
| 36 |
; CHECK-LLVM-SAME: !initiation_interval ![[II:[0-9]+]] |
| 37 |
; CHECK-LLVM-SAME: !max_concurrency ![[MAXCON:[0-9]+]] |
| 38 |
; CHECK-LLVM-SAME: !disable_loop_pipelining ![[ONEMD]] |
| 39 |
; CHECK-LLVM-SAME: !max_work_group_size ![[MAXWG:[0-9]+]] |
| 40 |
; CHECK-LLVM-SAME: !no_global_work_offset ![[OFFSET:[0-9]+]] |
| 41 |
; CHECK-LLVM-SAME: !max_global_work_dim ![[ONEMD]] !num_simd_work_items ![[NUMSIMD:[0-9]+]] |
| 42 |
; CHECK-LLVM-SAME: !scheduler_target_fmax_mhz ![[MAXMHZ:[0-9]+]] |
| 43 |
; CHECK-LLVM-NOT: define spir_kernel void {{.*}}kernel_name2 {{.*}} !no_global_work_offset {{.*}} |
| 44 |
; CHECK-LLVM: define spir_kernel void {{.*}}kernel_name3() |
| 45 |
; CHECK-LLVM-SAME: !disable_loop_pipelining ![[ONEMD2:[0-9]+]] |
| 46 |
; CHECK-LLVM: ![[OFFSET]] = !{} |
| 47 |
; CHECK-LLVM: ![[ONEMD]] = !{i32 1} |
| 48 |
; CHECK-LLVM: ![[FUSE]] = !{i32 3, i32 1} |
| 49 |
; CHECK-LLVM: ![[II]] = !{i32 10} |
| 50 |
; CHECK-LLVM: ![[MAXCON]] = !{i32 12} |
| 51 |
; CHECK-LLVM: ![[MAXWG]] = !{i32 1, i32 1, i32 1} |
| 52 |
; CHECK-LLVM: ![[NUMSIMD]] = !{i32 8} |
| 53 |
; CHECK-LLVM: ![[MAXMHZ]] = !{i32 1000} |
| 54 |
; CHECK-LLVM: ![[ONEMD2]] = !{i32 0} |
| 55 |
|
| 56 |
; ModuleID = 'kernel-attrs.cpp' |
| 57 |
source_filename = "kernel-attrs.cpp" |
| 58 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 59 |
target triple = "spir64-unknown-linux" |
| 60 |
|
| 61 |
%class._ZTS3Foo.Foo = type { i8 } |
| 62 |
%"class._ZTSZ3barvE3$_0.anon" = type { i8 } |
| 63 |
|
| 64 |
$_ZN3FooclEv = comdat any |
| 65 |
|
| 66 |
; Function Attrs: nounwind |
| 67 |
define spir_kernel void @_ZTSZ3barvE11kernel_name() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 !num_simd_work_items !5 !max_work_group_size !6 !max_global_work_dim !7 !no_global_work_offset !4 !stall_enable !7 !scheduler_target_fmax_mhz !12 !loop_fuse !13 !initiation_interval !14 !max_concurrency !15 !disable_loop_pipelining !7 { |
| 68 |
entry: |
| 69 |
%Foo = alloca %class._ZTS3Foo.Foo, align 1 |
| 70 |
%0 = bitcast %class._ZTS3Foo.Foo* %Foo to i8* |
| 71 |
call void @llvm.lifetime.start.p0i8(i64 1, i8* %0) #4 |
| 72 |
%1 = addrspacecast %class._ZTS3Foo.Foo* %Foo to %class._ZTS3Foo.Foo addrspace(4)* |
| 73 |
call spir_func void @_ZN3FooclEv(%class._ZTS3Foo.Foo addrspace(4)* %1) |
| 74 |
%2 = bitcast %class._ZTS3Foo.Foo* %Foo to i8* |
| 75 |
call void @llvm.lifetime.end.p0i8(i64 1, i8* %2) #4 |
| 76 |
ret void |
| 77 |
} |
| 78 |
|
| 79 |
; Function Attrs: argmemonly nounwind willreturn |
| 80 |
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1 |
| 81 |
|
| 82 |
; Function Attrs: nounwind |
| 83 |
define linkonce_odr spir_func void @_ZN3FooclEv(%class._ZTS3Foo.Foo addrspace(4)* %this) #2 comdat align 2 { |
| 84 |
entry: |
| 85 |
%this.addr = alloca %class._ZTS3Foo.Foo addrspace(4)*, align 8 |
| 86 |
store %class._ZTS3Foo.Foo addrspace(4)* %this, %class._ZTS3Foo.Foo addrspace(4)** %this.addr, align 8, !tbaa !8 |
| 87 |
%this1 = load %class._ZTS3Foo.Foo addrspace(4)*, %class._ZTS3Foo.Foo addrspace(4)** %this.addr, align 8 |
| 88 |
ret void |
| 89 |
} |
| 90 |
|
| 91 |
; Function Attrs: argmemonly nounwind willreturn |
| 92 |
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 |
| 93 |
; Function Attrs: nounwind |
| 94 |
define spir_kernel void @_ZTSZ3barvE12kernel_name2() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 { |
| 95 |
entry: |
| 96 |
%0 = alloca %"class._ZTSZ3barvE3$_0.anon", align 1 |
| 97 |
%1 = bitcast %"class._ZTSZ3barvE3$_0.anon"* %0 to i8* |
| 98 |
call void @llvm.lifetime.start.p0i8(i64 1, i8* %1) #4 |
| 99 |
%2 = addrspacecast %"class._ZTSZ3barvE3$_0.anon"* %0 to %"class._ZTSZ3barvE3$_0.anon" addrspace(4)* |
| 100 |
call spir_func void @"_ZZ3barvENK3$_0clEv"(%"class._ZTSZ3barvE3$_0.anon" addrspace(4)* %2) |
| 101 |
%3 = bitcast %"class._ZTSZ3barvE3$_0.anon"* %0 to i8* |
| 102 |
call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4 |
| 103 |
ret void |
| 104 |
} |
| 105 |
; Function Attrs: inlinehint nounwind |
| 106 |
define internal spir_func void @"_ZZ3barvENK3$_0clEv"(%"class._ZTSZ3barvE3$_0.anon" addrspace(4)* %this) #3 align 2 { |
| 107 |
entry: |
| 108 |
%this.addr = alloca %"class._ZTSZ3barvE3$_0.anon" addrspace(4)*, align 8 |
| 109 |
store %"class._ZTSZ3barvE3$_0.anon" addrspace(4)* %this, %"class._ZTSZ3barvE3$_0.anon" addrspace(4)** %this.addr, align 8, !tbaa !8 |
| 110 |
%this1 = load %"class._ZTSZ3barvE3$_0.anon" addrspace(4)*, %"class._ZTSZ3barvE3$_0.anon" addrspace(4)** %this.addr, align 8 |
| 111 |
ret void |
| 112 |
} |
| 113 |
|
| 114 |
; Function Attrs: nounwind |
| 115 |
define spir_kernel void @_ZTSZ3barvE11kernel_name3() #0 !disable_loop_pipelining !16 { |
| 116 |
entry: |
| 117 |
%Foo = alloca %class._ZTS3Foo.Foo, align 1 |
| 118 |
%0 = bitcast %class._ZTS3Foo.Foo* %Foo to i8* |
| 119 |
call void @llvm.lifetime.start.p0i8(i64 1, i8* %0) #4 |
| 120 |
%1 = addrspacecast %class._ZTS3Foo.Foo* %Foo to %class._ZTS3Foo.Foo addrspace(4)* |
| 121 |
call spir_func void @_ZN3FooclEv(%class._ZTS3Foo.Foo addrspace(4)* %1) |
| 122 |
%2 = bitcast %class._ZTS3Foo.Foo* %Foo to i8* |
| 123 |
call void @llvm.lifetime.end.p0i8(i64 1, i8* %2) #4 |
| 124 |
ret void |
| 125 |
} |
| 126 |
|
| 127 |
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "sycl-module-id"="kernel-attrs.cpp" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 128 |
attributes #1 = { argmemonly nounwind willreturn } |
| 129 |
attributes #2 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 130 |
attributes #3 = { inlinehint nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 131 |
attributes #4 = { nounwind } |
| 132 |
|
| 133 |
!llvm.module.flags = !{!0} |
| 134 |
!opencl.spir.version = !{!1} |
| 135 |
!spirv.Source = !{!2} |
| 136 |
!llvm.ident = !{!3} |
| 137 |
|
| 138 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 139 |
!1 = !{i32 1, i32 2} |
| 140 |
!2 = !{i32 4, i32 100000} |
| 141 |
!3 = !{!"clang version 11.0.0"} |
| 142 |
!4 = !{} |
| 143 |
!5 = !{i32 8} |
| 144 |
!6 = !{i32 1, i32 1, i32 1} |
| 145 |
!7 = !{i32 1} |
| 146 |
!8 = !{!9, !9, i64 0} |
| 147 |
!9 = !{!"any pointer", !10, i64 0} |
| 148 |
!10 = !{!"omnipotent char", !11, i64 0} |
| 149 |
!11 = !{!"Simple C++ TBAA"} |
| 150 |
!12 = !{i32 1000} |
| 151 |
!13 = !{i32 3, i32 1} |
| 152 |
!14 = !{i32 10} |
| 153 |
!15 = !{i32 12} |
| 154 |
!16 = !{i32 0} |