Skip to content

[SYCL][WIP-DO-NOT-MERGE] Update namespaces of oneAPI and Intel extensions #2155

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,10 +2812,11 @@ bool Util::isSyclHalfType(const QualType &Ty) {

bool Util::isSyclSpecConstantType(const QualType &Ty) {
const StringRef &Name = "spec_constant";
std::array<DeclContextDesc, 4> Scopes = {
std::array<DeclContextDesc, 5> Scopes = {
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "cl"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "sycl"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "experimental"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "ext"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "oneapi"},
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, Name}};
return matchQualifiedTypeName(Ty, Scopes);
}
Expand Down
6 changes: 4 additions & 2 deletions clang/test/CodeGenSYCL/Inputs/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ struct get_kernel_name_t<auto_name, Type> {
using name = Type;
};

namespace experimental {
namespace ext {
namespace oneapi {
template <typename T, typename ID = T>
class spec_constant {
public:
Expand All @@ -256,7 +257,8 @@ class spec_constant {
return get();
}
};
} // namespace experimental
} // namespace oneapi
} // namespace ext

#define ATTR_SYCL_KERNEL __attribute__((sycl_kernel))
template <typename KernelName = auto_name, typename KernelType>
Expand Down
20 changes: 10 additions & 10 deletions clang/test/CodeGenSYCL/int_header_spec_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class MyDoubleConst;

int main() {
// Create specialization constants.
cl::sycl::experimental::spec_constant<bool, MyBoolConst> i1(false);
cl::sycl::experimental::spec_constant<char, MyInt8Const> i8(0);
cl::sycl::experimental::spec_constant<unsigned char, MyUInt8Const> ui8(0);
cl::sycl::experimental::spec_constant<short, MyInt16Const> i16(0);
cl::sycl::experimental::spec_constant<unsigned short, MyUInt16Const> ui16(0);
cl::sycl::experimental::spec_constant<int, MyInt32Const> i32(0);
cl::sycl::ext::oneapi::spec_constant<bool, MyBoolConst> i1(false);
cl::sycl::ext::oneapi::spec_constant<char, MyInt8Const> i8(0);
cl::sycl::ext::oneapi::spec_constant<unsigned char, MyUInt8Const> ui8(0);
cl::sycl::ext::oneapi::spec_constant<short, MyInt16Const> i16(0);
cl::sycl::ext::oneapi::spec_constant<unsigned short, MyUInt16Const> ui16(0);
cl::sycl::ext::oneapi::spec_constant<int, MyInt32Const> i32(0);
// Constant used twice, but there must be single entry in the int header,
// otherwise compilation error would be issued.
cl::sycl::experimental::spec_constant<int, MyInt32Const> i32_1(0);
cl::sycl::experimental::spec_constant<unsigned int, MyUInt32Const> ui32(0);
cl::sycl::experimental::spec_constant<float, MyFloatConst> f32(0);
cl::sycl::experimental::spec_constant<double, MyDoubleConst> f64(0);
cl::sycl::ext::oneapi::spec_constant<int, MyInt32Const> i32_1(0);
cl::sycl::ext::oneapi::spec_constant<unsigned int, MyUInt32Const> ui32(0);
cl::sycl::ext::oneapi::spec_constant<float, MyFloatConst> f32(0);
cl::sycl::ext::oneapi::spec_constant<double, MyDoubleConst> f64(0);

double val;
double *ptr = &val; // to avoid "unused" warnings
Expand Down
12 changes: 6 additions & 6 deletions sycl/include/CL/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
#include <CL/sycl/device_selector.hpp>
#include <CL/sycl/event.hpp>
#include <CL/sycl/exception.hpp>
#include <CL/sycl/ext/oneapi/atomic.hpp>
#include <CL/sycl/ext/oneapi/builtins.hpp>
#include <CL/sycl/ext/oneapi/function_pointer.hpp>
#include <CL/sycl/ext/oneapi/group_algorithm.hpp>
#include <CL/sycl/ext/oneapi/reduction.hpp>
#include <CL/sycl/ext/oneapi/sub_group.hpp>
#include <CL/sycl/group.hpp>
#include <CL/sycl/handler.hpp>
#include <CL/sycl/id.hpp>
#include <CL/sycl/image.hpp>
#include <CL/sycl/intel/atomic.hpp>
#include <CL/sycl/intel/builtins.hpp>
#include <CL/sycl/intel/function_pointer.hpp>
#include <CL/sycl/intel/group_algorithm.hpp>
#include <CL/sycl/intel/reduction.hpp>
#include <CL/sycl/intel/sub_group.hpp>
#include <CL/sycl/item.hpp>
#include <CL/sycl/kernel.hpp>
#include <CL/sycl/multi_ptr.hpp>
Expand Down
6 changes: 4 additions & 2 deletions sycl/include/CL/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,14 @@

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace ext {
namespace intel {
namespace gpu {
// Forward declare a "back-door" access class to support ESIMD.
class AccessorPrivateProxy;
} // namespace gpu
} // namespace intel
} // namespace ext
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)

Expand Down Expand Up @@ -432,7 +434,7 @@ class image_accessor
#endif

private:
friend class sycl::intel::gpu::AccessorPrivateProxy;
friend class sycl::ext::intel::gpu::AccessorPrivateProxy;

#if defined(__SYCL_DEVICE_ONLY__) && defined(__SYCL_EXPLICIT_SIMD__)
const OCLImageTy getNativeImageObj() const { return MImageObj; }
Expand Down Expand Up @@ -883,7 +885,7 @@ class accessor :
#endif // __SYCL_DEVICE_ONLY__

private:
friend class sycl::intel::gpu::AccessorPrivateProxy;
friend class sycl::ext::intel::gpu::AccessorPrivateProxy;

public:
using value_type = DataT;
Expand Down
6 changes: 4 additions & 2 deletions sycl/include/CL/sycl/builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,14 +724,16 @@ detail::enable_if_t<detail::is_geninteger<T>::value, T> clz(T x) __NOEXC {
return __sycl_std::__invoke_clz<T>(x);
}

namespace intel {
namespace ext {
namespace oneapi {
// geninteger ctz (geninteger x)
template <typename T>
sycl::detail::enable_if_t<sycl::detail::is_geninteger<T>::value, T>
ctz(T x) __NOEXC {
return __sycl_std::__invoke_ctz<T>(x);
}
} // namespace intel
} // namespace oneapi
} // namespace ext

// geninteger mad_hi (geninteger a, geninteger b, geninteger c)
template <typename T>
Expand Down
4 changes: 3 additions & 1 deletion sycl/include/CL/sycl/detail/accessor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace ext {
namespace intel {
namespace gpu {
// Forward declare a "back-door" access class to support ESIMD.
class AccessorPrivateProxy;
} // namespace gpu
} // namespace intel
} // namespace ext
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)

Expand Down Expand Up @@ -170,7 +172,7 @@ class AccessorBaseHost {
AccessorImplPtr impl;

private:
friend class sycl::intel::gpu::AccessorPrivateProxy;
friend class sycl::ext::intel::gpu::AccessorPrivateProxy;
};

class __SYCL_EXPORT LocalAccessorImplHost {
Expand Down
Loading