Skip to content

Commit 613aeac

Browse files
committed
[SYCL] fix formatting
1 parent 38351d2 commit 613aeac

File tree

9 files changed

+345
-265
lines changed

9 files changed

+345
-265
lines changed

sycl/include/sycl/detail/info_desc_helpers.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,14 @@ struct IsKernelInfo<info::kernel_device_specific::ext_codeplay_num_regs>
119119
using return_type = Namespace::info::DescType::Desc::return_type; \
120120
};
121121

122-
#define __SYCL_PARAM_TRAITS_TEMPLATE_PARTIAL_SPEC(Namespace, Desctype, Desc, ReturnT, UrCode) \
123-
template <int Dimensions> \
124-
struct is_##Desctype##_info_desc<Namespace::info::Desctype::Desc<Dimensions>>: std::true_type { \
125-
using return_type = typename Namespace::info::Desctype::Desc<Dimensions>::return_type; \
126-
};
122+
#define __SYCL_PARAM_TRAITS_TEMPLATE_PARTIAL_SPEC(Namespace, Desctype, Desc, \
123+
ReturnT, UrCode) \
124+
template <int Dimensions> \
125+
struct is_##Desctype##_info_desc< \
126+
Namespace::info::Desctype::Desc<Dimensions>> : std::true_type { \
127+
using return_type = \
128+
typename Namespace::info::Desctype::Desc<Dimensions>::return_type; \
129+
};
127130

128131
#include <sycl/info/ext_oneapi_kernel_queue_specific_traits.def>
129132
#undef __SYCL_PARAM_TRAITS_SPEC

sycl/include/sycl/info/info_desc.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,15 @@ template <typename T, T param> struct compatibility_param_traits {};
239239
} /*namespace info */ \
240240
} /*namespace Namespace */
241241

242-
#define __SYCL_PARAM_TRAITS_TEMPLATE_PARTIAL_SPEC(Namespace, Desctype, Desc, ReturnT, UrCode) \
243-
namespace Namespace::info { \
244-
namespace Desctype { \
245-
template <int Dimensions> \
246-
struct Desc \
247-
{ \
248-
using return_type = ReturnT<Dimensions>; \
249-
}; \
250-
} \
251-
}
242+
#define __SYCL_PARAM_TRAITS_TEMPLATE_PARTIAL_SPEC(Namespace, Desctype, Desc, \
243+
ReturnT, UrCode) \
244+
namespace Namespace::info { \
245+
namespace Desctype { \
246+
template <int Dimensions> struct Desc { \
247+
using return_type = ReturnT<Dimensions>; \
248+
}; \
249+
} \
250+
}
252251

