Skip to content

Commit

Permalink
Merge from 'sycl' to 'sycl-web' (triSYCL#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
iclsrc committed Jan 10, 2020
2 parents c2c98c9 + f51030c commit 3edb2ec
Show file tree
Hide file tree
Showing 60 changed files with 126 additions and 61 deletions.
3 changes: 2 additions & 1 deletion clang/lib/CodeGen/CGClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,8 @@ void CodeGenFunction::InitializeVTablePointer(const VPtr &Vptr) {
llvm::FunctionType::get(CGM.Int32Ty, /*isVarArg=*/true)
->getPointerTo()
->getPointerTo();
VTableField = Builder.CreateBitCast(VTableField, VTablePtrTy->getPointerTo());
VTableField = Builder.CreateBitCast(VTableField, VTablePtrTy->getPointerTo(
VTableField.getType()->getAddressSpace()));
VTableAddressPoint = Builder.CreateBitCast(VTableAddressPoint, VTablePtrTy);

llvm::StoreInst *Store = Builder.CreateStore(VTableAddressPoint, VTableField);
Expand Down
4 changes: 0 additions & 4 deletions clang/lib/CodeGen/CodeGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,6 @@ llvm::StructType *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) {
return Ty;
}

assert((!Context.getLangOpts().SYCLIsDevice || !isa<CXXRecordDecl>(RD) ||
!dyn_cast<CXXRecordDecl>(RD)->isPolymorphic()) &&
"Types with virtual functions not allowed in SYCL");

// Okay, this is a definition of a type. Compile the implementation now.
bool InsertResult = RecordsBeingLaidOut.insert(Key).second;
(void)InsertResult;
Expand Down
28 changes: 28 additions & 0 deletions clang/test/CodeGenSYCL/virtual-types.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// RUN: %clang_cc1 -triple spir64-unknown-linux-sycldevice -fsycl-is-device -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
template <typename name, typename Func>
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
kernelFunc();
}

struct Struct {
virtual void foo() {}
void bar() {}
};

int main() {
kernel_single_task<class kernel_function>([]() {
Struct S;
S.bar(); });
return 0;
}


// Struct layout big enough for vtable.
// CHECK: %struct._ZTS6Struct.Struct = type { i32 (...)** }
// VTable:
// CHECK: @_ZTV6Struct = linkonce_odr unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI6Struct to i8*), i8* bitcast (void (%struct._ZTS6Struct.Struct addrspace(4)*)* @_ZN6Struct3fooEv to i8*)] }, comdat, align 8
// CHECK: @[[TYPEINFO:.+]] = external global i8*
// TypeInfo Name:
// CHECK: @_ZTS6Struct = linkonce_odr constant [8 x i8] c"6Struct\00", comdat, align 1
// TypeInfo:
// CHECK: @_ZTI6Struct = linkonce_odr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @[[TYPEINFO]], i64 2) to i8*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @_ZTS6Struct, i32 0, i32 0) }, comdat, align 8
2 changes: 1 addition & 1 deletion sycl/source/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// 4.6.2 Context class

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
context::context(const async_handler &AsyncHandler)
: context(default_selector().select_device(), AsyncHandler) {}
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/accessor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <CL/sycl/detail/accessor_impl.hpp>
#include <CL/sycl/detail/scheduler/scheduler.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/builtins_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace s = cl::sycl;
namespace d = s::detail;

namespace cl {
__SYCL_INLINE namespace cl {
namespace __host_std {
namespace {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/builtins_geometric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace s = cl::sycl;
namespace d = s::detail;

namespace cl {
__SYCL_INLINE namespace cl {
namespace __host_std {

s::cl_float Dot(s::cl_float2, s::cl_float2);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/builtins_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace s = cl::sycl;
namespace d = s::detail;

namespace cl {
__SYCL_INLINE namespace cl {
namespace __host_std {
namespace {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/builtins_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace s = cl::sycl;
namespace d = s::detail;

namespace cl {
__SYCL_INLINE namespace cl {
namespace __host_std {

namespace {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/builtins_relational.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace s = cl::sycl;
namespace d = s::detail;

namespace cl {
__SYCL_INLINE namespace cl {
namespace __host_std {
namespace {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/common_info.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define STRINGIFY_LINE_HELP(s) #s
#define STRINGIFY_LINE(s) STRINGIFY_LINE_HELP(s)

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <cstdlib>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <CL/sycl/platform.hpp>
#include <CL/sycl/stl.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <algorithm>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/device_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/error_handling/enqueue_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <CL/sycl/detail/pi.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/error_handling/error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <CL/sycl/detail/pi.h>
#include <CL/sycl/detail/cg.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <chrono>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/force_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <CL/sycl/stl.hpp>
#include <cstdlib>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <memory>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
using ContextImplPtr = std::shared_ptr<cl::sycl::detail::context_impl>;
namespace detail {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/image_accessor_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <CL/sycl/accessor.hpp>
#include <CL/sycl/builtins.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/image_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <CL/sycl/image.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/kernel_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <memory>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/kernel_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <CL/sycl/detail/kernel_info.hpp>
#include <CL/sycl/device.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {
template <>
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/kernel_program_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <CL/sycl/detail/kernel_program_cache.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {
KernelProgramCache::~KernelProgramCache() {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <cstring>
#include <vector>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/os_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#endif // SYCL_RT_OS

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stddef.h>
#include <string>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {
namespace pi {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <cstring>
#include <regex>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/platform_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <CL/sycl/detail/platform_info.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/platform_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <intrin.h>
#endif

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
12 changes: 11 additions & 1 deletion sycl/source/detail/posix_pi.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
//==---------------- posix_pi.cpp ------------------------------------------==//
//
// 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 <CL/sycl/detail/defines.hpp>

#include <dlfcn.h>
#include <string>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {
namespace pi {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/program_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <fstream>
#include <memory>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/program_manager/program_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <mutex>
#include <sstream>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/queue_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <cstring>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {
template <> cl_uint queue_impl::get_info<info::queue::reference_count>() const {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/sampler_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <CL/sycl/detail/context_impl.hpp>
#include <CL/sycl/detail/sampler_impl.hpp>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <memory>
#endif

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/scheduler/graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <set>
#include <vector>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/scheduler/graph_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <memory>
#include <vector>

namespace cl {
__SYCL_INLINE namespace cl {
namespace sycl {
namespace detail {

Expand Down
Loading

0 comments on commit 3edb2ec

Please sign in to comment.