From 670e036afa0ea13f3bd1cdff493a22eac0a1c20f Mon Sep 17 00:00:00 2001 From: "Sabianin, Maksim" Date: Fri, 12 Jul 2024 08:28:05 -0700 Subject: [PATCH 1/2] [SYCL] migrate sycl-module-split to llvm-split Removes sycl-module-split tool and replaces all usages with llvm-split tool. --- .../device-code-split/auto-module-split-1.ll | 2 +- .../device-code-split/auto-module-split-2.ll | 2 +- .../device-code-split/auto-module-split-3.ll | 2 +- .../auto-module-split-func-ptr.ll | 2 +- .../device-code-split/basic-module-split.ll | 2 +- .../complex-indirect-call-chain.ll | 6 +- .../one-kernel-per-module.ll | 2 +- .../device-code-split/per-aspect-split-1.ll | 6 +- .../device-code-split/per-aspect-split-2.ll | 2 +- .../device-code-split/per-aspect-split-3.ll | 2 +- .../device-code-split/per-joint-matrix-1.ll | 6 +- .../device-code-split/per-joint-matrix-2.ll | 6 +- .../per-joint-matrix-mad-1.ll | 6 +- .../per-joint-matrix-mad-2.ll | 6 +- .../per-joint-matrix-mad-4.ll | 6 +- .../per-joint-matrix-mad-5.ll | 6 +- .../per-reqd-sub-group-size-split-1.ll | 6 +- .../per-reqd-sub-group-size-split-2.ll | 2 +- .../per-reqd-wg-size-split-1.ll | 6 +- .../per-reqd-wg-size-split-2.ll | 2 +- .../split-with-kernel-declarations.ll | 4 +- .../device-code-split/vtable.ll | 2 +- llvm/tools/llvm-split/CMakeLists.txt | 1 + llvm/tools/llvm-split/llvm-split.cpp | 96 +++++++++++++ llvm/tools/sycl-module-split/CMakeLists.txt | 10 -- .../sycl-module-split/sycl-module-split.cpp | 130 ------------------ 26 files changed, 140 insertions(+), 183 deletions(-) delete mode 100644 llvm/tools/sycl-module-split/CMakeLists.txt delete mode 100644 llvm/tools/sycl-module-split/sycl-module-split.cpp diff --git a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-1.ll index bbcde38cbadcb..8354c1ae3655d 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-1.ll @@ -5,7 +5,7 @@ ; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-TU0-TXT ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-TU1-TXT -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; By default auto mode is equal to source mode ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-TU0,CHECK ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-TU1,CHECK diff --git a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-2.ll index 0f7cf05ae86d5..3243aab443375 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-2.ll @@ -10,7 +10,7 @@ ; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-TU0-TXT ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-TU1-TXT -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-TU0,CHECK ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-TU1,CHECK ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefixes CHECK-TU0-TXT diff --git a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-3.ll b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-3.ll index 4dfbc4bfbd163..52a532b6f92dd 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-3.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-3.ll @@ -15,7 +15,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-TU1-SYM ; ; -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-TU0-IR \ ; RUN: --implicit-check-not TU0_kernel --implicit-check-not _Z3foov \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-func-ptr.ll b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-func-ptr.ll index d36de8d1d3ff0..ae382c549783a 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-func-ptr.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/auto-module-split-func-ptr.ll @@ -4,7 +4,7 @@ ; RUN: FileCheck %s -input-file=%t_0.ll --check-prefix=CHECK-IR0 ; RUN: FileCheck %s -input-file=%t_1.ll --check-prefix=CHECK-IR1 -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefix=CHECK-SYM0 ; RUN: FileCheck %s -input-file=%t2_1.sym --check-prefix=CHECK-SYM1 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefix=CHECK-IR0 diff --git a/llvm/test/tools/sycl-post-link/device-code-split/basic-module-split.ll b/llvm/test/tools/sycl-post-link/device-code-split/basic-module-split.ll index f2898cbea387c..a1960b3933479 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/basic-module-split.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/basic-module-split.ll @@ -4,7 +4,7 @@ ; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-TU0-TXT ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-TU1-TXT -; RUN: sycl-module-split -split=source -S < %s -o %t2 +; RUN: llvm-split -sycl-split=source -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-TU0,CHECK ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-TU1,CHECK ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefixes CHECK-TU0-TXT diff --git a/llvm/test/tools/sycl-post-link/device-code-split/complex-indirect-call-chain.ll b/llvm/test/tools/sycl-post-link/device-code-split/complex-indirect-call-chain.ll index d2e2084ca2b34..6b207ae4679e2 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/complex-indirect-call-chain.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/complex-indirect-call-chain.ll @@ -12,7 +12,7 @@ ; RUN: --implicit-check-not @BAZ --implicit-check-not @kernel_B \ ; RUN: --implicit-check-not @kernel_C ; -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefix CHECK0 \ ; RUN: --implicit-check-not @foo --implicit-check-not @kernel_A \ ; RUN: --implicit-check-not @kernel_B --implicit-check-not @baz @@ -34,7 +34,7 @@ ; RUN: --implicit-check-not @BAZ --implicit-check-not @kernel_B \ ; RUN: --implicit-check-not @kernel_C ; -; RUN: sycl-module-split -split=source -S < %s -o %t2 +; RUN: llvm-split -sycl-split=source -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefix CHECK0 \ ; RUN: --implicit-check-not @foo --implicit-check-not @kernel_A \ ; RUN: --implicit-check-not @kernel_B --implicit-check-not @baz @@ -56,7 +56,7 @@ ; RUN: --implicit-check-not @BAZ --implicit-check-not @kernel_B \ ; RUN: --implicit-check-not @kernel_C ; -; RUN: sycl-module-split -split=kernel -S < %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefix CHECK0 \ ; RUN: --implicit-check-not @foo --implicit-check-not @kernel_A \ ; RUN: --implicit-check-not @kernel_B --implicit-check-not @baz diff --git a/llvm/test/tools/sycl-post-link/device-code-split/one-kernel-per-module.ll b/llvm/test/tools/sycl-post-link/device-code-split/one-kernel-per-module.ll index 26081964dd2e7..6dfd8155cd50c 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/one-kernel-per-module.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/one-kernel-per-module.ll @@ -6,7 +6,7 @@ ; RUN: FileCheck %s -input-file=%t.files_2.ll --check-prefixes CHECK-MODULE2,CHECK ; RUN: FileCheck %s -input-file=%t.files_2.sym --check-prefixes CHECK-MODULE2-TXT ; -; RUN: sycl-module-split -split=kernel -S < %s -o %t2.files +; RUN: llvm-split -sycl-split=kernel -S < %s -o %t2.files ; RUN: FileCheck %s -input-file=%t2.files_0.ll --check-prefixes CHECK-MODULE0,CHECK ; RUN: FileCheck %s -input-file=%t2.files_0.sym --check-prefixes CHECK-MODULE0-TXT ; RUN: FileCheck %s -input-file=%t2.files_1.ll --check-prefixes CHECK-MODULE1,CHECK diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-1.ll index 8c64029f5e1c2..f926b20d972e5 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-1.ll @@ -21,7 +21,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -49,7 +49,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 -; RUN: sycl-module-split -split=source -S < %s -o %t2 +; RUN: llvm-split -sycl-split=source -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -77,7 +77,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 -; RUN: sycl-module-split -split=kernel -S < %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-2.ll index 4962b19721790..7297cd0a8d35e 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-2.ll @@ -15,7 +15,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefix CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel3 -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2.table --check-prefix CHECK-TABLE ; ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefix CHECK-M0-SYMS \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-3.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-3.ll index 93dcf91b578ac..a7b1f3697931e 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-3.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-3.ll @@ -17,7 +17,7 @@ ; RUN: FileCheck %s -input-file=%t_1.ll --check-prefix CHECK-M1-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not bar -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2.table --check-prefix CHECK-TABLE ; ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefix CHECK-M0-SYMS \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-1.ll index b7d0bcfceeccd..ec30674cb5dbd 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-1.ll @@ -15,7 +15,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -35,7 +35,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -59,7 +59,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-SYMS-K1 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K2 \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-2.ll index 81fbd2a05df50..c5557b71b5228 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-2.ll @@ -16,7 +16,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K3 \ ; RUN: --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K2 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel3 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K3 \ @@ -36,7 +36,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K3 \ ; RUN: --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K2 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel3 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K3 \ @@ -60,7 +60,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-SYMS-K1 \ ; RUN: --implicit-check-not Kernel2 --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K2 \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-1.ll index 132568926dbce..bf6c16a83d82e 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-1.ll @@ -15,7 +15,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -35,7 +35,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -59,7 +59,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-SYMS-K1 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K2 \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-2.ll index ee8e9d1ead30a..b68b890d75010 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-2.ll @@ -16,7 +16,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K3 \ ; RUN: --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K2 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel3 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K3 \ @@ -36,7 +36,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K3 \ ; RUN: --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K2 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel3 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K3 \ @@ -60,7 +60,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-SYMS-K1 \ ; RUN: --implicit-check-not Kernel2 --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K2 \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-4.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-4.ll index b94c42e1f4d4f..6edef4ec46cce 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-4.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-4.ll @@ -16,7 +16,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -36,7 +36,7 @@ ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-SYMS-K1,CHECK-SYMS-K2 \ ; RUN: --implicit-check-not Kernel3 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K1,CHECK-IR-K2 \ @@ -60,7 +60,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-SYMS-K1 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel2 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-IR-K2 \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-5.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-5.ll index 0d9631af085d5..bbb04335155fc 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-5.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-joint-matrix-mad-5.ll @@ -33,7 +33,7 @@ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel5 --implicit-check-not Kernel6 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3,CHECK-IR-K5 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 \ ; RUN: --implicit-check-not Kernel4 --implicit-check-not Kernel6 @@ -85,7 +85,7 @@ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel5 --implicit-check-not Kernel6 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K3,CHECK-IR-K5 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 \ ; RUN: --implicit-check-not Kernel4 --implicit-check-not Kernel6 @@ -149,7 +149,7 @@ ; RUN: --implicit-check-not Kernel12 --implicit-check-not Kernel3 \ ; RUN: --implicit-check-not Kernel4 --implicit-check-not Kernel5 --implicit-check-not Kernel6 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-IR-K6 \ ; RUN: --implicit-check-not Kernel1 --implicit-check-not Kernel2 \ ; RUN: --implicit-check-not Kernel3 --implicit-check-not Kernel4 --implicit-check-not Kernel5 diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-1.ll index ca723e075d2c0..62c3a12ecd1ad 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-1.ll @@ -21,7 +21,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -49,7 +49,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=kernel -S %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -77,7 +77,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=source -S %s -o %t2 +; RUN: llvm-split -sycl-split=source -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-2.ll index a943450a2a459..0de5756f8f976 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-sub-group-size-split-2.ll @@ -16,7 +16,7 @@ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 \ ; RUN: --implicit-check-not kernel2 -; RUN: sycl-module-split -split=auto -S %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S %s -o %t2 ; RUN: FileCheck %s -input-file=%t2.table --check-prefix CHECK-TABLE ; ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefix CHECK-M0-SYMS \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-1.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-1.ll index 4b105faa24073..ce10dce67682c 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-1.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-1.ll @@ -21,7 +21,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -49,7 +49,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=source -S < %s -o %t2 +; RUN: llvm-split -sycl-split=source -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ @@ -77,7 +77,7 @@ ; RUN: FileCheck %s -input-file=%t_2.sym --check-prefixes CHECK-M2-SYMS \ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 -; RUN: sycl-module-split -split=kernel -S < %s -o %t2 +; RUN: llvm-split -sycl-split=kernel -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll --check-prefixes CHECK-M0-IR \ ; RUN: --implicit-check-not kernel0 --implicit-check-not kernel1 ; RUN: FileCheck %s -input-file=%t2_1.ll --check-prefixes CHECK-M1-IR \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-2.ll b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-2.ll index d453ba763ec3c..324f47a0d0c04 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-2.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/per-reqd-wg-size-split-2.ll @@ -15,7 +15,7 @@ ; RUN: --implicit-check-not kernel1 --implicit-check-not kernel2 \ ; RUN: --implicit-check-not kernel0 -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2.table --check-prefix CHECK-TABLE ; ; RUN: FileCheck %s -input-file=%t2_0.sym --check-prefix CHECK-M0-SYMS \ diff --git a/llvm/test/tools/sycl-post-link/device-code-split/split-with-kernel-declarations.ll b/llvm/test/tools/sycl-post-link/device-code-split/split-with-kernel-declarations.ll index 42dd9e980fe82..9f4f194437947 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/split-with-kernel-declarations.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/split-with-kernel-declarations.ll @@ -6,7 +6,7 @@ ; RUN: FileCheck %s -input-file=%t_0.sym --check-prefix CHECK-PER-SOURCE-SYM0 ; RUN: FileCheck %s -input-file=%t_1.sym --check-prefix CHECK-PER-SOURCE-SYM1 ; -; RUN: sycl-module-split -split=source -S < %s -o %t1 +; RUN: llvm-split -sycl-split=source -S < %s -o %t1 ; RUN: FileCheck %s -input-file=%t1.table --check-prefix CHECK-PER-SOURCE-TABLE ; RUN: FileCheck %s -input-file=%t1_0.sym --check-prefix CHECK-PER-SOURCE-SYM0 ; RUN: FileCheck %s -input-file=%t1_1.sym --check-prefix CHECK-PER-SOURCE-SYM1 @@ -17,7 +17,7 @@ ; RUN: FileCheck %s -input-file=%t2_1.sym --check-prefix CHECK-PER-KERNEL-SYM2 ; RUN: FileCheck %s -input-file=%t2_2.sym --check-prefix CHECK-PER-KERNEL-SYM0 ; -; RUN: sycl-module-split -split=kernel -S < %s -o %t3 +; RUN: llvm-split -sycl-split=kernel -S < %s -o %t3 ; RUN: FileCheck %s -input-file=%t3.table --check-prefix CHECK-PER-KERNEL-TABLE ; RUN: FileCheck %s -input-file=%t3_0.sym --check-prefix CHECK-PER-KERNEL-SYM1 ; RUN: FileCheck %s -input-file=%t3_1.sym --check-prefix CHECK-PER-KERNEL-SYM2 diff --git a/llvm/test/tools/sycl-post-link/device-code-split/vtable.ll b/llvm/test/tools/sycl-post-link/device-code-split/vtable.ll index 6d932aba577f9..27ed499748813 100644 --- a/llvm/test/tools/sycl-post-link/device-code-split/vtable.ll +++ b/llvm/test/tools/sycl-post-link/device-code-split/vtable.ll @@ -42,7 +42,7 @@ ; RUN: sycl-post-link -properties -split=auto -S < %s -o %t.table ; RUN: FileCheck %s -input-file=%t_0.ll ; -; RUN: sycl-module-split -split=auto -S < %s -o %t2 +; RUN: llvm-split -sycl-split=auto -S < %s -o %t2 ; RUN: FileCheck %s -input-file=%t2_0.ll ; ; CHECK-DAG: @_ZTV8Derived1 = {{.*}} @_ZN8Derived17displayEv diff --git a/llvm/tools/llvm-split/CMakeLists.txt b/llvm/tools/llvm-split/CMakeLists.txt index 1104e3145952c..d32892e6100e3 100644 --- a/llvm/tools/llvm-split/CMakeLists.txt +++ b/llvm/tools/llvm-split/CMakeLists.txt @@ -10,6 +10,7 @@ set(LLVM_LINK_COMPONENTS IRReader MC Support + SYCLLowerIR Target TargetParser ) diff --git a/llvm/tools/llvm-split/llvm-split.cpp b/llvm/tools/llvm-split/llvm-split.cpp index 39a89cb1d2e75..c4d4ea07ac4ea 100644 --- a/llvm/tools/llvm-split/llvm-split.cpp +++ b/llvm/tools/llvm-split/llvm-split.cpp @@ -17,9 +17,13 @@ #include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" #include "llvm/MC/TargetRegistry.h" +#include "llvm/SYCLLowerIR/ModuleSplitter.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/InitLLVM.h" +#include "llvm/Support/PropertySetIO.h" +#include "llvm/Support/SimpleTable.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Support/ToolOutputFile.h" @@ -64,6 +68,88 @@ static cl::opt MCPU("mcpu", cl::desc("Target CPU, ignored if -mtriple is not used"), cl::value_desc("cpu"), cl::cat(SplitCategory)); +cl::opt SYCLSplitMode( + "sycl-split", cl::desc("split input module"), cl::Optional, + cl::init(module_split::SPLIT_NONE), + cl::values(clEnumValN(module_split::SPLIT_PER_TU, "source", + "1 output module per source (translation unit)"), + clEnumValN(module_split::SPLIT_PER_KERNEL, "kernel", + "1 output module per kernel"), + clEnumValN(module_split::SPLIT_AUTO, "auto", + "Choose split mode automatically")), + cl::cat(SplitCategory)); + +cl::opt OutputAssembly{"S", cl::desc("Write output as LLVM assembly"), + cl::cat(SplitCategory)}; + +void writeStringToFile(const std::string &Content, StringRef Path) { + std::error_code EC; + raw_fd_ostream OS(Path, EC); + if (EC) { + errs() << formatv("error opening file: {0}\n", Path); + exit(1); + } + + OS << Content << "\n"; +} + +void writePropertiesToFile(const util::PropertySetRegistry &Properties, + StringRef Path) { + std::error_code EC; + raw_fd_ostream OS(Path, EC); + if (EC) { + errs() << formatv("error opening file: {0}\n", Path); + exit(1); + } + + Properties.write(OS); +} + +void dumpSplitModulesAsTable( + const std::vector &SplitModules, + StringRef Path) { + std::vector Columns = {"Code", "Properties", "Symbols"}; + auto TableOrErr = util::SimpleTable::create(Columns); + if (!TableOrErr) { + errs() << "can't create a table\n"; + exit(1); + } + + std::unique_ptr Table = std::move(*TableOrErr); + for (const auto &[I, SM] : enumerate(SplitModules)) { + std::string SymbolsFile = (Twine(Path) + "_" + Twine(I) + ".sym").str(); + std::string PropertiesFile = (Twine(Path) + "_" + Twine(I) + ".prop").str(); + writePropertiesToFile(SM.Properties, PropertiesFile); + writeStringToFile(SM.Symbols, SymbolsFile); + SmallVector Row = {SM.ModuleFilePath, PropertiesFile, + SymbolsFile}; + Table->addRow(Row); + } + + std::error_code EC; + raw_fd_ostream OS((Path + ".table").str(), EC); + if (EC) { + errs() << formatv("error opening file: {0}\n", Path); + exit(1); + } + + Table->write(OS); +} + +Error SYCLSplitModule(std::unique_ptr M) { + module_split::ModuleSplitterSettings Settings; + Settings.Mode = SYCLSplitMode; + Settings.OutputAssembly = OutputAssembly; + Settings.OutputPrefix = OutputFilename; + auto SplitModulesOrErr = + module_split::splitSYCLModule(std::move(M), Settings); + if (!SplitModulesOrErr) + return SplitModulesOrErr.takeError(); + + dumpSplitModulesAsTable(*SplitModulesOrErr, OutputFilename); + return Error::success(); +} + int main(int argc, char **argv) { InitLLVM X(argc, argv); @@ -117,6 +203,16 @@ int main(int argc, char **argv) { Out->keep(); }; + if (SYCLSplitMode != module_split::IRSplitMode::SPLIT_NONE) { + auto E = SYCLSplitModule(std::move(M)); + if (!E) { + errs() << E << "\n"; + Err.print(argv[0], errs()); + } + + return 0; + } + if (TM) { if (PreserveLocals) { errs() << "warning: -preserve-locals has no effect when using " diff --git a/llvm/tools/sycl-module-split/CMakeLists.txt b/llvm/tools/sycl-module-split/CMakeLists.txt deleted file mode 100644 index 0c29be481e538..0000000000000 --- a/llvm/tools/sycl-module-split/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(LLVM_LINK_COMPONENTS - Core - IRReader - Support - SYCLLowerIR - ) - -add_llvm_tool(sycl-module-split - sycl-module-split.cpp - ) diff --git a/llvm/tools/sycl-module-split/sycl-module-split.cpp b/llvm/tools/sycl-module-split/sycl-module-split.cpp deleted file mode 100644 index 89d8b9e10b2b7..0000000000000 --- a/llvm/tools/sycl-module-split/sycl-module-split.cpp +++ /dev/null @@ -1,130 +0,0 @@ -//==-- sycl-module-split: command line tool for testing SYCL Module Splitting // -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This program can be used only to test the SYCL Module Splitting. -// -//===----------------------------------------------------------------------===// - -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IRReader/IRReader.h" -#include "llvm/SYCLLowerIR/ModuleSplitter.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/FormatVariadic.h" -#include "llvm/Support/PropertySetIO.h" -#include "llvm/Support/SimpleTable.h" -#include "llvm/Support/SourceMgr.h" -#include "llvm/Support/raw_ostream.h" - -#include -#include - -using namespace llvm; -using namespace llvm::util; -using namespace module_split; - -static cl::OptionCategory SplitCategory("Split options"); - -static cl::opt InputFilename(cl::Positional, cl::desc(""), - cl::init("-"), - cl::value_desc("filename")); - -static cl::opt - OutputFilenamePrefix("o", cl::desc("output filename prefix"), - cl::value_desc("filename prefix"), cl::init("output"), - cl::cat(SplitCategory)); - -cl::opt OutputAssembly{"S", cl::desc("Write output as LLVM assembly"), - cl::cat(SplitCategory)}; - -cl::opt SplitMode( - "split", cl::desc("split input module"), cl::Optional, cl::init(SPLIT_NONE), - cl::values(clEnumValN(module_split::SPLIT_PER_TU, "source", - "1 output module per source (translation unit)"), - clEnumValN(module_split::SPLIT_PER_KERNEL, "kernel", - "1 output module per kernel"), - clEnumValN(module_split::SPLIT_AUTO, "auto", - "Choose split mode automatically")), - cl::cat(SplitCategory)); - -void writeStringToFile(const std::string &Content, StringRef Path) { - std::error_code EC; - raw_fd_ostream OS(Path, EC); - if (EC) { - errs() << formatv("error opening file: {0}\n", Path); - exit(1); - } - - OS << Content << "\n"; -} - -void writePropertiesToFile(const PropertySetRegistry &Properties, - StringRef Path) { - std::error_code EC; - raw_fd_ostream OS(Path, EC); - if (EC) { - errs() << formatv("error opening file: {0}\n", Path); - exit(1); - } - - Properties.write(OS); -} - -void dumpModulesAsTable(const std::vector &SplitModules, - StringRef Path) { - std::vector Columns = {"Code", "Properties", "Symbols"}; - auto TableOrErr = SimpleTable::create(Columns); - if (!TableOrErr) { - errs() << "can't create a table\n"; - exit(1); - } - - std::unique_ptr Table = std::move(*TableOrErr); - for (const auto &[I, SM] : enumerate(SplitModules)) { - std::string SymbolsFile = (Twine(Path) + "_" + Twine(I) + ".sym").str(); - std::string PropertiesFile = (Twine(Path) + "_" + Twine(I) + ".prop").str(); - writePropertiesToFile(SM.Properties, PropertiesFile); - writeStringToFile(SM.Symbols, SymbolsFile); - SmallVector Row = {SM.ModuleFilePath, PropertiesFile, - SymbolsFile}; - Table->addRow(Row); - } - - std::error_code EC; - raw_fd_ostream OS((Path + ".table").str(), EC); - if (EC) { - errs() << formatv("error opening file: {0}\n", Path); - exit(1); - } - - Table->write(OS); -} - -int main(int argc, char *argv[]) { - LLVMContext C; - SMDiagnostic Err; - cl::ParseCommandLineOptions(argc, argv, "SYCL Module Splitter\n"); - - std::unique_ptr M = parseIRFile(InputFilename, Err, C); - if (!M) { - Err.print(argv[0], errs()); - return 1; - } - - ModuleSplitterSettings Settings; - Settings.Mode = SplitMode; - Settings.OutputAssembly = OutputAssembly; - Settings.OutputPrefix = OutputFilenamePrefix; - auto SplitModulesOrErr = splitSYCLModule(std::move(M), Settings); - if (!SplitModulesOrErr) { - Err.print(argv[0], errs()); - return 1; - } - - dumpModulesAsTable(*SplitModulesOrErr, OutputFilenamePrefix); -} From 1ec6b57d4ccdbf84e8248f427fc51fd0b089f3bd Mon Sep 17 00:00:00 2001 From: "Sabianin, Maksim" Date: Mon, 15 Jul 2024 06:19:17 -0700 Subject: [PATCH 2/2] remove sycl-module-split from test configuration --- llvm/test/CMakeLists.txt | 1 - llvm/test/lit.cfg.py | 1 - 2 files changed, 2 deletions(-) diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt index 603f33edaf761..95d55991731e3 100644 --- a/llvm/test/CMakeLists.txt +++ b/llvm/test/CMakeLists.txt @@ -146,7 +146,6 @@ set(LLVM_TEST_DEPENDS sanstats spirv-to-ir-wrapper sycl-post-link - sycl-module-split split-file verify-uselistorder yaml-bench diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index 1d35fdaa55bbe..c26ee26caa8e2 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -244,7 +244,6 @@ def get_asan_rtlib(): "sanstats", "llvm-remarkutil", "spirv-to-ir-wrapper", - "sycl-module-split", ] )