253252
namespace ext::oneapi::experimental::info::device {
254253
template <int Dimensions> struct max_work_groups;

sycl/source/detail/kernel_impl.hpp

Lines changed: 87 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ class kernel_impl {
170170
/// \param WG // update description
171171
/// \return depends on information being queried.
172172
template <typename Param>
173-
typename Param::return_type
174-
ext_oneapi_get_info(queue Queue, const range<3> &WG) const;
173+
typename Param::return_type ext_oneapi_get_info(queue Queue,
174+
const range<3> &WG) const;
175175

176176
/// Query queue/launch-specific information from a kernel using the
177177
/// info::kernel_queue_specific descriptor for a specific Queue and values.
@@ -181,8 +181,8 @@ class kernel_impl {
181181
/// \param WG // update description
182182
/// \return depends on information being queried.
183183
template <typename Param>
184-
typename Param::return_type
185-
ext_oneapi_get_info(queue Queue, const range<2> &WG) const;
184+
typename Param::return_type ext_oneapi_get_info(queue Queue,
185+
const range<2> &WG) const;
186186

187187
/// Query queue/launch-specific information from a kernel using the
188188
/// info::kernel_queue_specific descriptor for a specific Queue and values.
@@ -192,8 +192,8 @@ class kernel_impl {
192192
/// \param WG // update description
193193
/// \return depends on information being queried.
194194
template <typename Param>
195-
typename Param::return_type
196-
ext_oneapi_get_info(queue Queue, const range<1> &WG) const;
195+
typename Param::return_type ext_oneapi_get_info(queue Queue,
196+
const range<1> &WG) const;
197197

198198
/// Get a constant reference to a raw kernel object.
199199
///
@@ -423,12 +423,13 @@ inline typename syclex::info::kernel_queue_specific::max_work_group_size::
423423
syclex::info::kernel_queue_specific::max_work_group_size>(
424424
queue Queue) const {
425425
const auto &Adapter = getAdapter();
426-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
426+
const auto DeviceNativeHandle =
427+
getSyclObjImpl(Queue.get_device())->getHandleRef();
427428

428429
size_t KernelWGSize = 0;
429430
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetGroupInfo>(
430-
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE, sizeof(size_t),
431-
&KernelWGSize, nullptr);
431+
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE,
432+
sizeof(size_t), &KernelWGSize, nullptr);
432433
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
433434
// The feature is supported. Check for other errors and throw if any.
434435
Adapter->checkUrResult(Result);
@@ -437,29 +438,27 @@ inline typename syclex::info::kernel_queue_specific::max_work_group_size::
437438
return 0;
438439
}
439440

440-
template <int D>
441-
inline sycl::id<D> generate_id(const size_t* sizes)
442-
{
441+
template <int D> inline sycl::id<D> generate_id(const size_t *sizes) {
443442
sycl::id<D> ret;
444-
for (int i = 0; i < D; i++)
445-
{
443+
for (int i = 0; i < D; i++) {
446444
ret[i] = sizes[i];
447445
}
448446
return ret;
449447
}
450448

451449
template <>
452-
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<1>::
453-
return_type
454-
kernel_impl::ext_oneapi_get_info<
455-
syclex::info::kernel_queue_specific::max_work_item_sizes<1>>(
456-
queue Queue) const {
450+
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<
451+
1>::return_type
452+
kernel_impl::ext_oneapi_get_info<
453+
syclex::info::kernel_queue_specific::max_work_item_sizes<1>>(
454+
queue Queue) const {
457455
const auto &Adapter = getAdapter();
458-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
456+
const auto DeviceNativeHandle =
457+
getSyclObjImpl(Queue.get_device())->getHandleRef();
459458
size_t KernelWGSize[3] = {0};
460459
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetGroupInfo>(
461-
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
462-
sizeof(size_t)*3, KernelWGSize, nullptr);
460+
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
461+
sizeof(size_t) * 3, KernelWGSize, nullptr);
463462
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
464463
// The feature is supported. Check for other errors and throw if any.
465464
Adapter->checkUrResult(Result);
@@ -468,17 +467,18 @@ inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<1>::
468467
}
469468

470469
template <>
471-
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<2>::
472-
return_type
473-
kernel_impl::ext_oneapi_get_info<
474-
syclex::info::kernel_queue_specific::max_work_item_sizes<2>>(
475-
queue Queue) const {
470+
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<
471+
2>::return_type
472+
kernel_impl::ext_oneapi_get_info<
473+
syclex::info::kernel_queue_specific::max_work_item_sizes<2>>(
474+
queue Queue) const {
476475
const auto &Adapter = getAdapter();
477-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
476+
const auto DeviceNativeHandle =
477+
getSyclObjImpl(Queue.get_device())->getHandleRef();
478478
size_t KernelWGSize[3] = {0};
479479
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetGroupInfo>(
480-
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
481-
sizeof(size_t)*3, KernelWGSize, nullptr);
480+
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
481+
sizeof(size_t) * 3, KernelWGSize, nullptr);
482482
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
483483
// The feature is supported. Check for other errors and throw if any.
484484
Adapter->checkUrResult(Result);
@@ -487,17 +487,18 @@ inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<2>::
487487
}
488488

489489
template <>
490-
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<3>::
491-
return_type
492-
kernel_impl::ext_oneapi_get_info<
493-
syclex::info::kernel_queue_specific::max_work_item_sizes<3>>(
494-
queue Queue) const {
490+
inline typename syclex::info::kernel_queue_specific::max_work_item_sizes<
491+
3>::return_type
492+
kernel_impl::ext_oneapi_get_info<
493+
syclex::info::kernel_queue_specific::max_work_item_sizes<3>>(
494+
queue Queue) const {
495495
const auto &Adapter = getAdapter();
496-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
496+
const auto DeviceNativeHandle =
497+
getSyclObjImpl(Queue.get_device())->getHandleRef();
497498
size_t KernelWGSize[3] = {0};
498499
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetGroupInfo>(
499-
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
500-
sizeof(size_t)*3, KernelWGSize, nullptr);
500+
MKernel, DeviceNativeHandle, UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE,
501+
sizeof(size_t) * 3, KernelWGSize, nullptr);
501502
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
502503
// The feature is supported. Check for other errors and throw if any.
503504
Adapter->checkUrResult(Result);
@@ -516,13 +517,16 @@ inline typename syclex::info::kernel_queue_specific::max_sub_group_size::
516517
throw exception(sycl::make_error_code(errc::invalid),
517518
"The max work-group size cannot be zero.");
518519
const auto &Adapter = getAdapter();
519-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
520+
const auto DeviceNativeHandle =
521+
getSyclObjImpl(Queue.get_device())->getHandleRef();
520522

521523
uint32_t KernelSubWGSize = 0;
522524

523525
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
524-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t), &KernelSubWGSize,
525-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
526+
MKernel, DeviceNativeHandle,
527+
UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t),
528+
&KernelSubWGSize, nullptr);
529+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
526530
// The feature is supported. Check for other errors and throw if any.
527531
Adapter->checkUrResult(Result);
528532
return KernelSubWGSize;
@@ -541,13 +545,16 @@ inline typename syclex::info::kernel_queue_specific::max_sub_group_size::
541545
throw exception(sycl::make_error_code(errc::invalid),
542546
"The max work-group size cannot be zero.");
543547
const auto &Adapter = getAdapter();
544-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
548+
const auto DeviceNativeHandle =
549+
getSyclObjImpl(Queue.get_device())->getHandleRef();
545550

546551
uint32_t KernelSubWGSize = 0;
547552

548553
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
549-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t), &KernelSubWGSize,
550-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
554+
MKernel, DeviceNativeHandle,
555+
UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t),
556+
&KernelSubWGSize, nullptr);
557+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
551558
// The feature is supported. Check for other errors and throw if any.
552559
Adapter->checkUrResult(Result);
553560
return KernelSubWGSize;
@@ -565,13 +572,16 @@ inline typename syclex::info::kernel_queue_specific::max_sub_group_size::
565572
throw exception(sycl::make_error_code(errc::invalid),
566573
"The max work-group size cannot be zero.");
567574
const auto &Adapter = getAdapter();
568-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
575+
const auto DeviceNativeHandle =
576+
getSyclObjImpl(Queue.get_device())->getHandleRef();
569577

