Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream commits done since public release #23

Merged
merged 22 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fcd5147
[SYCL] Language restrictions for SYCL kernel functions from 6.3 section
Feb 6, 2019
8f99175
[SYCL] Added constexpr specifier to standard functions declarations i…
Fznamznon Feb 6, 2019
54ea24f
[SYCL] Fix incorrect line information in SYCL device code debug info
bwyma Feb 6, 2019
a2a72e3
[SYCL] Add support for -fsycl-use-bitcode
mdtoguchi Feb 6, 2019
6bbed7a
[SYCL] Improve SYCL vector implementation
hidekisaito Feb 6, 2019
53df010
[SYCL] Switch to use of SPIR-V encoding for indexing built-ins.
romanovvlad Feb 6, 2019
24bb692
[SYCL] Moved Scheduler::getInstance method to library to make it uniq…
romanovvlad Feb 6, 2019
d13ed45
[SYCL] Avoid OpenCL API call in cl::sycl::queue::get_info() on host d…
schittir Feb 6, 2019
66908dc
[SYCL] Add floor and ceil math built-in's
alexeyvoronov-intel Feb 6, 2019
ee63634
[SYCL] Use encoding in SPIR-V for subgroup methods.
vladimirlaz Feb 7, 2019
168223e
[SYCL] Fix bug in vector swizzles.
againull Feb 7, 2019
36d4d1d
[SYCL] Fix program class always getting a built OpenCL program from p…
sergey-semenov Feb 7, 2019
c701af3
[SYCL] Emulating OOO execution for in-order queues.
MrSidims Feb 7, 2019
310b3e2
[SYCL] Added missing wait(), wait_and_throw(), get_wait_list() method…
v-klochkov Feb 7, 2019
7a18373
[SYCL] Add __SYCL_COMPILER_VERSION macro
sergey-semenov Feb 7, 2019
bbd85f2
[SYCL] Merge host and device context to impl context.
alexeyvoronov-intel Feb 7, 2019
540fe39
[SYCL] Add getHandleRef method to the context_impl class.
alexeyvoronov-intel Feb 7, 2019
6d1e297
[SYCL] Use context passed to queue instead of new one.
alexeyvoronov-intel Feb 7, 2019
1964034
[SYCL] Change Indexer to use C++11 feature, from C++14.
hidekisaito Feb 7, 2019
035a63d
[SYCL] Remove the INLINE_IF_DEVICE workaround
sergey-semenov Feb 7, 2019
0a3a50f
[SYCL] Remove obsolete license file.
vladimirlaz Feb 7, 2019
79b8ccf
[SYCL] Change license to Apache 2.0 with LLVM exceptions.
vladimirlaz Feb 8, 2019
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
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -9532,13 +9532,15 @@ def err_sycl_restrict : Error<
"|use rtti"
"|use a non-const static data variable"
"|call a virtual function"
"|call a recursive function"
"|call through a function pointer"
"|allocate storage"
"|use exceptions"
"|use inline assembly}0">;
def err_sycl_virtual_types : Error<
"No class with a vtable can be used in a SYCL kernel or any code included in the kernel">;
def note_sycl_used_here : Note<"used here">;
def note_sycl_recursive_function_declared_here: Note<"function implemented using recursion declared here">;
def err_sycl_non_std_layout_type : Error<
"kernel parameter has non-standard layout class/struct type">;
} // end of sema component.
1 change: 1 addition & 0 deletions clang/include/clang/Basic/LangOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ LANGOPT(CUDADeviceApproxTranscendentals, 1, 0, "using approximate transcendental
LANGOPT(GPURelocatableDeviceCode, 1, 0, "generate relocatable device code")

LANGOPT(SYCL , 1, 0, "Generate code for SYCL device")
LANGOPT(SYCLUseBitcode , 1, 0, "Generate bitcode for SYCL")
LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,10 @@ def fsycl_add_targets_EQ : CommaJoined<["-"], "fsycl-add-targets=">, Flags<[Driv
HelpText<"Specify comma-separated list of triple and device binary image pairs to add to the final SYCL binary">;
def fsycl_link_targets_EQ : CommaJoined<["-"], "fsycl-link-targets=">, Flags<[DriverOption, CC1Option]>,
HelpText<"Specify comma-separated list of triples SYCL offloading targets to produce linked device images">;
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
Flags<[CC1Option]>, HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects">;
def fno_sycl_use_bitcode : Flag<["-"], "fno-sycl-use-bitcode">,
Flags<[CC1Option]>, HelpText<"Use SPIR-V instead of LLVM bitcode in fat objects">;
def fsyntax_only : Flag<["-"], "fsyntax-only">,
Flags<[DriverOption,CoreOption,CC1Option]>, Group<Action_Group>;
def ftabstop_EQ : Joined<["-"], "ftabstop=">, Group<f_Group>;
Expand Down
7 changes: 6 additions & 1 deletion clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,14 +855,19 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,

case Backend_EmitSPIRV:
if (LangOpts.SYCL) {
// TODO: SPIRVNoDerefAttr is not modeled when using the bitcode pass
SPIRV::SPIRVNoDerefAttr = true;
// TODO: this pass added to work around missing linkonce_odr in SPIR-V
PerModulePasses.add(
createAlwaysInlinerLegacyPass(true /*InsertLifetimeIntrinsics*/));
PerModulePasses.add(createASFixerPass());
PerModulePasses.add(createDeadCodeEliminationPass());
}
PerModulePasses.add(createSPIRVWriterPass(*OS));
if (LangOpts.SYCLUseBitcode)
PerModulePasses.add(
createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists, false));
else
PerModulePasses.add(createSPIRVWriterPass(*OS));

break;

Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-aux-triple");
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
CmdArgs.push_back("-disable-llvm-passes");
if (Args.hasFlag(options::OPT_fsycl_use_bitcode,
options::OPT_fno_sycl_use_bitcode, true)) {
CmdArgs.push_back("-fsycl-use-bitcode");
}
}

