Skip to content

Commit 1a52f1a

Browse files
authored
[SYCL][doc][NFC] Update doc and usage of -fsycl-device-obj (#10432)
The -fsycl-device-obj option replaces the -fsycl-use-bitcode option. The -fsycl-use-bitcode option is deprecated as well. Update the documentation to reflect this fact, also update any testing using the older option with a replacement of the new option. The use of -fsycl-use-bitcode should also emit the proper deprecation message when used on the command line.
1 parent c1d3d7c commit 1a52f1a

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,11 +3151,13 @@ def fsycl_device_obj_EQ : Joined<["-"], "fsycl-device-obj=">,
31513151
"device code stored in the resulting object. Valid values are: spirv, llvmir "
31523152
"(default)">;
31533153
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
3154-
Alias<fsycl_device_obj_EQ>, AliasArgs<["llvmir"]>, Flags<[CoreOption]>,
3155-
HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects">;
3154+
Alias<fsycl_device_obj_EQ>, AliasArgs<["llvmir"]>,
3155+
Flags<[CoreOption, Deprecated]>,
3156+
HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects (deprecated)">;
31563157
def fno_sycl_use_bitcode : Flag<["-"], "fno-sycl-use-bitcode">,
3157-
Alias<fsycl_device_obj_EQ>, AliasArgs<["spirv"]>, Flags<[CoreOption]>,
3158-
HelpText<"Use SPIR-V instead of LLVM bitcode in fat objects">;
3158+
Alias<fsycl_device_obj_EQ>, AliasArgs<["spirv"]>,
3159+
Flags<[CoreOption, Deprecated]>,
3160+
HelpText<"Use SPIR-V instead of LLVM bitcode in fat objects (deprecated)">;
31593161
def fsycl_link_EQ : Joined<["-"], "fsycl-link=">,
31603162
Flags<[CC1Option, CoreOption]>, HelpText<"Generate partially linked device and host object to be used at various stages of compilation">, Values<"image,early">;
31613163
def fsycl_link : Flag<["-"], "fsycl-link">, Alias<fsycl_link_EQ>,

clang/test/Driver/sycl-deprecated.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %clangxx -fno-sycl-explicit-simd %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-explicit-simd
44
// RUN: %clangxx -fsycl -fsycl-link-huge-device-code %s -### 2>&1 | FileCheck %s -DOPTION=-fsycl-link-huge-device-code
55
// RUN: %clangxx -fsycl -fno-sycl-link-huge-device-code %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-link-huge-device-code
6+
// RUN: %clangxx -fsycl -fsycl-use-bitcode %s -### 2>&1 | FileCheck %s -DOPTION=-fsycl-use-bitcode
7+
// RUN: %clangxx -fsycl -fno-sycl-use-bitcode %s -### 2>&1 | FileCheck %s -DOPTION=-fno-sycl-use-bitcode
68
// CHECK: option '[[OPTION]]' is deprecated and will be removed in a future release
79

810
// RUN: %clangxx -fsycl -sycl-std=1.2.1 %s -### 2>&1 \

clang/test/Driver/sycl-offload-with-split.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
/// We should have an offload action joining the host compile and device
1111
/// preprocessor and another one joining the device linking outputs to the host
1212
/// action. The same graph should be generated when no -fsycl-targets is used
13-
/// The same phase graph will be used with -fsycl-use-bitcode
13+
/// The same phase graph will be used with -fsycl-device-obj=llvmir
1414
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
1515
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
1616
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
1717
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
18-
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fno-sycl-use-bitcode %s 2>&1 \
18+
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-device-obj=spirv %s 2>&1 \
1919
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
20-
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fno-sycl-use-bitcode %s 2>&1 \
20+
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-device-obj=spirv %s 2>&1 \
2121
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
22-
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-use-bitcode %s 2>&1 \
22+
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-device-obj=llvmir %s 2>&1 \
2323
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
24-
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-use-bitcode %s 2>&1 \
24+
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-device-code-split=per_source -fsycl-device-obj=llvmir %s 2>&1 \
2525
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
2626
// CHK-PHASES: 0: input, "[[INPUT:.+\.c]]", c++, (host-sycl)
2727
// CHK-PHASES: 1: append-footer, {0}, c++, (host-sycl)

clang/test/Driver/sycl-offload.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,18 @@
100100
/// We should have an offload action joining the host compile and device
101101
/// preprocessor and another one joining the device linking outputs to the host
102102
/// action. The same graph should be generated when no -fsycl-targets is used
103-
/// The same phase graph will be used with -fsycl-use-bitcode
103+
/// The same phase graph will be used with -fsycl-device-obj=llvmir
104104
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64-unknown-unknown -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
105105
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
106106
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fsycl-targets=spir64-unknown-unknown -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
107107
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
108-
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-use-bitcode -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
108+
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fsycl-device-obj=spirv -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
109109
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
110-
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-use-bitcode -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
110+
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fsycl-device-obj=spirv -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
111111
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
112-
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fsycl-use-bitcode -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
112+
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -fsycl -fsycl-device-obj=llvmir -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
113113
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-DEFAULT-MODE %s
114-
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fsycl-use-bitcode -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
114+
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -fsycl-device-obj=llvmir -fno-sycl-instrument-device-code -fno-sycl-device-lib=all %s 2>&1 \
115115
// RUN: | FileCheck -check-prefixes=CHK-PHASES,CHK-PHASES-CL-MODE %s
116116
// CHK-PHASES: 0: input, "[[INPUT:.+\.c]]", c++, (host-sycl)
117117
// CHK-PHASES: 1: append-footer, {0}, c++, (host-sycl)
@@ -298,10 +298,10 @@
298298
/// ###########################################################################
299299

300300
/// Check -fsycl-is-device and emitting to .spv when compiling for the device
301-
/// when using -fno-sycl-use-bitcode
302-
// RUN: %clang -### -fno-sycl-use-bitcode -fsycl -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
301+
/// when using -fsycl-device-obj=spirv
302+
// RUN: %clang -### -fsycl-device-obj=spirv -fsycl -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
303303
// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE-NO-BITCODE %s
304-
// RUN: %clang_cl -### -fno-sycl-use-bitcode -fsycl -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
304+
// RUN: %clang_cl -### -fsycl-device-obj=spirv -fsycl -fsycl-targets=spir64-unknown-unknown %s 2>&1 \
305305
// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE-NO-BITCODE %s
306306

307307
// CHK-FSYCL-IS-DEVICE-NO-BITCODE: clang{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc" {{.*}}.c

clang/test/Driver/sycl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir64
3333
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only -S %s 2>&1 | FileCheck %s --check-prefix=TEXTUAL -DSPIRARCH=spir64
3434
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir64
35-
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only -fno-sycl-use-bitcode -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE -DSPIRARCH=spir64
35+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only -fsycl-device-obj=spirv -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE -DSPIRARCH=spir64
3636
// RUN: %clang -### -target spir64-unknown-linux -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=TARGET -DSPIRARCH=spir64
3737
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl-device-only -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=COMBINED -DSPIRARCH=spir64
3838
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir64
@@ -43,7 +43,7 @@
4343
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir
4444
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only -S %s 2>&1 | FileCheck %s --check-prefix=TEXTUAL -DSPIRARCH=spir
4545
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir
46-
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only -fno-sycl-use-bitcode -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE -DSPIRARCH=spir
46+
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only -fsycl-device-obj=spirv -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE -DSPIRARCH=spir
4747
// RUN: %clang -### -target spir-unknown-linux -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=TARGET -DSPIRARCH=spir
4848
// RUN: %clang -### -target i386-unknown-linux-gnu -fsycl-device-only -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=COMBINED -DSPIRARCH=spir
4949
// RUN: %clangxx -### -target i386-unknown-linux-gnu -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -DSPIRARCH=spir

sycl/doc/UsersManual.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,18 @@ and not recommended to use in production environment.
350350

351351
Compile only device part of the code and ignore host part.
352352

353-
**`-f[no-]sycl-use-bitcode`** [EXPERIMENTAL]
353+
**`-f[no-]sycl-use-bitcode`** [DEPRECATED]
354354

355355
Emit SYCL device code in LLVM-IR bitcode format. When disabled, SPIR-V is
356356
emitted.
357357
Enabled by default.
358358

359+
**`-fsycl-device-obj=<arg>`** [EXPERIMENTAL]
360+
361+
Specify format of device code stored in the resulting object. The <arg> can
362+
be one of the following: "spirv" - SPIR-V is emitted, "llvmir" - LLVM-IR
363+
bitcode format is emitted (default).
364+
359365
**`-fsycl-help[=backend]`**
360366

361367
Emit help information from device compiler backend. Backend can be one of

0 commit comments

Comments
 (0)