570578
uint32_t KernelSubWGSize = 0;
571579

572580
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
573-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t), &KernelSubWGSize,
574-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
581+
MKernel, DeviceNativeHandle,
582+
UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE, sizeof(uint32_t),
583+
&KernelSubWGSize, nullptr);
584+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
575585
// The feature is supported. Check for other errors and throw if any.
576586
Adapter->checkUrResult(Result);
577587
return KernelSubWGSize;
@@ -580,22 +590,24 @@ inline typename syclex::info::kernel_queue_specific::max_sub_group_size::
580590
}
581591

582592
template <>
583-
inline typename syclex::info::kernel_queue_specific::num_sub_groups::
584-
return_type
585-
kernel_impl::ext_oneapi_get_info<
586-
syclex::info::kernel_queue_specific::num_sub_groups>(
587-
queue Queue, const range<3> &WG) const {
593+
inline typename syclex::info::kernel_queue_specific::num_sub_groups::return_type
594+
kernel_impl::ext_oneapi_get_info<
595+
syclex::info::kernel_queue_specific::num_sub_groups>(
596+
queue Queue, const range<3> &WG) const {
588597
if (WG.size() == 0)
589598
throw exception(sycl::make_error_code(errc::invalid),
590599
"The max work-group size cannot be zero.");
591600
const auto &Adapter = getAdapter();
592-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
601+
const auto DeviceNativeHandle =
602+
getSyclObjImpl(Queue.get_device())->getHandleRef();
593603

594604
uint32_t KernelSubWGSize = 0;
595605

596606
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
597-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t), &KernelSubWGSize,
598-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
607+
MKernel, DeviceNativeHandle,
608+
UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t),
609+
&KernelSubWGSize, nullptr);
610+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
599611
// The feature is supported. Check for other errors and throw if any.
600612
Adapter->checkUrResult(Result);
601613
return KernelSubWGSize;
@@ -604,22 +616,24 @@ inline typename syclex::info::kernel_queue_specific::num_sub_groups::
604616
}
605617

