-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ESIMD] Add set_kernel_properties API and use_double_grf property.
This patch: 1) Adds esimd::set_kernel_properties API with the single supported property esimd::kernel_properties::use_double_grf, which lets compiler know that the calling kernel needs run in "double GRF" mode - more registers per thread at the expense of fewer H/W threads. This is temporary API until generic SYCL support for kernel properties is implemented: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_kernel_properties.asciidoc 2) Provides "lowering" of this API by the LowerESIMD.cpp, which marks such kernels with "esimd-double-grf" function attribute. 3) Implements new "dimension" of device code splitting in sycl-post-link: functions with and without "esimd-double-grf" attribute go to different modules. Device binary images resulting from "double-grf" modules are assigned the "isDoubleGRFEsimdImage" property 4) Updates runtime to add "-doubleGRF" option when JITting SPIRV binaries with the "isDoubleGRFEsimdImage" property. 5) Fixes sycl-post-link bug in ModuleSplitter.cpp:extractSubModule, where Function objects in the entry point list were not replaced with new Function objects in the cloned Module. This lead to corrupted symbol file in some cases. Signed-off-by: Konstantin S Bobrovsky <konstantin.s.bobrovsky@intel.com>
- Loading branch information
Showing
9 changed files
with
435 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-double-grf.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
; This test checks handling of the | ||
; set_kernel_properties(kernel_properties::use_double_grf); | ||
; by the post-link-tool: | ||
; - ESIMD/SYCL splitting happens as usual | ||
; - ESIMD module is further split into callgraphs for entry points requesting | ||
; "double GRF" and callgraphs for entry points which are not | ||
; - Compiler adds 'isDoubleGRFEsimdImage' property to the ESIMD device binary | ||
; images requesting "double GRF" | ||
|
||
; RUN: sycl-post-link -split=source -symbols -split-esimd -lower-esimd -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_esimd_x2grf_0.ll --check-prefixes CHECK-ESIMD-2xGRF-IR | ||
; RUN: FileCheck %s -input-file=%t_esimd_x2grf_0.prop --check-prefixes CHECK-ESIMD-2xGRF-PROP | ||
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-SYCL-SYM | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.sym --check-prefixes CHECK-ESIMD-SYM | ||
; RUN: FileCheck %s -input-file=%t_esimd_x2grf_0.sym --check-prefixes CHECK-ESIMD-2xGRF-SYM | ||
|
||
; CHECK: [Code|Properties|Symbols] | ||
; CHECK: {{.*}}esimd_0.ll|{{.*}}esimd_0.prop|{{.*}}esimd_0.sym | ||
; CHECK: {{.*}}esimd_x2grf_0.ll|{{.*}}esimd_x2grf_0.prop|{{.*}}esimd_x2grf_0.sym | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym | ||
|
||
; CHECK-ESIMD-2xGRF-PROP: isEsimdImage=1|1 | ||
; CHECK-ESIMD-2xGRF-PROP: isDoubleGRFEsimdImage=1|1 | ||
|
||
; CHECK-SYCL-SYM: __SYCL_kernel | ||
; CHECK-SYCL-SYM-EMPTY: | ||
|
||
; CHECK-ESIMD-SYM: __ESIMD_kernel | ||
; CHECK-ESIMD-SYM-EMPTY: | ||
|
||
; CHECK-ESIMD-2xGRF-SYM: __ESIMD_double_grf_kernel | ||
; CHECK-ESIMD-2xGRF-SYM-EMPTY: | ||
|
||
; ModuleID = 'double_grf.bc' | ||
source_filename = "llvm-link" | ||
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" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
define weak_odr dso_local spir_kernel void @__SYCL_kernel() #0 { | ||
entry: | ||
ret void | ||
} | ||
|
||
define weak_odr dso_local spir_kernel void @__ESIMD_kernel() #0 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 { | ||
entry: | ||
ret void | ||
} | ||
|
||
define dso_local spir_func void @_Z17double_grf_markerv() { | ||
entry: | ||
call spir_func void @_Z29__esimd_set_kernel_propertiesi(i32 noundef 0) | ||
; -- Check that ESIMD lowering removed the marker call above: | ||
; CHECK-ESIMD-2xGRF-IR-NOT: {{.*}} @_Z29__esimd_set_kernel_propertiesi | ||
ret void | ||
} | ||
|
||
declare dso_local spir_func void @_Z29__esimd_set_kernel_propertiesi(i32 noundef) | ||
|
||
define weak_odr dso_local spir_kernel void @__ESIMD_double_grf_kernel() #0 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 { | ||
entry: | ||
call spir_func void @_Z17double_grf_markerv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
|
||
!0 = !{} | ||
!1 = !{i32 1} |
Oops, something went wrong.