Skip to content

Commit be96ea6

Browse files
committed
[SYCL][ESIMD] Don't add RegisterAllocMode metadata for ESIMD kernels
This works around a VC issue. Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
1 parent c5c7ac2 commit be96ea6

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

llvm/lib/SYCLLowerIR/LowerKernelProps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ void processSetKernelPropertiesCall(CallInst &CI) {
5050
GraphNode->addFnAttr(::sycl::kernel_props::ATTR_LARGE_GRF);
5151
// Add RegisterAllocMode metadata with arg 2 to the kernel to tell
5252
// IGC to compile this kernel in large GRF mode. 2 means large.
53-
if (GraphNode->getCallingConv() == CallingConv::SPIR_KERNEL) {
53+
if (GraphNode->getCallingConv() == CallingConv::SPIR_KERNEL &&
54+
!GraphNode->hasMetadata("sycl_explicit_simd")) {
5455
auto &Ctx = GraphNode->getContext();
5556
Metadata *AttrMDArgs[] = {ConstantAsMetadata::get(
5657
Constant::getIntegerValue(Type::getInt32Ty(Ctx), APInt(32, 2)))};

llvm/test/SYCLLowerIR/lower_kernel_props.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; - remove the intrinsic call
66
; - mark the kernel with corresponding attribute (only "large-grf" for now)
77

8-
; RUN: opt -passes=lower-kernel-props -S %s -o - | FileCheck %s
8+
; RUN: opt -passes=lower-kernel-props -S %s -o - | FileCheck %s --implicit-check-not='RegisterAllocMode'
99

1010
; ModuleID = 'large_grf.bc'
1111
source_filename = "llvm-link"
@@ -33,8 +33,7 @@ define weak_odr dso_local spir_kernel void @__large_grf_kernel1() !sycl_explicit
3333

3434
; -- This kernel calls the marker function directly
3535
define weak_odr dso_local spir_kernel void @__large_grf_kernel2() #0 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 {
36-
; CHECK: {{.*}} spir_kernel void @__large_grf_kernel2() #0 {{.*}} !RegisterAllocMode ![[MetadataArg:[0-9]+]]
37-
; CHECK: ![[MetadataArg]] = !{i32 2}
36+
; CHECK: {{.*}} spir_kernel void @__large_grf_kernel2() #0 {{.*}}
3837
call spir_func void @_Z28__sycl_set_kernel_propertiesi(i32 noundef 0)
3938
ret void
4039
}

llvm/test/tools/sycl-post-link/sycl-esimd-large-grf.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
; RUN: sycl-post-link -split=source -symbols -split-esimd -lower-esimd -S < %s -o %t.table
1111
; RUN: FileCheck %s -input-file=%t.table
12-
; RUN: FileCheck %s -input-file=%t_esimd_large_grf_0.ll --check-prefixes CHECK-ESIMD-LargeGRF-IR
12+
; RUN: FileCheck %s -input-file=%t_esimd_large_grf_0.ll --check-prefixes CHECK-ESIMD-LargeGRF-IR --implicit-check-not='RegisterAllocMode'
1313
; RUN: FileCheck %s -input-file=%t_esimd_large_grf_0.prop --check-prefixes CHECK-ESIMD-LargeGRF-PROP
1414
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYCL-SYM
1515
; RUN: FileCheck %s -input-file=%t_esimd_1.sym --check-prefixes CHECK-ESIMD-SYM
@@ -58,8 +58,7 @@ entry:
5858
declare dso_local spir_func void @_Z28__sycl_set_kernel_propertiesi(i32 noundef)
5959

6060
define weak_odr dso_local spir_kernel void @__ESIMD_large_grf_kernel() #0 !sycl_explicit_simd !0 !intel_reqd_sub_group_size !1 {
61-
; CHECK-ESIMD-LargeGRF-IR: @__ESIMD_large_grf_kernel() {{.*}} !RegisterAllocMode ![[MetadataArg:[0-9]+]]
62-
; CHECK-ESIMD-LargeGRF-IR: ![[MetadataArg]] = !{i32 2}
61+
; CHECK-ESIMD-LargeGRF-IR: @__ESIMD_large_grf_kernel() {{.*}}
6362
entry:
6463
call spir_func void @_Z17large_grf_markerv()
6564
ret void

0 commit comments

Comments
 (0)