Skip to content

[SYCL][NFCI] Refactor device code split implementation once again #8833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3bb0d74
WIP
AlexeySachkov Feb 28, 2023
354be1a
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Mar 24, 2023
4ca6479
start using new splitter
AlexeySachkov Mar 27, 2023
acc36d0
fixes
AlexeySachkov Mar 28, 2023
8921214
remaining fixes
AlexeySachkov Mar 28, 2023
74577a3
remove dead code
AlexeySachkov Mar 28, 2023
0108a36
move some code around
AlexeySachkov Mar 28, 2023
0887e06
refactor using std::variant
AlexeySachkov Mar 28, 2023
a39bba1
move some method definitions into class definition
AlexeySachkov Mar 28, 2023
eab7e02
use SmallString + tiny refactorings
AlexeySachkov Mar 28, 2023
f802bc2
Add some comments
AlexeySachkov Mar 28, 2023
2c11625
cleanup some large-grf-related dead code
AlexeySachkov Mar 28, 2023
471967c
a bit of clang-format
AlexeySachkov Mar 28, 2023
466e2df
Fixes to -ir-output-only flow
AlexeySachkov Mar 29, 2023
619eef4
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Mar 31, 2023
a76e8d2
tiny sycl-post-link cleanup
AlexeySachkov Mar 31, 2023
7384fe4
Some renamings
AlexeySachkov Mar 31, 2023
2a36701
Refactoring
AlexeySachkov Mar 31, 2023
1528921
clang-format
AlexeySachkov Mar 31, 2023
aaf1e92
apply comments
AlexeySachkov Apr 3, 2023
b4edc98
An attempt to fix LIT tests
AlexeySachkov Apr 3, 2023
2332b57
Actual fix for tests
AlexeySachkov Apr 3, 2023
31c52fa
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Apr 4, 2023
13169d4
Add brief Rule::RKind descriptions
AlexeySachkov Apr 4, 2023
67082dd
Add delimeter to distinguish between strings produced by different rules
AlexeySachkov Apr 4, 2023
54ffaeb
clang-format
AlexeySachkov Apr 4, 2023
7fa60bf
Merge branch 'sycl' into private/asachkov/generic-module-splitter
AlexeySachkov Apr 6, 2023
cf3a365
[NFC] A few more changes
AlexeySachkov Apr 6, 2023
aec361c
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Apr 6, 2023
3082834
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Apr 12, 2023
863abed
Fix sycl-post-link emitting warning incorrectly
AlexeySachkov Apr 12, 2023
b80c1c4
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Apr 20, 2023
adadb0d
Restore sycl-opt-level attribute functionality after merge
AlexeySachkov Apr 20, 2023
9158ca8
Fix test after merge
AlexeySachkov Apr 20, 2023
7ff7531
Apply comments
AlexeySachkov Apr 20, 2023
e4b452e
Better solution for review comments
AlexeySachkov Apr 20, 2023
d61e93e
Apply comments
AlexeySachkov Apr 21, 2023
ec37831
Apply clang-format
AlexeySachkov Apr 21, 2023
d674eb2
Consider only entry points when emitting optLevel property
AlexeySachkov Apr 27, 2023
0f49bfb
This (rather) hacky change should help fix regressions
AlexeySachkov Apr 27, 2023
a4dc3d4
Merge remote-tracking branch 'origin/sycl' into private/asachkov/gene…
AlexeySachkov Apr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/include/llvm/SYCLLowerIR/SYCLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace llvm {
namespace sycl {
namespace utils {
constexpr char ATTR_SYCL_MODULE_ID[] = "sycl-module-id";
constexpr char ATTR_SYCL_OPTLEVEL[] = "sycl-optlevel";

using CallGraphNodeAction = ::std::function<void(Function *)>;
using CallGraphFunctionFilter =
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/tools/sycl-post-link/assert/property-1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
; RUN: FileCheck %s -input-file=%t_0.prop --implicit-check-not TheKernel2
;
; RUN: sycl-post-link -split=kernel -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t_0.prop --check-prefixes=CHECK-K1
; RUN: FileCheck %s -input-file=%t_1.prop --check-prefixes=CHECK-K2
; RUN: FileCheck %s -input-file=%t_2.prop --check-prefixes=CHECK-K3
; RUN: FileCheck %s -input-file=%t_0.prop --check-prefixes=CHECK-K3
; RUN: FileCheck %s -input-file=%t_1.prop --check-prefixes=CHECK-K1
; RUN: FileCheck %s -input-file=%t_2.prop --check-prefixes=CHECK-K2

; SYCL source:
; void foo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
; RUN: sycl-post-link -split=auto -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-M0-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M1-IR \
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M1-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M2-IR \
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M2-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M1-SYMS \
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M2-SYMS \
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1

; RUN: sycl-post-link -split=source -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-M0-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M1-IR \
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M1-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M2-IR \
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M2-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M1-SYMS \
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M2-SYMS \
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1

; RUN: sycl-post-link -split=kernel -symbols -S < %s -o %t.table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
; CHECK-TABLE-NEXT: _2.sym
; CHECK-TABLE-EMPTY:

; CHECK-M0-SYMS: kernel0
; CHECK-M0-SYMS: kernel3

; CHECK-M1-SYMS: kernel3
; CHECK-M1-SYMS: kernel1
; CHECK-M1-SYMS: kernel2

; CHECK-M2-SYMS: kernel1
; CHECK-M2-SYMS: kernel2
; CHECK-M2-SYMS: kernel0

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir64-unknown-linux"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
; RUN: sycl-post-link -split=auto -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-M0-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M1-IR \
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M1-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M2-IR \
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M2-IR \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M1-SYMS \
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel2
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M2-SYMS \
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2

; RUN: sycl-post-link -split=source -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-M0-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M1-IR \
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M1-IR \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel2
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-M2-IR \
; RUN: FileCheck %s -input-file=%t_2.ll --check-prefixes CHECK-M2-IR \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M1-SYMS \
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel2
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-M2-SYMS \
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2

; RUN: sycl-post-link -split=kernel -symbols -S < %s -o %t.table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
; RUN: sycl-post-link -split=auto -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t.table --check-prefix CHECK-TABLE
;
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefix CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 \
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefix CHECK-M0-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel2
;
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefix CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel3 \
; RUN: --implicit-check-not kernel2
;
; RUN: FileCheck %s -input-file=%t_2.sym --check-prefix CHECK-M2-SYMS \
; RUN: --implicit-check-not kernel0 --implicit-check-not kernel3
;
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefix CHECK-M1-SYMS \
; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 \
; RUN: --implicit-check-not kernel3
; RUN: --implicit-check-not kernel0

; CHECK-TABLE: Code
; CHECK-TABLE-NEXT: _0.sym
; CHECK-TABLE-NEXT: _1.sym
; CHECK-TABLE-NEXT: _2.sym
; CHECK-TABLE-EMPTY:

; CHECK-M0-SYMS: kernel3
; CHECK-M0-SYMS: kernel1
; CHECK-M0-SYMS: kernel2

; CHECK-M1-SYMS: kernel0

; CHECK-M2-SYMS: kernel1
; CHECK-M2-SYMS: kernel2
; CHECK-M2-SYMS: kernel3

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir64-unknown-linux"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
;
; RUN: sycl-post-link -split=kernel -symbols -S < %s -o %t1.table
; RUN: FileCheck %s -input-file=%t1.table --check-prefix CHECK-PER-KERNEL-TABLE
; RUN: FileCheck %s -input-file=%t1_0.sym --check-prefix CHECK-PER-KERNEL-SYM0
; RUN: FileCheck %s -input-file=%t1_1.sym --check-prefix CHECK-PER-KERNEL-SYM1
; RUN: FileCheck %s -input-file=%t1_2.sym --check-prefix CHECK-PER-KERNEL-SYM2
; RUN: FileCheck %s -input-file=%t1_0.sym --check-prefix CHECK-PER-KERNEL-SYM1
; RUN: FileCheck %s -input-file=%t1_1.sym --check-prefix CHECK-PER-KERNEL-SYM2
; RUN: FileCheck %s -input-file=%t1_2.sym --check-prefix CHECK-PER-KERNEL-SYM0

; With per-source split, there should be two device images
; CHECK-PER-SOURCE-TABLE: [Code|Properties|Symbols]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: sycl-post-link --device-globals --split=source -S < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD1
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD1
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD0

; This test is intended to check that sycl-post-link generates no errors
; when a device global variable with the 'device_image_scope' property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: sycl-post-link --device-globals --split=source -S < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD1
; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefix CHECK-MOD2
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD2
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefix CHECK-MOD1

; This test is intended to check that sycl-post-link generates no error if the
; 'device_image_scope' property is attached to not a device global variable.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: sycl-post-link --device-globals --split=source -S < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD1
; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefix CHECK-MOD2
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD2
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefix CHECK-MOD1

; ModuleID = 'llvm/test/tools/sycl-post-link/device-globals/test_global_variable_many_modules_no_dev_img_scope.ll'
source_filename = "llvm/test/tools/sycl-post-link/device-globals/test_global_variable_many_modules_no_dev_img_scope.ll"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: sycl-post-link --device-globals --split=source -S < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD1
; RUN: FileCheck %s -input-file=%t.files_1.ll --check-prefix CHECK-MOD0
; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefix CHECK-MOD1

; This test is intended to check that sycl-post-link generates no errors
; when each device global variable with the 'device_image_scope' property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
; RUN: FileCheck %s -input-file=%t.files_0.prop --check-prefix CHECK-PROP-AUTO-SPLIT

; RUN: sycl-post-link -split=kernel < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.prop --check-prefix CHECK-PROP-KERNEL-SPLIT-0
; RUN: FileCheck %s -input-file=%t.files_1.prop --check-prefix CHECK-PROP-KERNEL-SPLIT-1
; RUN: FileCheck %s -input-file=%t.files_0.prop --check-prefix CHECK-PROP-KERNEL-SPLIT-1
; RUN: FileCheck %s -input-file=%t.files_1.prop --check-prefix CHECK-PROP-KERNEL-SPLIT-0

; CHECK-PROP-AUTO-SPLIT: [SYCL/device requirements]
; CHECK-PROP-AUTO-SPLIT-NEXT: aspects=2|gCAAAAAAAAAAAAAABAAAAYAAAAQCAAAAMAAAAA
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/tools/sycl-post-link/emit_exported_symbols.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
;
; Per-module split
; RUN: sycl-post-link -symbols -split=source -emit-exported-symbols -S < %s -o %t.per_module.files.table
; RUN: FileCheck %s -input-file=%t.per_module.files_0.prop -implicit-check-not="NotExported" --check-prefix=CHECK-PERMODULE-0-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_1.prop -implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_0.prop -implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_1.prop -implicit-check-not="NotExported" --check-prefix=CHECK-PERMODULE-0-PROP
; RUN: FileCheck %s -input-file=%t.per_module.files_2.prop -implicit-check-not="NotExported" --check-prefix=CHECK-PERMODULE-2-PROP
;
; Per-kernel split
; RUN: sycl-post-link -symbols -split=kernel -emit-exported-symbols -S < %s -o %t.per_kernel.files.table
; RUN: FileCheck %s -input-file=%t.per_kernel.files_0.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-0-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_1.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-1-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_2.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-2-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_3.prop --implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_4.prop --implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_0.prop --implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_1.prop --implicit-check-not="NotExported" --check-prefix=CHECK-KERNELONLY-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_2.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-0-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_3.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-1-PROP
; RUN: FileCheck %s -input-file=%t.per_kernel.files_4.prop --implicit-check-not="NotExported" --check-prefix=CHECK-PERKERNEL-2-PROP

target triple = "spir64-unknown-unknown"

Expand Down
14 changes: 7 additions & 7 deletions llvm/test/tools/sycl-post-link/sycl-esimd-large-grf.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

; 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_large_grf_1.ll --check-prefixes CHECK-ESIMD-LargeGRF-IR --implicit-check-not='RegisterAllocMode'
; RUN: FileCheck %s -input-file=%t_esimd_large_grf_1.prop --check-prefixes CHECK-ESIMD-LargeGRF-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_large_grf_1.sym --check-prefixes CHECK-ESIMD-LargeGRF-SYM
; RUN: FileCheck %s -input-file=%t_esimd_0.ll --check-prefixes CHECK-ESIMD-LargeGRF-IR --implicit-check-not='RegisterAllocMode'
; RUN: FileCheck %s -input-file=%t_esimd_0.prop --check-prefixes CHECK-ESIMD-LargeGRF-PROP
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYCL-SYM
; RUN: FileCheck %s -input-file=%t_esimd_1.sym --check-prefixes CHECK-ESIMD-SYM
; RUN: FileCheck %s -input-file=%t_esimd_0.sym --check-prefixes CHECK-ESIMD-LargeGRF-SYM

; CHECK: [Code|Properties|Symbols]
; CHECK: {{.*}}esimd-large-grf.ll.tmp_0.ll|{{.*}}esimd-large-grf.ll.tmp_0.prop|{{.*}}esimd-large-grf.ll.tmp_0.sym
; CHECK: {{.*}}esimd-large-grf.ll.tmp_esimd_0.ll|{{.*}}esimd-large-grf.ll.tmp_esimd_0.prop|{{.*}}esimd-large-grf.ll.tmp_esimd_0.sym
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop|{{.*}}_1.sym
; CHECK: {{.*}}_esimd_1.ll|{{.*}}_esimd_1.prop|{{.*}}_esimd_1.sym

; CHECK-ESIMD-LargeGRF-PROP: isEsimdImage=1|1
; CHECK-ESIMD-LargeGRF-PROP: isLargeGRF=1|1
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/sycl-post-link/sycl-large-grf.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

; 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_large_grf_1.ll --check-prefixes CHECK-LARGE-GRF-IR
; RUN: FileCheck %s -input-file=%t_large_grf_1.prop --check-prefixes CHECK-LARGE-GRF-PROP
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-SYCL-SYM
; RUN: FileCheck %s -input-file=%t_large_grf_1.sym --check-prefixes CHECK-LARGE-GRF-SYM
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-LARGE-GRF-IR
; RUN: FileCheck %s -input-file=%t_0.prop --check-prefixes CHECK-LARGE-GRF-PROP
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYCL-SYM
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-LARGE-GRF-SYM

; CHECK: [Code|Properties|Symbols]
; CHECK: {{.*}}-large-grf.ll.tmp_0.ll|{{.*}}-large-grf.ll.tmp_0.prop|{{.*}}-large-grf.ll.tmp_0.sym
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop|{{.*}}_1.sym

; CHECK-LARGE-GRF-PROP: isLargeGRF=1|1
Expand Down
68 changes: 68 additions & 0 deletions llvm/test/tools/sycl-post-link/sycl-opt-level-external-funcs.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
; This test checks, that 'optLevel' property is only emitted based on the module
; entry points
;
; In this test we have functions 'foo' and 'boo' defined in different
; translation units. They are both entry points and 'foo' calls 'boo'.
; As a result, we expect two modules:
; - module with 'foo' (as entry point) and 'bar' (included as dependency) with
; 'optLevel' set to 1 (taken from 'foo')
; - module with 'bar' (as entry point) with 'optLevel' set to 2 (taken from
; 'bar')

; RUN: sycl-post-link -split=source -symbols -S < %s -o %t.table
; RUN: FileCheck %s -input-file=%t.table
; RUN: FileCheck %s -input-file=%t_0.prop --check-prefixes CHECK-OPT-LEVEL-PROP-0
; RUN: FileCheck %s -input-file=%t_1.prop --check-prefixes CHECK-OPT-LEVEL-PROP-1
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-SYM-0
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYM-1
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefix CHECK-IR-0
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefix CHECK-IR-1

; CHECK: [Code|Properties|Symbols]
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop|{{.*}}_1.sym
; CHECK-EMPTY:

; CHECK-OPT-LEVEL-PROP-0: optLevel=1|1
; CHECK-OPT-LEVEL-PROP-1: optLevel=1|2
; CHECK-SYM-0: _Z3fooii
; CHECK-SYM-0-EMPTY:
; CHECK-SYM-1: _Z3barii
;
; CHECK-IR-0-DAG: define {{.*}} @_Z3fooii{{.*}} #[[#ATTR0:]]
; CHECK-IR-0-DAG: define {{.*}} @_Z3barii{{.*}} #[[#ATTR1:]]
; CHECK-IR-0-DAG: attributes #[[#ATTR0]] = { {{.*}} "sycl-optlevel"="1" }
; CHECK-IR-0-DAG: attributes #[[#ATTR1]] = { {{.*}} "sycl-optlevel"="2" }
;
; CHECK-IR-1: define {{.*}} @_Z3barii{{.*}} #[[#ATTR0:]]
; CHECK-IR-1: attributes #[[#ATTR0]] = { {{.*}} "sycl-optlevel"="2" }

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 dso_local spir_func noundef i32 @_Z3fooii(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = call i32 @_Z3barii(i32 %a, i32 %b)
%sub = sub nsw i32 %a, %call
ret i32 %sub
}

define dso_local spir_func noundef i32 @_Z3barii(i32 noundef %a, i32 noundef %b) #1 {
entry:
%retval = alloca i32, align 4
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%retval.ascast = addrspacecast i32* %retval to i32 addrspace(4)*
%a.addr.ascast = addrspacecast i32* %a.addr to i32 addrspace(4)*
%b.addr.ascast = addrspacecast i32* %b.addr to i32 addrspace(4)*
store i32 %a, i32 addrspace(4)* %a.addr.ascast, align 4
store i32 %b, i32 addrspace(4)* %b.addr.ascast, align 4
%0 = load i32, i32 addrspace(4)* %a.addr.ascast, align 4
%1 = load i32, i32 addrspace(4)* %b.addr.ascast, align 4
%add = add nsw i32 %0, %1
ret i32 %add
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "sycl-module-id"="test3.cpp" "sycl-optlevel"="1" }
attributes #1 = { convergent mustprogress noinline norecurse nounwind optnone "sycl-module-id"="test2.cpp" "sycl-optlevel"="2" }

Loading