Skip to content

Commit 042a19e

Browse files
committed
UR port platform/device to get sycl-ls working
1 parent 263d128 commit 042a19e

19 files changed

+929
-598
lines changed

sycl/include/sycl/detail/info_desc_helpers.hpp

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010

1111
#include <sycl/detail/pi.h> // for pi_device_info
12+
#include <ur_api.h>
1213

1314
#include <type_traits> // for true_type
1415

@@ -23,6 +24,7 @@ namespace sycl {
2324
inline namespace _V1 {
2425
namespace detail {
2526
template <typename T> struct PiInfoCode;
27+
template <typename T> struct UrInfoCode;
2628
template <typename T> struct is_platform_info_desc : std::false_type {};
2729
template <typename T> struct is_context_info_desc : std::false_type {};
2830
template <typename T> struct is_device_info_desc : std::false_type {};
@@ -54,7 +56,7 @@ template <typename T> struct is_backend_info_desc : std::false_type {};
5456
#include <sycl/info/context_traits.def>
5557
#include <sycl/info/event_traits.def>
5658
#include <sycl/info/kernel_traits.def>
57-
#include <sycl/info/platform_traits.def>
59+
// #include <sycl/info/platform_traits.def>
5860
#include <sycl/info/queue_traits.def>
5961
#undef __SYCL_PARAM_TRAITS_SPEC
6062
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
@@ -68,6 +70,28 @@ template <typename T> struct is_backend_info_desc : std::false_type {};
6870
#include <sycl/info/event_profiling_traits.def>
6971
#undef __SYCL_PARAM_TRAITS_SPEC
7072

73+
// Normally we would just use std::enable_if to limit valid get_info template
74+
// arguments. However, there is a mangling mismatch of
75+
// "std::enable_if<is*_desc::value>::type" between gcc clang (it appears that
76+
// gcc lacks a E terminator for unresolved-qualifier-level sequence). As a
77+
// workaround, we use return_type alias from is_*info_desc that doesn't run into
78+
// the same problem.
79+
// TODO remove once this gcc/clang discrepancy is resolved
80+
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, UrCode) \
81+
template <> struct UrInfoCode<info::DescType::Desc> { \
82+
static constexpr ur_##DescType##_info_t value = UrCode; \
83+
}; \
84+
template <> \
85+
struct is_##DescType##_info_desc<info::DescType::Desc> : std::true_type { \
86+
using return_type = info::DescType::Desc::return_type; \
87+
};
88+
// #include <sycl/info/context_traits.def>
89+
// #include <sycl/info/event_traits.def>
90+
// #include <sycl/info/kernel_traits.def>
91+
#include <sycl/info/platform_traits.def>
92+
// #include <sycl/info/queue_traits.def>
93+
#undef __SYCL_PARAM_TRAITS_SPEC
94+
7195
template <typename Param> struct IsSubGroupInfo : std::false_type {};
7296
template <>
7397
struct IsSubGroupInfo<info::kernel_device_specific::max_num_sub_groups>
@@ -98,9 +122,8 @@ struct IsSubGroupInfo<info::kernel_device_specific::compile_sub_group_size>
98122
// Need a static_cast here since piDeviceGetInfo can also accept
99123
// pi_usm_capability_query values.
100124
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
101-
template <> struct PiInfoCode<info::DescType::Desc> { \
102-
static constexpr pi_device_info value = \
103-
static_cast<pi_device_info>(PiCode); \
125+
template <> struct UrInfoCode<info::DescType::Desc> { \
126+
static constexpr ur_device_info_t value = PiCode; \
104127
}; \
105128
template <> \
106129
struct is_##DescType##_info_desc<info::DescType::Desc> : std::true_type { \
@@ -113,11 +136,11 @@ struct IsSubGroupInfo<info::kernel_device_specific::compile_sub_group_size>
113136

114137
#undef __SYCL_PARAM_TRAITS_SPEC
115138
#undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
116-
139+
// changes changes changes
117140
#define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
118-
template <> struct PiInfoCode<Namespace::info::DescType::Desc> { \
119-
static constexpr pi_device_info value = \
120-
static_cast<pi_device_info>(PiCode); \
141+
template <> struct UrInfoCode<Namespace::info::DescType::Desc> { \
142+
static constexpr ur_device_info_t value = \
143+
static_cast<ur_device_info_t>(PiCode); \
121144
}; \
122145
template <> \
123146
struct is_##DescType##_info_desc<Namespace::info::DescType::Desc> \

0 commit comments

Comments
 (0)