if (IsOpenMPDevice) {
Expand Down
23 changes: 15 additions & 8 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// 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
//
//===----------------------------------------------------------------------===//

Expand Down Expand Up @@ -40,6 +39,7 @@ const char *SYCL::Linker::constructLLVMSpirvCommand(Compilation &C,
CmdArgs.push_back("-o");
CmdArgs.push_back(OutputFileName);
} else {
CmdArgs.push_back("-spirv-no-deref-attr");
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());
}
Expand Down Expand Up @@ -87,7 +87,8 @@ void SYCL::Linker::constructLlcCommand(Compilation &C, const JobAction &JA,
}

// For SYCL the inputs of the linker job are SPIR-V binaries and output is
// a single SPIR-V binary.
// a single SPIR-V binary. Input can also be bitcode when specified by
// the user
void SYCL::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
Expand All @@ -110,9 +111,15 @@ void SYCL::Linker::ConstructJob(Compilation &C, const JobAction &JA,
for (const auto &II : Inputs) {
if (!II.isFilename())
continue;
const char *LLVMSpirvOutputFile =
constructLLVMSpirvCommand(C, JA, Output, Prefix, true, II.getFilename());
SpirvInputs.push_back(LLVMSpirvOutputFile);
if (Args.hasFlag(options::OPT_fsycl_use_bitcode,
options::OPT_fno_sycl_use_bitcode, true))
SpirvInputs.push_back(II.getFilename());
else {
const char *LLVMSpirvOutputFile =
constructLLVMSpirvCommand(C, JA, Output, Prefix, true,
II.getFilename());
SpirvInputs.push_back(LLVMSpirvOutputFile);
}
}
const char *LLVMLinkOutputFile =
constructLLVMLinkCommand(C, JA, SubArchName, Prefix, SpirvInputs);
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Driver/ToolChains/SYCL.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===--- SYCL.h - SYCL ToolChain Implementations -----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// 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
//
//===----------------------------------------------------------------------===//

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
}

Opts.SYCL = Args.hasArg(options::OPT_fsycl_is_device);
Opts.SYCLUseBitcode = Args.hasFlag(options::OPT_fsycl_use_bitcode,
options::OPT_fno_sycl_use_bitcode, false);

