-
Notifications
You must be signed in to change notification settings - Fork 787
[sycl-post-link] Split SYCL and ESIMD kernels into separate modules #3044
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d60195b
[sycl-post-link][NFC] Extracted the code into a subroutine
DenisBakhvalov 0fde11d
[sycl-post-link][NFC] Refactored writing to the output table
DenisBakhvalov 147eb5f
[sycl-post-link] Split SYCL and ESIMD kernels into separate modules
DenisBakhvalov 016bcc5
Merge remote-tracking branch 'sycl' into mix-sycl-esimd-split-3
DenisBakhvalov 0b6c9c7
Fixed code review comments:
DenisBakhvalov b6160c7
Merge remote-tracking branch 'upstream/sycl' into mix-sycl-esimd-split-3
DenisBakhvalov 8d71009
Added a comment about unreachable functions
DenisBakhvalov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
; RUN: sycl-post-link --ir-output-only -split=auto -S %s -o %t.ll | ||
; RUN: FileCheck %s -input-file=%t.ll | ||
|
||
; This test checks that the --ir-output-only option writes a LLVM IR | ||
; file instead of a table. In comparison with other tests, this one | ||
; checks that the option works OK with -split=auto. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @kernel1() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @kernel2() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
|
||
; CHECK: define dso_local spir_kernel void @kernel1() | ||
; CHECK: define dso_local spir_kernel void @kernel2() |
45 changes: 45 additions & 0 deletions
45
llvm/test/tools/sycl-post-link/sycl-esimd/basic-sycl-esimd-split.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; RUN: sycl-post-link -split-esimd -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-SYCL-IR | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.ll --check-prefixes CHECK-ESIMD-IR | ||
|
||
; This is basic test of splitting SYCL and ESIMD kernels into separate | ||
; modules. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
!3 = !{} | ||
|
||
; CHECK: [Code|Properties] | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop | ||
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop | ||
|
||
; CHECK-SYCL-IR-DAG: define dso_local spir_kernel void @SYCL_kernel() | ||
; CHECK-SYCL-IR-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-ESIMD-IR-DAG: define dso_local spir_kernel void @ESIMD_kernel() | ||
; CHECK-ESIMD-IR-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
55 changes: 55 additions & 0 deletions
55
llvm/test/tools/sycl-post-link/sycl-esimd/no-sycl-esimd-split.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
; RUN: sycl-post-link -split=source -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-IR-0 | ||
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-IR-1 | ||
|
||
; This test checks that if no '-split-esimd' provided, ther is no | ||
; splitting of SYCL and ESIMD kernels into separate modules. | ||
; However, the rest of the splitting still happens according to | ||
; the '-split=' option. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel1() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel2() #1 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
attributes #1 = { "sycl-module-id"="b.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
!3 = !{} | ||
|
||
; CHECK: [Code|Properties] | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop | ||
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop | ||
|
||
; CHECK-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel1() | ||
; CHECK-IR-0-DAG: define dso_local spir_kernel void @ESIMD_kernel() | ||
; CHECK-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-IR-1-DAG: define dso_local spir_kernel void @SYCL_kernel2() | ||
; CHECK-IR-1-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
70 changes: 70 additions & 0 deletions
70
llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-per-kernel.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
; RUN: sycl-post-link -split-esimd -split=kernel -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-SYCL-IR-0 | ||
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-SYCL-IR-1 | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.ll --check-prefixes CHECK-ESIMD-IR-0 | ||
; RUN: FileCheck %s -input-file=%t_esimd_1.ll --check-prefixes CHECK-ESIMD-IR-1 | ||
|
||
; This test checks that after we split SYCL and ESIMD kernels into | ||
; separate modules, we split those two modules further according to | ||
; -split option. In this case we have 2 SYCL and 2 ESIMD kernels, which | ||
; are split into a total of 4 separate modules. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel1() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel2() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel1() #1 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel2() #1 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
attributes #1 = { "sycl-module-id"="a.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
!3 = !{} | ||
|
||
; CHECK: [Code|Properties] | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop | ||
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop | ||
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop | ||
; CHECK: {{.*}}_esimd_1.ll|{{.*}}_esimd_1.prop | ||
|
||
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel1() | ||
; CHECK-SYCL-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-SYCL-IR-1-DAG: define dso_local spir_kernel void @SYCL_kernel2() | ||
; CHECK-SYCL-IR-1-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-ESIMD-IR-0-DAG: define dso_local spir_kernel void @ESIMD_kernel1() | ||
; CHECK-ESIMD-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-ESIMD-IR-1-DAG: define dso_local spir_kernel void @ESIMD_kernel2() | ||
; CHECK-ESIMD-IR-1-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
86 changes: 86 additions & 0 deletions
86
llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-per-source.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
; RUN: sycl-post-link -split-esimd -split=source -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-SYCL-IR-0 | ||
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-SYCL-IR-1 | ||
; RUN: FileCheck %s -input-file=%t_esimd_0.ll --check-prefixes CHECK-ESIMD-IR-0 | ||
; RUN: FileCheck %s -input-file=%t_esimd_1.ll --check-prefixes CHECK-ESIMD-IR-1 | ||
|
||
; This test checks that after we split SYCL and ESIMD kernels into | ||
; separate modules, we split those two modules further according to | ||
; -split option. In this case we have: | ||
; - 3 SYCL kernels: 2 in a.cpp, 1 in b.cpp | ||
; - 3 ESIMD kernels: 2 in a.cpp, 1 in b.cpp | ||
; The module will be split into a total of 4 separate modules. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel1() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel2() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel3() #1 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel1() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel2() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel3() #1 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
attributes #1 = { "sycl-module-id"="b.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
!3 = !{} | ||
|
||
; CHECK: [Code|Properties] | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop | ||
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop | ||
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop | ||
; CHECK: {{.*}}_esimd_1.ll|{{.*}}_esimd_1.prop | ||
|
||
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel1() | ||
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel2() | ||
; CHECK-SYCL-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-SYCL-IR-1-DAG: define dso_local spir_kernel void @SYCL_kernel3() | ||
; CHECK-SYCL-IR-1-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-ESIMD-IR-0-DAG: define dso_local spir_kernel void @ESIMD_kernel1() | ||
; CHECK-ESIMD-IR-0-DAG: define dso_local spir_kernel void @ESIMD_kernel2() | ||
; CHECK-ESIMD-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
; CHECK-ESIMD-IR-1-DAG: define dso_local spir_kernel void @ESIMD_kernel3() | ||
; CHECK-ESIMD-IR-1-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
58 changes: 58 additions & 0 deletions
58
llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-symbols.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
; RUN: sycl-post-link -split-esimd -symbols -S %s -o %t.table | ||
; RUN: FileCheck %s -input-file=%t.table | ||
; 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 | ||
|
||
; This test checks symbols generation when we split SYCL and ESIMD kernels into | ||
; separate modules. | ||
|
||
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-sycldevice" | ||
|
||
declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel1() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @ESIMD_kernel2() #0 !sycl_explicit_simd !3{ | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel1() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
define dso_local spir_kernel void @SYCL_kernel2() #0 { | ||
entry: | ||
%call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() | ||
ret void | ||
} | ||
|
||
attributes #0 = { "sycl-module-id"="a.cpp" } | ||
attributes #1 = { "sycl-module-id"="b.cpp" } | ||
|
||
!llvm.module.flags = !{!0} | ||
!opencl.spir.version = !{!1} | ||
!spirv.Source = !{!2} | ||
|
||
!0 = !{i32 1, !"wchar_size", i32 4} | ||
!1 = !{i32 1, i32 2} | ||
!2 = !{i32 0, i32 100000} | ||
!3 = !{} | ||
|
||
; CHECK: [Code|Properties|Symbols] | ||
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym | ||
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop|{{.*}}_esimd_0.sym | ||
|
||
; CHECK-SYCL-SYM: SYCL_kernel1 | ||
kbobrovs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
; CHECK-SYCL-SYM: SYCL_kernel2 | ||
|
||
; CHECK-ESIMD-SYM: ESIMD_kernel1 | ||
; CHECK-ESIMD-SYM: ESIMD_kernel2 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.