Skip to content

Commit 36ff05f

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (#1)
2 parents 9259d27 + 20248cf commit 36ff05f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+386
-292
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,8 @@ def fintelfpga : Flag<["-"], "fintelfpga">, Group<f_Group>,
18141814
def fsycl : Flag<["-"], "fsycl">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
18151815
HelpText<"generate SYCL code.">;
18161816
def fno_sycl : Flag<["-"], "fno-sycl">, Group<f_Group>, Flags<[NoArgumentUnused, CoreOption]>;
1817+
def fsycl_device_only : Flag<["-"], "fsycl-device-only">, Flags<[CoreOption]>,
1818+
HelpText<"Compile SYCL kernels for device">;
18171819
def fsycl_targets_EQ : CommaJoined<["-"], "fsycl-targets=">, Flags<[DriverOption, CC1Option, CoreOption]>,
18181820
HelpText<"Specify comma-separated list of triples SYCL offloading targets to be supported">;
18191821
def fsycl_add_targets_EQ : CommaJoined<["-"], "fsycl-add-targets=">, Flags<[DriverOption, CoreOption]>,
@@ -3399,10 +3401,6 @@ defm stack_arrays : BooleanFFlag<"stack-arrays">, Group<gfortran_Group>;
33993401
defm underscoring : BooleanFFlag<"underscoring">, Group<gfortran_Group>;
34003402
defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
34013403

3402-
def sycl_device_only : Flag<["-"], "fsycl-device-only">, Flags<[CoreOption]>,
3403-
HelpText<"Compile SYCL kernels for device">;
3404-
def sycl : Flag<["--"], "sycl">, Alias<sycl_device_only>, Flags<[CoreOption]>;
3405-
34063404
def reuse_exe_EQ : Joined<["-"], "reuse-exe=">,
34073405
HelpText<"Speed up FPGA aoc compile if the device code in <exe> is unchanged.">,
34083406
MetaVarName<"<exe>">;

clang/lib/Driver/Driver.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
299299

300300
// -S only runs up to the backend.
301301
} else if ((PhaseArg = DAL.getLastArg(options::OPT_S)) ||
302-
(PhaseArg = DAL.getLastArg(options::OPT_sycl_device_only))) {
302+
(PhaseArg = DAL.getLastArg(options::OPT_fsycl_device_only))) {
303303
FinalPhase = phases::Backend;
304304

305305
// -c compilation only runs up to the assembler.
@@ -730,7 +730,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
730730
// Use of -fsycl-device-only overrides -fsycl.
731731
bool HasValidSYCLRuntime = (C.getInputArgs().hasFlag(options::OPT_fsycl,
732732
options::OPT_fno_sycl, false) &&
733-
!C.getInputArgs().hasArg(options::OPT_sycl_device_only));
733+
!C.getInputArgs().hasArg(options::OPT_fsycl_device_only));
734734

735735
// A mechanism for retrieving SYCL-specific options, erroring out
736736
// if SYCL offloading wasn't enabled prior to that
@@ -755,22 +755,20 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
755755

756756
// -fsycl-targets cannot be used with -fsycl-link-targets
757757
if (SYCLTargets && SYCLLinkTargets)
758-
Diag(clang::diag::err_drv_option_conflict) << SYCLTargets->getSpelling()
759-
<< SYCLLinkTargets->getSpelling();
758+
Diag(clang::diag::err_drv_option_conflict)
759+
<< SYCLTargets->getSpelling() << SYCLLinkTargets->getSpelling();
760760
// -fsycl-link-targets and -fsycl-add-targets cannot be used together
761761
if (SYCLLinkTargets && SYCLAddTargets)
762-
Diag(clang::diag::err_drv_option_conflict) << SYCLLinkTargets->getSpelling()
763-
<< SYCLAddTargets->getSpelling();
762+
Diag(clang::diag::err_drv_option_conflict)
763+
<< SYCLLinkTargets->getSpelling() << SYCLAddTargets->getSpelling();
764764
// -fsycl-link-targets is not allowed with -fsycl-link
765765
if (SYCLLinkTargets && SYCLLink)
766766
Diag(clang::diag::err_drv_option_conflict)
767-
<< C.getInputArgs().getLastArg(options::OPT_fsycl_link_EQ)->getSpelling()
768-
<< SYCLLinkTargets->getSpelling();
767+
<< SYCLLink->getSpelling() << SYCLLinkTargets->getSpelling();
769768
// -fsycl-targets cannot be used with -fintelfpga
770769
if (SYCLTargets && SYCLfpga)
771770
Diag(clang::diag::err_drv_option_conflict)
772-
<< SYCLTargets->getSpelling()
773-
<< C.getInputArgs().getLastArg(options::OPT_fintelfpga)->getSpelling();
771+
<< SYCLTargets->getSpelling() << SYCLfpga->getSpelling();
774772