606618
template <>
607-
inline typename syclex::info::kernel_queue_specific::num_sub_groups::
608-
return_type
609-
kernel_impl::ext_oneapi_get_info<
610-
syclex::info::kernel_queue_specific::num_sub_groups>(
611-
queue Queue, const range<2> &WG) const {
619+
inline typename syclex::info::kernel_queue_specific::num_sub_groups::return_type
620+
kernel_impl::ext_oneapi_get_info<
621+
syclex::info::kernel_queue_specific::num_sub_groups>(
622+
queue Queue, const range<2> &WG) const {
612623
if (WG.size() == 0)
613624
throw exception(sycl::make_error_code(errc::invalid),
614625
"The max work-group size cannot be zero.");
615626
const auto &Adapter = getAdapter();
616-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
627+
const auto DeviceNativeHandle =
628+
getSyclObjImpl(Queue.get_device())->getHandleRef();
617629

618630
uint32_t KernelSubWGSize = 0;
619631

620632
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
621-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t), &KernelSubWGSize,
622-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
633+
MKernel, DeviceNativeHandle,
634+
UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t),
635+
&KernelSubWGSize, nullptr);
636+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
623637
// The feature is supported. Check for other errors and throw if any.
624638
Adapter->checkUrResult(Result);
625639
return KernelSubWGSize;
@@ -628,22 +642,24 @@ inline typename syclex::info::kernel_queue_specific::num_sub_groups::
628642
}
629643

630644
template <>
631-
inline typename syclex::info::kernel_queue_specific::num_sub_groups::
632-
return_type
633-
kernel_impl::ext_oneapi_get_info<
634-
syclex::info::kernel_queue_specific::num_sub_groups>(
635-
queue Queue, const range<1> &WG) const {
645+
inline typename syclex::info::kernel_queue_specific::num_sub_groups::return_type
646+
kernel_impl::ext_oneapi_get_info<
647+
syclex::info::kernel_queue_specific::num_sub_groups>(
648+
queue Queue, const range<1> &WG) const {
636649
if (WG.size() == 0)
637650
throw exception(sycl::make_error_code(errc::invalid),
638651
"The max work-group size cannot be zero.");
639652
const auto &Adapter = getAdapter();
640-
const auto DeviceNativeHandle = getSyclObjImpl(Queue.get_device())->getHandleRef();
653+
const auto DeviceNativeHandle =
654+
getSyclObjImpl(Queue.get_device())->getHandleRef();
641655

642656
uint32_t KernelSubWGSize = 0;
643657

644658
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetSubGroupInfo>(
645-
MKernel, DeviceNativeHandle, UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t), &KernelSubWGSize,
646-
nullptr);Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
659+
MKernel, DeviceNativeHandle,
660+
UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS, sizeof(uint32_t),
661+
&KernelSubWGSize, nullptr);
662+
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
647663
// The feature is supported. Check for other errors and throw if any.
648664
Adapter->checkUrResult(Result);
649665
return KernelSubWGSize;

0 commit comments

Comments
 (0)