Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7f05718
[SYCL] Initial printf support for non-constant AS format strings
Nov 23, 2021
0039b2c
Code style & a few conceptual upgrades
Dec 2, 2021
a24796d
Register the pass with the new pass manager
Dec 3, 2021
b5dc85a
Merge remote-tracking branch 'intel/sycl' into printf-address-space
Dec 6, 2021
f134ee8
Ensure correct llvm::Type* for literal & more refactoring
Dec 8, 2021
c16fcbb
Improve the function search
Dec 8, 2021
41eaf3b
Ugly implementation for the O1 case
Dec 8, 2021
a26f7c8
Extend value stripping to loads/stores for O0 cases
Dec 9, 2021
9150b8d
Replace call operands instead of re-creating calls
Dec 9, 2021
f467434
Huge refactoring
Dec 9, 2021
00066b6
More refactoring & descriptive comments added
Dec 9, 2021
896f296
Fix comment style
Dec 9, 2021
2fa7434
Refactor getCASLiteral back to being a function
Dec 9, 2021
ac0372b
Merge remote-tracking branch 'intel/sycl' into printf-address-space
Dec 10, 2021
1e83f16
Avoid "null character SetName" assertions caused by StringRef specifics
Dec 13, 2021
5c5b875
Improve formatting
Dec 13, 2021
e5ae867
Avoid using the error-prone Module::getOrInsertGlobal w/ callback
Dec 14, 2021
39efbb4
Wrap the newly created globals into constant pointer casts if needed
Dec 14, 2021
4d1c6be
Replace the wrapper calls directly with builtin calls
Dec 14, 2021
87d4137
Add LIT tests
Dec 13, 2021
6c8122b
Simplify call replacing (since we're always dealing with constants)
Dec 15, 2021
c1563da
Correct registration with the new PM & run LITs with that as well
Dec 15, 2021
f783309
[Review] Move/rename the LIT tests
Dec 16, 2021
52f7ca7
[Review] Address LIT-related comments
Dec 16, 2021
a37be74
[Review] Address code comments, pt. I
Dec 16, 2021
d2fb5f9
[Review][RFC] Address code comments, pt. II
Dec 16, 2021
6959690
[Review] Address code comments, pt. III
Dec 16, 2021
dd68d58
[Review] Update CODEOWNERS
Dec 16, 2021
d74fb42
[Review] Address code comments, pt. IV
Dec 16, 2021
040752c
[Review] Update the comment section in builtins.hpp
Dec 16, 2021
ee76f9d
Fix LIT setup for negative checks & factor them out into a separate test
Dec 20, 2021
1e3493e
Remove unneeded CHECK-NOT's from regular LIT
Dec 20, 2021
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
6 changes: 1 addition & 5 deletions llvm/test/SYCLLowerIR/printf_addrspace/generic_as.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; SYCLMutatePrintfAddrspacePass turned off):
;; clang++ -fsycl -fsycl-device-only Inputs/experimental-printf.cpp -S -D__SYCL_USE_NON_VARIADIC_SPIRV_OCL_PRINTF__ -O2

; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s --implicit-check-not=obsolete
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s

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"
Expand Down Expand Up @@ -36,10 +36,6 @@ entry:
ret void
}

; Make sure the non-variadic declarations have been wiped out
; in favor of the single variadic one:
; obsolete: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, float)
; obsolete: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, i32)
; CHECK: declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)*, ...)

; Function Attrs: convergent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; generic_as.ll
; RUN: opt < %S/generic_as.ll --SYCLMutatePrintfAddrspace -S | FileCheck %s --check-prefix=CHECK-BUILTIN
; RUN: opt < %S/generic_as.ll --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s --check-prefix=CHECK-BUILTIN

; generic_as_no_opt.ll
; RUN: opt < %S/generic_as_no_opt.ll --SYCLMutatePrintfAddrspace -S | FileCheck %s --check-prefixes=CHECK-WRAPPER,CHECK-BUILTIN
; RUN: opt < %S/generic_as_no_opt.ll --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s --check-prefixes=CHECK-WRAPPER,CHECK-BUILTIN

; generic_as_variadic.ll
; RUN: opt < %S/generic_as_variadic.ll --SYCLMutatePrintfAddrspace -S | FileCheck %s --check-prefix=CHECK-BUILTIN
; RUN: opt < %S/generic_as_variadic.ll --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s --check-prefix=CHECK-BUILTIN

; Check that the wrapper bodies have been deleted after call replacement
; CHECK-WRAPPER-NOT: spir_func i32 @{{.*}}sycl{{.*}}printf

; Make sure the generic AS declarations have been wiped out
; in favor of the single constant AS & variadic declaration:
; CHECK-BUILTIN-NOT: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, {{.+}})
17 changes: 8 additions & 9 deletions llvm/test/SYCLLowerIR/printf_addrspace/generic_as_no_opt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
;; SYCLMutatePrintfAddrspacePass turned off):
;; clang++ -fsycl -fsycl-device-only Inputs/experimental-printf.cpp -S -O0 -D__SYCL_USE_NON_VARIADIC_SPIRV_OCL_PRINTF__

; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s --implicit-check-not=obsolete
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s --implicit-check-not=obsolete
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s

; Check that the wrapper bodies have been deleted after call replacement
; CHECK-NOT: spir_func i32 @{{.*}}sycl{{.*}}printf
; Make sure the non-variadic declarations have been wiped out
; in favor of the single variadic one:
; CHECK-NOT: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, {{[:alnum:]+}})

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"
Expand Down Expand Up @@ -321,13 +327,6 @@ entry:
ret void
}

; Check that the wrapper bodies have been deleted after call replacement
; obsolete: spir_func i32 @{{.*}}sycl{{.*}}printf

; Make sure the non-variadic declarations have been wiped out
; in favor of the single variadic one:
; obsolete: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, float)
; obsolete: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, i32)
; CHECK-LABEL: declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)*, ...)

; Function Attrs: convergent mustprogress noinline norecurse optnone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
;; __spirv_ocl_printf at the regular O2 optimization level.
;; Note: this test's checks are almost identical to those for non-variadic version
;; of pre-transformation printf functions. However, we can't exclude argument promotion
;; here since it has been enforced by FE. Also, distinct negative checks are required
;; for deletion of obsolete declarations.
;; here since it has been enforced by FE.

;; Compiled with the following command (custom build of SYCL Clang with
;; SYCLMutatePrintfAddrspacePass turned off):
;; clang++ -fsycl -fsycl-device-only Inputs/experimental-printf.cpp -S -O2

; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s --implicit-check-not=obsolete
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s --implicit-check-not=obsolete
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S | FileCheck %s
; RUN: opt < %s --SYCLMutatePrintfAddrspace -S --enable-new-pm=1 | FileCheck %s

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"
Expand Down Expand Up @@ -38,8 +37,6 @@ entry:
ret void
}

; Make sure the generic addrspace declaration has been replaced:
; obsolete: declare dso_local spir_func i32 @_Z18__spirv_ocl_printf{{.*}}(i8 addrspace(4)*, ...)
; CHECK: declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)*, ...)
; Function Attrs: convergent
declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPKcz(i8 addrspace(4)*, ...) local_unnamed_addr #1
Expand Down