775773
bool HasSYCLTargetsOption = SYCLTargets || SYCLLinkTargets || SYCLAddTargets;
776774
llvm::StringMap<StringRef> FoundNormalizedTriples;
@@ -1203,8 +1201,8 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
12031201
T.setObjectFormat(llvm::Triple::COFF);
12041202
TargetTriple = T.str();
12051203
}
1206-
if (Args.hasArg(options::OPT_sycl_device_only)) {
1207-
// --sycl implies spir arch and SYCL Device
1204+
if (Args.hasArg(options::OPT_fsycl_device_only)) {
1205+
// -fsycl-device-only implies spir arch and SYCL Device
12081206
llvm::Triple T(TargetTriple);
12091207
// FIXME: defaults to spir64, should probably have a way to set spir
12101208
// possibly new -sycl-target option
@@ -4488,12 +4486,12 @@ Action *Driver::ConstructPhaseAction(
44884486
Args.hasArg(options::OPT_S) ? types::TY_LLVM_IR : types::TY_LLVM_BC;
44894487
return C.MakeAction<BackendJobAction>(Input, Output);
44904488
}
4491-
if (Args.hasArg(options::OPT_sycl_device_only)) {
4489+
if (Args.hasArg(options::OPT_fsycl_device_only)) {
44924490
if (Args.hasFlag(options::OPT_fsycl_use_bitcode,
44934491
options::OPT_fno_sycl_use_bitcode, true))
44944492
return C.MakeAction<BackendJobAction>(Input, types::TY_LLVM_BC);
4495-
// Use of --sycl creates a bitcode file, we need to translate that to
4496-
// a SPIR-V file with -fno-sycl-use-bitcode
4493+
// Use of -fsycl-device-only creates a bitcode file, we need to translate
4494+
// that to a SPIR-V file with -fno-sycl-use-bitcode
44974495
auto *BackendAction =
44984496
C.MakeAction<BackendJobAction>(Input, types::TY_LLVM_BC);
44994497
return C.MakeAction<SPIRVTranslatorJobAction>(BackendAction,

clang/lib/Driver/Types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void types::getCompilationPhases(const clang::driver::Driver &Driver,
362362

363363
else if (DAL.getLastArg(options::OPT_S) ||
364364
DAL.getLastArg(options::OPT_emit_llvm) ||
365-
DAL.getLastArg(options::OPT_sycl_device_only))
365+
DAL.getLastArg(options::OPT_fsycl_device_only))
366366
llvm::copy_if(PhaseList, std::back_inserter(P),
367367
[](phases::ID Phase) { return Phase <= phases::Backend; });
368368

clang/test/CodeGenSYCL/address-space-swap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang --sycl -S -emit-llvm -x c++ %s -o - | FileCheck %s
1+
// RUN: %clang -fsycl-device-only -S -emit-llvm -x c++ %s -o - | FileCheck %s
22
#include <algorithm>
33

44

clang/test/CodeGenSYCL/debug-info-srcpos-kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang --sycl %s -S -I %S/Inputs -emit-llvm -g -o - | FileCheck %s
1+
// RUN: %clang -fsycl-device-only %s -S -I %S/Inputs -emit-llvm -g -o - | FileCheck %s
22
//
33
// Verify the SYCL kernel routine is marked artificial and has no source
44
// correlation.

clang/test/CodeGenSYCL/fpga_pipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang %s -S -emit-llvm --sycl -o - | FileCheck %s
1+
// RUN: %clang %s -S -emit-llvm -fsycl-device-only -o - | FileCheck %s
22
#include "CL/sycl.hpp"
33
// CHECK: %opencl.pipe_wo_t
44
// CHECK: %opencl.pipe_ro_t

clang/test/CodeGenSYCL/inlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang --sycl %s -S -emit-llvm -o - | FileCheck %s
1+
// RUN: %clang -fsycl-device-only %s -S -emit-llvm -o - | FileCheck %s
22

33
template <typename name, typename Func>
44
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {

clang/test/CodeGenSYCL/int_header1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33

44
// CHECK:template <> struct KernelInfo<class KernelName> {

clang/test/CodeGenSYCL/int_header_inline_ns.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33

44
// This test checks if the SYCL device compiler is able to generate correct

clang/test/CodeGenSYCL/integration_header.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33
//
44
// CHECK: #include <CL/sycl/detail/kernel_desc.hpp>

clang/test/CodeGenSYCL/intel-restrict.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang %s -S -emit-llvm --sycl -o - | FileCheck %s
1+
// RUN: %clang %s -S -emit-llvm -fsycl-device-only -o - | FileCheck %s
22

33
#include "CL/sycl.hpp"
44

clang/test/CodeGenSYCL/kernel_functor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs -std=c++11 --sycl -Xclang -fsycl-int-header=%t.h %s -c -o %t.spv
1+
// RUN: %clang -I %S/Inputs -std=c++11 -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o %t.spv
22
// RUN: FileCheck %s --input-file=%t.h
33

44
// Checks that functors are supported as SYCL kernels.

clang/test/CodeGenSYCL/kernel_name_with_typedefs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33

44
#include "sycl.hpp"

clang/test/CodeGenSYCL/skip-host-classes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang --sycl -c %s -o %t.ll -Xclang -fsycl-int-header=%t.hpp -emit-llvm -S
1+
// RUN: %clang -fsycl-device-only -c %s -o %t.ll -Xclang -fsycl-int-header=%t.hpp -emit-llvm -S
22
// RUN: FileCheck < %t.ll %s --check-prefix=CHECK
33

44
// CHECK-NOT: declare dso_local spir_func void {{.+}}test{{.+}}printer{{.+}}

clang/test/CodeGenSYCL/struct_kernel_param.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33

44
// CHECK: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/template-template-parameter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s
22
// RUN: FileCheck -input-file=%t.h %s
33

44
#include <sycl.hpp>

clang/test/CodeGenSYCL/usm-int-header.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -std=c++11 -I %S/Inputs -fsycl-is-device -ast-dump %s | FileCheck %s
2-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
2+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv
33
// RUN: FileCheck -input-file=%t.h %s --check-prefix=INT-HEADER
44

55
// INT-HEADER:{ kernel_param_kind_t::kind_pointer, 8, 0 },

clang/test/CodeGenSYCL/wrapped-accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
1+
// RUN: %clang -I %S/Inputs -fsycl-device-only -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
22
// RUN: FileCheck -input-file=%t.h %s
33
//
44
// CHECK: #include <CL/sycl/detail/kernel_desc.hpp>

clang/test/Driver/sycl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// RUN: %clang -### --sycl -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
2-
// RUN: %clang -### --sycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
1+
// RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
2+
// RUN: %clang -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
33
// RUN: %clang -### -fsycl-device-only -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
4-
// RUN: %clang -### --sycl -fno-sycl-use-bitcode -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE
4+
// RUN: %clang -### -fsycl-device-only -fno-sycl-use-bitcode -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE
55
// RUN: %clang -### -target spir64-unknown-linux-sycldevice -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=TARGET
6-
// RUN: %clang -### --sycl -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=COMBINED
6+
// RUN: %clang -### -fsycl-device-only -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=COMBINED
77
// RUN: %clangxx -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
88
// RUN: %clang_cl -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
99

clang/test/Driver/windows-compat-sycl-args.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -### --sycl -target x86_64-unknown-windows-msvc -c %s 2>&1 | FileCheck %s
1+
// RUN: %clang -### -fsycl-device-only -target x86_64-unknown-windows-msvc -c %s 2>&1 | FileCheck %s
22
// CHECK: -fms-compatibility
33
// CHECK: -fdelayed-template-parsing
44
// expected-no-diagnostics

clang/test/SemaSYCL/intel-restrict.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang %s -fsyntax-only --sycl -DCHECKDIAG -Xclang -verify
2-
// RUN: %clang %s -fsyntax-only -Xclang -ast-dump --sycl | FileCheck %s
1+
// RUN: %clang %s -fsyntax-only -fsycl-device-only -DCHECKDIAG -Xclang -verify
2+
// RUN: %clang %s -fsyntax-only -Xclang -ast-dump -fsycl-device-only | FileCheck %s
33

44
[[intel::kernel_args_restrict]] // expected-warning{{'kernel_args_restrict' attribute ignored}}
55
void func_ignore() {}

clang/test/SemaSYCL/sampler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang -S -I %S/Inputs --sycl -Xclang -ast-dump %s | FileCheck %s
1+
// RUN: %clang -S -I %S/Inputs -fsycl-device-only -Xclang -ast-dump %s | FileCheck %s
22

33
#include <sycl.hpp>
44

sycl/include/CL/sycl/detail/event_impl.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace detail {
2222
class context_impl;
2323
using ContextImplPtr = std::shared_ptr<cl::sycl::detail::context_impl>;
2424
class queue_impl;
25+
using QueueImplPtr = std::shared_ptr<cl::sycl::detail::queue_impl>;
2526

2627
// Profiling info for the host execution.
2728
class HostProfilingInfo {
@@ -40,7 +41,7 @@ class event_impl {
4041
public:
4142
event_impl() = default;
4243
event_impl(cl_event CLEvent, const context &SyclContext);
43-
event_impl(std::shared_ptr<cl::sycl::detail::queue_impl> Queue);
44+
event_impl(QueueImplPtr Queue);
4445

4546
// Threat all devices that don't support interoperability as host devices to
4647
// avoid attempts to call method get on such events.
@@ -87,6 +88,7 @@ class event_impl {
8788
private:
8889
RT::PiEvent m_Event = nullptr;
8990
ContextImplPtr m_Context;
91+
QueueImplPtr m_Queue;
9092
bool m_OpenCLInterop = false;
9193
bool m_HostEvent = true;
9294
std::unique_ptr<HostProfilingInfo> m_HostProfilingInfo;

sycl/include/CL/sycl/detail/queue_impl.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,26 @@ class queue_impl {
9595
template <typename T>
9696
event submit(T cgf, std::shared_ptr<queue_impl> self,
9797
std::shared_ptr<queue_impl> second_queue) {
98-
event Event;
9998
try {
100-
Event = submit_impl(cgf, self);
99+
return submit_impl(cgf, self);
101100
} catch (...) {
102101
{
103102
std::lock_guard<mutex_class> guard(m_Mutex);
104103
m_Exceptions.PushBack(std::current_exception());
105104
}
106-
Event = second_queue->submit(cgf, second_queue);
105+
return second_queue->submit(cgf, second_queue);
107106
}
108-
return Event;
109107
}
110108

111109
template <typename T> event submit(T cgf, std::shared_ptr<queue_impl> self) {
112-
event Event;
113110
try {
114-
Event = submit_impl(cgf, self);
111+
return submit_impl(cgf, self);
115112
} catch (...) {
116113
std::lock_guard<mutex_class> guard(m_Mutex);
117114
m_Exceptions.PushBack(std::current_exception());
115+
return event(
116+
createSyclObjFromImpl<event>(std::make_shared<event_impl>(self)));
118117
}
119-
return Event;
120118
}
121119

122120
void wait() {

0 commit comments

Comments
 (0)