File: local_id_extern.ll

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (104 lines) | stat: -rw-r--r-- 7,140 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022-2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: %opt_typed_ptrs %use_old_pass_manager% -cmimpparam -cmimpparam-payload-in-memory=false \
; RUN:     -march=genx64 -mcpu=Gen9 -S < %s | \
; RUN:  FileCheck --check-prefixes=Gen9,Gen9-TYPED-PTRS --enable-var-scope %s
; RUN: %opt_opaque_ptrs %use_old_pass_manager% -cmimpparam -cmimpparam-payload-in-memory=false \
; RUN:     -march=genx64 -mcpu=Gen9 -S < %s | \
; RUN:  FileCheck --check-prefixes=Gen9,Gen9-OPAQUE-PTRS --enable-var-scope %s

target datalayout = "e-p:64:64-i64:64-n8:16:32:64"
target triple = "spir64-unknown-unknown"

; COM: Struct indices:
; COM: X = 0
; COM: Y = 1
; COM: Z = 2
;Gen9-DAG: %vc.ia.local.id.type = type { i16, i16, i16 }

declare <3 x i16> @llvm.genx.local.id16.v3i16()

define dllexport spir_kernel void @kernel() {
; Gen9-LABEL: define dllexport spir_kernel void @kernel(
; Gen9-NOT: i64 %impl.arg.llvm.vc.internal.print.buffer
; Gen9-NOT: <3 x i32> %impl.arg.llvm.genx.local.size
; Gen9-NOT: <3 x i32> %impl.arg.llvm.genx.group.count
; Gen9-DAG: <3 x i16> %impl.arg.llvm.genx.local.id16
; Gen9-DAG: i64 %impl.arg.impl.args.buffer
; Gen9-SAME: )
; COM: Implict args buffer variable initialization in kernel prologue. It won't
; COM: be used but it must be initialized with local ID buffer variable.
; Gen9-TYPED-PTRS: call void @llvm.vc.internal.write.variable.region.p0i64.i64.i1(i64* @llvm.vc.predef.var.impl.args.buf, i64 %impl.arg.impl.args.buffer, i32 1, i32 0, i1 true)
; Gen9-OPAQUE-PTRS: call void @llvm.vc.internal.write.variable.region.p0.i64.i1(ptr @llvm.vc.predef.var.impl.args.buf, i64 %impl.arg.impl.args.buffer, i32 1, i32 0, i1 true)

; COM: Local ID buffer variable initialization. The buffer is allocated on kernel stack frame.
; Gen9: %[[LOCID_BUF:[^ ]+]] = alloca %vc.ia.local.id.type
; Gen9-DAG: %[[LOCID_X:[^ ]+]] = extractelement <3 x i16> %impl.arg.llvm.genx.local.id16, i64 0
; Gen9-TYPED-PTRS-DAG: %[[LOCID_X_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, %vc.ia.local.id.type* %[[LOCID_BUF]], i32 0, i32 0
; Gen9-TYPED-PTRS-DAG: store i16 %[[LOCID_X]], i16* %[[LOCID_X_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_X_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, ptr %[[LOCID_BUF]], i32 0, i32 0
; Gen9-OPAQUE-PTRS-DAG: store i16 %[[LOCID_X]], ptr %[[LOCID_X_PTR]]
; Gen9-DAG: %[[LOCID_Y:[^ ]+]] = extractelement <3 x i16> %impl.arg.llvm.genx.local.id16, i64 1
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Y_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, %vc.ia.local.id.type* %[[LOCID_BUF]], i32 0, i32 1
; Gen9-TYPED-PTRS-DAG: store i16 %[[LOCID_Y]], i16* %[[LOCID_Y_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Y_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, ptr %[[LOCID_BUF]], i32 0, i32 1
; Gen9-OPAQUE-PTRS-DAG: store i16 %[[LOCID_Y]], ptr %[[LOCID_Y_PTR]]
; Gen9-DAG: %[[LOCID_Z:[^ ]+]] = extractelement <3 x i16> %impl.arg.llvm.genx.local.id16, i64 2
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Z_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, %vc.ia.local.id.type* %[[LOCID_BUF]], i32 0, i32 2
; Gen9-TYPED-PTRS-DAG: store i16 %[[LOCID_Z]], i16* %[[LOCID_Z_PTR]]
; Gen9-TYPED-PTRS-DAG: %[[LOCID_BUF_INT:[^ ]+]] = ptrtoint %vc.ia.local.id.type* %[[LOCID_BUF]] to i64
; Gen9-TYPED-PTRS-DAG: call void @llvm.vc.internal.write.variable.region.p0i64.i64.i1(i64* @llvm.vc.predef.var.loc.id.buf, i64 %[[LOCID_BUF_INT]], i32 1, i32 0, i1 true)
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Z_PTR:[^ ]+]] = getelementptr %vc.ia.local.id.type, ptr %[[LOCID_BUF]], i32 0, i32 2
; Gen9-OPAQUE-PTRS-DAG: store i16 %[[LOCID_Z]], ptr %[[LOCID_Z_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_BUF_INT:[^ ]+]] = ptrtoint ptr %[[LOCID_BUF]] to i64
; Gen9-OPAQUE-PTRS-DAG: call void @llvm.vc.internal.write.variable.region.p0.i64.i1(ptr @llvm.vc.predef.var.loc.id.buf, i64 %[[LOCID_BUF_INT]], i32 1, i32 0, i1 true)

  call spir_func void @with_local_id()
  ret void
}

define spir_func void @with_local_id() {
; COM: The signature shouldn't change.
; Gen9-LABEL: define spir_func void @with_local_id()

; COM: Obtaining local ID structure pointer.
; Gen9-TYPED-PTRS: %[[LOCID_BASE_PTR_INT:[^ ]+]] = call i64 @llvm.vc.internal.read.variable.region.i64.p0i64(i64* @llvm.vc.predef.var.loc.id.buf, i32 0, i32 1, i32 1, i32 0)
; Gen9-TYPED-PTRS: %[[LOCID_BASE_PTR:[^ ]+]] = inttoptr i64 %[[LOCID_BASE_PTR_INT]] to %vc.ia.local.id.type addrspace(1)*
; Gen9-OPAQUE-PTRS: %[[LOCID_BASE_PTR_INT:[^ ]+]] = call i64 @llvm.vc.internal.read.variable.region.i64.p0(ptr @llvm.vc.predef.var.loc.id.buf, i32 0, i32 1, i32 1, i32 0)
; Gen9-OPAQUE-PTRS: %[[LOCID_BASE_PTR:[^ ]+]] = inttoptr i64 %[[LOCID_BASE_PTR_INT]] to ptr addrspace(1)

; COM: Loading local IDs from the structure by elements.
; Gen9-TYPED-PTRS-DAG: %[[LOCID_X_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, %vc.ia.local.id.type addrspace(1)* %[[LOCID_BASE_PTR]], i32 0, i32 0
; Gen9-TYPED-PTRS-DAG: %[[LOCID_X:[^ ]+]] = load i16, i16 addrspace(1)* %[[LOCID_X_PTR]]
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Y_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, %vc.ia.local.id.type addrspace(1)* %[[LOCID_BASE_PTR]], i32 0, i32 1
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Y:[^ ]+]] = load i16, i16 addrspace(1)* %[[LOCID_Y_PTR]]
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Z_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, %vc.ia.local.id.type addrspace(1)* %[[LOCID_BASE_PTR]], i32 0, i32 2
; Gen9-TYPED-PTRS-DAG: %[[LOCID_Z:[^ ]+]] = load i16, i16 addrspace(1)* %[[LOCID_Z_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_X_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, ptr addrspace(1) %[[LOCID_BASE_PTR]], i32 0, i32 0
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_X:[^ ]+]] = load i16, ptr addrspace(1) %[[LOCID_X_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Y_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, ptr addrspace(1) %[[LOCID_BASE_PTR]], i32 0, i32 1
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Y:[^ ]+]] = load i16, ptr addrspace(1) %[[LOCID_Y_PTR]]
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Z_PTR:[^ ]+]] = getelementptr inbounds %vc.ia.local.id.type, ptr addrspace(1) %[[LOCID_BASE_PTR]], i32 0, i32 2
; Gen9-OPAQUE-PTRS-DAG: %[[LOCID_Z:[^ ]+]] = load i16, ptr addrspace(1) %[[LOCID_Z_PTR]]
; Gen9-DAG: %[[LOCID_PART_0:[^ ]+]] = insertelement <3 x i16> undef, i16 %[[LOCID_X]], i64 0
; Gen9-DAG: %[[LOCID_PART_1:[^ ]+]] = insertelement <3 x i16> %[[LOCID_PART_0]], i16 %[[LOCID_Y]], i64 1
; Gen9-DAG: %[[LOCID_WHOLE:[^ ]+]] = insertelement <3 x i16> %[[LOCID_PART_1]], i16 %[[LOCID_Z]], i64 2
; Gen9-TYPED-PTRS: store <3 x i16> %[[LOCID_WHOLE]], <3 x i16>* @__imparg_llvm.genx.local.id16
; Gen9-OPAQUE-PTRS: store <3 x i16> %[[LOCID_WHOLE]], ptr @__imparg_llvm.genx.local.id16

  %wli.loc.id = call <3 x i16> @llvm.genx.local.id16.v3i16()
; Gen9-TYPED-PTRS: %wli.loc.id = load <3 x i16>, <3 x i16>* @__imparg_llvm.genx.local.id16
; Gen9-OPAQUE-PTRS: %wli.loc.id = load <3 x i16>, ptr @__imparg_llvm.genx.local.id16
  ret void
}

!genx.kernels = !{!1}

!0 = !{}
!1 = !{void ()* @kernel, !"kernel", !0, i32 0, i32 0, !0, !0, i32 0, i32 0}