// Set CUDA mode for OpenMP target NVPTX if specified in options
Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && T.isNVPTX() &&
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ set(cuda_wrapper_files
set(sycl_wrapper_files
sycl_wrappers/algorithm
sycl_wrappers/random
sycl_wrappers/__config
)

set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
Expand Down
36 changes: 36 additions & 0 deletions clang/lib/Headers/sycl_wrappers/__config
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// -*- C++ -*-
//===--------------------------- __config ---------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_STD_VER
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
# elif __cplusplus <= 201402L
# define _LIBCPP_STD_VER 14
# elif __cplusplus <= 201703L
# define _LIBCPP_STD_VER 17
# endif
#endif

#if _LIBCPP_STD_VER > 11
# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
#else
# define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif

#if _LIBCPP_STD_VER > 14
# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
#else
# define _LIBCPP_CONSTEXPR_AFTER_CXX14
#endif

#if _LIBCPP_STD_VER > 17
# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
#else
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
#endif
72 changes: 45 additions & 27 deletions clang/lib/Headers/sycl_wrappers/algorithm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// -*- C++ -*-
//===-------------------------- algorithm ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
// 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
//
//===----------------------------------------------------------------------===//

#include <__config>
#include <initializer_list>
#include <iterator>

Expand Down Expand Up @@ -495,59 +495,77 @@ RandomAccessIterator is_heap_until(RandomAccessIterator first,
RandomAccessIterator last, Compare comp);

template <class ForwardIterator>
ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator min_element(ForwardIterator first,
ForwardIterator last);

template <class ForwardIterator, class Compare>
ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator min_element(ForwardIterator first,
ForwardIterator last,
Compare comp);

template <class T> const T &min(const T &a, const T &b);
template <class T>
_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &min(const T &a, const T &b);

template <class T, class Compare>
const T &min(const T &a, const T &b, Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &min(const T &a, const T &b,
Compare comp);

template <class T> T min(initializer_list<T> t);
template <class T> _LIBCPP_CONSTEXPR_AFTER_CXX11 T min(initializer_list<T> t);

template <class T, class Compare> T min(initializer_list<T> t, Compare comp);
template <class T, class Compare>
_LIBCPP_CONSTEXPR_AFTER_CXX11 T min(initializer_list<T> t, Compare comp);

template <class T> const T &clamp(const T &v, const T &lo, const T &hi);
#if _LIBCPP_STD_VER > 14
template <class T>
const T constexpr &clamp(const T &v, const T &lo, const T &hi);

template <class T, class Compare>
const T &clamp(const T &v, const T &lo, const T &hi, Compare comp);
const T constexpr &clamp(const T &v, const T &lo, const T &hi, Compare comp);
#endif

template <class ForwardIterator>
ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator max_element(ForwardIterator first,
ForwardIterator last);

template <class ForwardIterator, class Compare>
ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator max_element(ForwardIterator first,
ForwardIterator last,
Compare comp);

template <class T> const T &max(const T &a, const T &b);
template <class T>
_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &max(const T &a, const T &b);

template <class T, class Compare>
const T &max(const T &a, const T &b, Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &max(const T &a, const T &b,
Compare comp);

template <class T> T max(initializer_list<T> t);
template <class T> _LIBCPP_CONSTEXPR_AFTER_CXX11 T max(initializer_list<T> t);

template <class T, class Compare> T max(initializer_list<T> t, Compare comp);
template <class T, class Compare>
_LIBCPP_CONSTEXPR_AFTER_CXX11 T max(initializer_list<T> t, Compare comp);

template <class ForwardIterator>
pair<ForwardIterator, ForwardIterator> minmax_element(ForwardIterator first,
ForwardIterator last);
_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last);

template <class ForwardIterator, class Compare>
pair<ForwardIterator, ForwardIterator>
pair<ForwardIterator, ForwardIterator> _LIBCPP_CONSTEXPR_AFTER_CXX11
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);

template <class T> pair<const T &, const T &> minmax(const T &a, const T &b);
template <class T>
_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<const T &, const T &> minmax(const T &a,
const T &b);

template <class T, class Compare>
pair<const T &, const T &> minmax(const T &a, const T &b, Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<const T &, const T &>
minmax(const T &a, const T &b, Compare comp);

template <class T> pair<T, T> minmax(initializer_list<T> t);
template <class T>
_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<T, T> minmax(initializer_list<T> t);

template <class T, class Compare>
pair<T, T> minmax(initializer_list<T> t, Compare comp);
_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<T, T> minmax(initializer_list<T> t,
Compare comp);

template <class InputIterator1, class InputIterator2>
bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Headers/sycl_wrappers/random
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// -*- C++ -*-
//===--------------------------- random -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
// 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
//
//===----------------------------------------------------------------------===//

Expand Down
Loading