Skip to content

Commit 769851c

Browse files
authored
[SYCL] Move splitting module code into a new file (#5858)
`sycl-post-link` tool's code should be grouped into several source files to separate support of different functionalities, provided by the tool. It should improve code readability and sustainability. Current part of `sycl-post-link` tool code reorganization: - Move splitting mechanism into a separate file. - Make several `ModuleSplitter` classes to reduce comparisons during splitting. - Modify types that handle module splitting to simplify migration to multithreading split in the future. Signed-off-by: Mikhail Lychkov <[email protected]>
1 parent 1fe5eaa commit 769851c

File tree

10 files changed

+613
-427
lines changed

10 files changed

+613
-427
lines changed

llvm/test/tools/sycl-post-link/sycl-esimd/basic-esimd-lower.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ attributes #0 = { "sycl-module-id"="a.cpp" }
5050
; CHECK-NO-LOWERING: }
5151

5252
; With -O0, we only lower ESIMD code, but no other optimizations
53-
; CHECK-O0: define dso_local spir_kernel void @ESIMD_kernel() #1 !sycl_explicit_simd !3 !intel_reqd_sub_group_size !4 {
53+
; CHECK-O0: define dso_local spir_kernel void @ESIMD_kernel() #{{[0-9]}} !sycl_explicit_simd !3 !intel_reqd_sub_group_size !4 {
5454
; CHECK-O0: entry:
5555
; CHECK-O0: call <3 x i32> @llvm.genx.local.id.v3i32()
5656
; CHECK-O0: call <3 x i32> @llvm.genx.local.size.v3i32()

llvm/test/tools/sycl-post-link/sycl-esimd/basic-sycl-esimd-split.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ attributes #0 = { "sycl-module-id"="a.cpp" }
3737
!3 = !{}
3838

3939
; CHECK: [Code|Properties]
40-
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop
41-
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop
40+
; CHECK-DAG: {{.*}}tmp_0.ll|{{.*}}_0.prop
41+
; CHECK-DAG: {{.*}}tmp_esimd_0.ll|{{.*}}_esimd_0.prop
4242

4343
; CHECK-SYCL-IR-DAG: define dso_local spir_kernel void @SYCL_kernel()
4444
; CHECK-SYCL-IR-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv()

llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-per-kernel.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ attributes #1 = { "sycl-module-id"="a.cpp" }
5252
!3 = !{}
5353

5454
; CHECK: [Code|Properties]
55-
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop
56-
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop
57-
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop
58-
; CHECK: {{.*}}_esimd_1.ll|{{.*}}_esimd_1.prop
55+
; CHECK-DAG: {{.*}}tmp_0.ll|{{.*}}_0.prop
56+
; CHECK-DAG: {{.*}}tmp_1.ll|{{.*}}_1.prop
57+
; CHECK-DAG: {{.*}}tmp_esimd_0.ll|{{.*}}_esimd_0.prop
58+
; CHECK-DAG: {{.*}}tmp_esimd_1.ll|{{.*}}_esimd_1.prop
5959

6060
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel1()
6161
; CHECK-SYCL-IR-0-DAG: declare dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv()

llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-per-source.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ attributes #1 = { "sycl-module-id"="b.cpp" }
6666
!3 = !{}
6767

6868
; CHECK: [Code|Properties]
69-
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop
70-
; CHECK: {{.*}}_1.ll|{{.*}}_1.prop
71-
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop
72-
; CHECK: {{.*}}_esimd_1.ll|{{.*}}_esimd_1.prop
69+
; CHECK-DAG: {{.*}}tmp_0.ll|{{.*}}_0.prop
70+
; CHECK-DAG: {{.*}}tmp_1.ll|{{.*}}_1.prop
71+
; CHECK-DAG: {{.*}}tmp_esimd_0.ll|{{.*}}_esimd_0.prop
72+
; CHECK-DAG: {{.*}}tmp_esimd_1.ll|{{.*}}_esimd_1.prop
7373

7474
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel1()
7575
; CHECK-SYCL-IR-0-DAG: define dso_local spir_kernel void @SYCL_kernel2()

llvm/test/tools/sycl-post-link/sycl-esimd/sycl-esimd-split-symbols.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ attributes #1 = { "sycl-module-id"="b.cpp" }
4848
!3 = !{}
4949

5050
; CHECK: [Code|Properties|Symbols]
51-
; CHECK: {{.*}}_0.ll|{{.*}}_0.prop|{{.*}}_0.sym
52-
; CHECK: {{.*}}_esimd_0.ll|{{.*}}_esimd_0.prop|{{.*}}_esimd_0.sym
51+
; CHECK-DAG: {{.*}}tmp_0.ll|{{.*}}_0.prop|{{.*}}_0.sym
52+
; CHECK-DAG: {{.*}}tmp_esimd_0.ll|{{.*}}_esimd_0.prop|{{.*}}_esimd_0.sym
5353

5454
; CHECK-SYCL-SYM: SYCL_kernel1
5555
; CHECK-SYCL-SYM: SYCL_kernel2

llvm/tools/sycl-post-link/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ add_llvm_tool(sycl-post-link
2121
sycl-post-link.cpp
2222
CompileTimePropertiesPass.cpp
2323
DeviceGlobals.cpp
24+
ModuleSplitter.cpp
2425
SpecConstants.cpp
2526
SYCLDeviceLibReqMask.cpp
2627
SYCLKernelParamOptInfo.cpp

0 commit comments

Comments
 (0)