Skip to content

Commit 9877738

Browse files
PawelJurekpszymich
authored andcommitted
Do not promote RT_GLOBAL_BUFFER implicit argument to stateful
RT_GLOBAL_BUFFER is not supported as stateful in runtime. Do not promote this implicit buffer in StatelessToStateful optimisation.
1 parent cdf47ea commit 9877738

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

IGC/Compiler/Optimizer/OpenCLPasses/StatelessToStateful/StatelessToStateful.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ bool StatelessToStateful::pointerIsPositiveOffsetFromKernelArgument(
410410
arg->getArgType() == KernelArg::ArgType::IMPLICIT_SYNC_BUFFER)
411411
return false;
412412

413+
// RT_GLOBAL_BUFFER is supported only in stateless mode by the runtime.
414+
if (arg->getArgType() == KernelArg::ArgType::IMPLICIT_RT_GLOBAL_BUFFER) {
415+
return false;
416+
}
417+
413418
argNumber = arg->getAssociatedArgNo();
414419
bool gepProducesPositivePointer = true;
415420

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
;=========================== begin_copyright_notice ============================
2+
;
3+
; Copyright (C) 2023 Intel Corporation
4+
;
5+
; SPDX-License-Identifier: MIT
6+
;
7+
;============================ end_copyright_notice =============================
8+
9+
; RUN: igc_opt %s -S -o - -serialize-igc-metadata -igc-stateless-to-stateful-resolution -platformdg2 | FileCheck %s
10+
11+
; This test verifies if raytracing implicit global buffer is not promoted to stateful, as only stateless mode is supported in the runtime.
12+
13+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
14+
target triple = "spir64-unknown-unknown"
15+
16+
; Function Attrs: convergent nounwind
17+
define spir_kernel void @test_implicit_dg(i32 addrspace(1)* %out, i32 %offset, <8 x i32> %r0, <8 x i32> %payloadHeader, i8 addrspace(1)* %globalPointer, i32 %bufferOffset) #1 {
18+
entry:
19+
%mul = shl nsw i32 %offset, 4
20+
%idx.ext = sext i32 %mul to i64
21+
%add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %globalPointer, i64 %idx.ext
22+
%0 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
23+
; CHECK-NOT: %{{.*}} = inttoptr i32 %{{.*}} to i32 addrspace(131073)*
24+
; CHECK-NOT: %{{.*}} = load i32, i32 addrspace(131073)* %2, align 4
25+
; CHECK: %{{.*}} = load i32, i32 addrspace(1)* %0, align 4
26+
%1 = load i32, i32 addrspace(1)* %0, align 4
27+
store i32 %1, i32 addrspace(1)* %out, align 4
28+
ret void
29+
}
30+
31+
attributes #0 = { nounwind }
32+
33+
!igc.functions = !{!300}
34+
35+
!300 = !{void (i32 addrspace(1)*, i32, <8 x i32>, <8 x i32>, i8 addrspace(1)*, i32)* @test_implicit_dg, !301}
36+
!301 = !{!302, !303}
37+
!302 = !{!"function_type", i32 0}
38+
!303 = !{!"implicit_arg_desc", !304, !305, !306, !307}
39+
!304 = !{i32 0}
40+
!305 = !{i32 1}
41+
!306 = !{i32 53}
42+
!307 = !{i32 14, !308}
43+
!308 = !{!"explicit_arg_num", i32 0}

0 commit comments

Comments
 (0)