Closed
Description
The -fsycl-device-only
flag does not mark the driver actions as offloading.
As shown by -ccc-print-phases
, -fsycl-device-only
dismisses SYCL offloading
./bin/clang -fsycl-device-only foo.cpp -ccc-print-phases
+- 0: input, "foo.cpp", c++
+- 1: preprocessor, {0}, c++-cpp-output
+- 2: compiler, {1}, ir
3: backend, {2}, ir
Whereas with fsycl
(note the device-sycl not present before)
./bin/clang -fsycl foo.cpp -ccc-print-phases
+- 0: input, "foo.cpp", c++, (host-sycl)
+- 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
| +- 2: input, "foo.cpp", c++, (device-sycl)
| +- 3: preprocessor, {2}, c++-cpp-output, (device-sycl)
|- 4: compiler, {3}, sycl-header, (device-sycl)
+- 5: offload, "host-sycl (x86_64-unknown-linux-gnu)" {1}, "device-sycl (spir64-unknown-unknown-sycldevice)" {4}, c++-cpp-output
+- 6: compiler, {5}, ir, (host-sycl)
+- 7: backend, {6}, assembler, (host-sycl)
+- 8: assembler, {7}, object, (host-sycl)
+- 9: linker, {8}, image, (host-sycl)
| +- 10: compiler, {3}, ir, (device-sycl)
| +- 11: linker, {10}, ir, (device-sycl)
| +- 12: sycl-post-link, {11}, tempfiletable, (device-sycl)
| | +- 13: file-table-tform, {12}, tempfilelist, (device-sycl)
| |- 14: llvm-spirv, {13}, tempfilelist, (device-sycl)
| +- 15: file-table-tform, {12, 14}, tempfiletable, (device-sycl)
|- 16: clang-offload-wrapper, {15}, object, (device-sycl)
17: offload, "host-sycl (x86_64-unknown-linux-gnu)" {9}, "device-sycl (spir64-unknown-unknown-sycldevice)" {16}, image
The problem it raises is this makes the Clang::ConstructJob
kind of convoluted and leads to the target triple being used to define the source language/programing model of the input file (due to UseSYCLTriple
).
For instance,
$ cat foo.c
void foo() {}
$ ./bin/clang -target spir64-unknown-unknown foo.c -emit-llvm -c -S -o -
; ModuleID = 'foo.c'
source_filename = "foo.c"
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"
; Function Attrs: noinline nounwind optnone
define dso_local spir_func void @foo() #0 {
entry:
ret void
}
attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 11.0.0"}
$ ./bin/clang -target spir64-unknown-unknown-sycldevice foo.c -emit-llvm -c -S -o -
; ModuleID = 'foo.c'
source_filename = "foo.c"
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-sycldevice"
!llvm.module.flags = !{!0}
!opencl.spir.version = !{!1}
!spirv.Source = !{!2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 1, i32 2}
!2 = !{i32 4, i32 100000}
!3 = !{!"clang version 11.0.0"}
Metadata
Metadata
Assignees
Labels
No labels