Skip to content

Commit efcfa2b

Browse files
authored
[SYCL] Don't assert for unsupported GRF sizes in CompileTimePropertiesPass (#12503)
It's already checked up-front at compile time in the SYCL headers. I can provide more background for this change offline if required. --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent c1c9184 commit efcfa2b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,10 @@ attributeToExecModeMetadata(const Attribute &Attr, Function &F) {
444444
// TODO: Remove SYCL_REGISTER_ALLOC_MODE_ATTR support in next ABI break.
445445
uint32_t PropVal = getAttributeAsInteger<uint32_t>(Attr);
446446
if (AttrKindStr == SYCL_GRF_SIZE_ATTR) {
447-
assert((PropVal == 0 || PropVal == 128 || PropVal == 256) &&
448-
"Unsupported GRF Size");
447+
// The RegisterAllocMode metadata supports only 0, 128, and 256 for
448+
// PropVal.
449+
if (PropVal != 0 && PropVal != 128 && PropVal != 256)
450+
return std::nullopt;
449451
// Map sycl-grf-size values to RegisterAllocMode values used in SPIR-V.
450452
static constexpr int SMALL_GRF_REGALLOCMODE_VAL = 1;
451453
static constexpr int LARGE_GRF_REGALLOCMODE_VAL = 2;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; Check we don't assert for different GRF values and don't add the RegisterAllocMode metadata
2+
; RUN: opt -passes=compile-time-properties %s -S | FileCheck %s --implicit-check-not=RegisterAllocMode
3+
4+
; CHECK: spir_kernel void @foo()
5+
define weak_odr dso_local spir_kernel void @foo() #0 {
6+
entry:
7+
ret void
8+
}
9+
10+
attributes #0 = { convergent mustprogress norecurse nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-grf-size"="16384" "sycl-module-id"="main.cpp" "sycl-optlevel"="2" "uniform-work-group-size"="true" }

0 commit comments

Comments
 (0)