Skip to content

Commit b5a2593

Browse files
committed
Move the free function before member function
Signed-off-by: Jiang, Zhiwei <[email protected]>
1 parent 2e24de8 commit b5a2593

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

sycl/include/syclcompat/device.hpp

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,51 @@ static int get_minor_version(const sycl::device &dev) {
334334
return minor;
335335
}
336336

337+
static inline void
338+
has_capability_or_fail(const sycl::device &dev,
339+
const std::initializer_list<sycl::aspect> &props) {
340+
for (const auto &it : props) {
341+
if (dev.has(it))
342+
continue;
343+
switch (it) {
344+
case sycl::aspect::fp64:
345+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
346+
"[SYCLcompat] 'double' is not supported in '" +
347+
dev.get_info<sycl::info::device::name>() +
348+
"' device");
349+
break;
350+
case sycl::aspect::fp16:
351+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
352+
"[SYCLcompat] 'half' is not supported in '" +
353+
dev.get_info<sycl::info::device::name>() +
354+
"' device");
355+
break;
356+
default:
357+
#define __SYCL_ASPECT(ASPECT, ID) \
358+
case sycl::aspect::ASPECT: \
359+
return #ASPECT;
360+
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE) __SYCL_ASPECT(ASPECT, ID)
361+
#define __SYCL_ASPECT_DEPRECATED_ALIAS(ASPECT, ID, MESSAGE)
362+
auto getAspectNameStr = [](sycl::aspect AspectNum) -> std::string {
363+
switch (AspectNum) {
364+
#include <sycl/info/aspects.def>
365+
#include <sycl/info/aspects_deprecated.def>
366+
default:
367+
return "unknown aspect";
368+
}
369+
};
370+
#undef __SYCL_ASPECT_DEPRECATED_ALIAS
371+
#undef __SYCL_ASPECT_DEPRECATED
372+
#undef __SYCL_ASPECT
373+
throw sycl::exception(
374+
sycl::make_error_code(sycl::errc::runtime),
375+
"[SYCLcompat] '" + getAspectNameStr(it) + "' is not supported in '" +
376+
dev.get_info<sycl::info::device::name>() + "' device");
377+
}
378+
break;
379+
}
380+
}
381+
337382
/// device extension
338383
class device_ext : public sycl::device {
339384
public:
@@ -919,49 +964,4 @@ static inline unsigned int get_device_id(const sycl::device &dev) {
919964
static inline unsigned int device_count() {
920965
return detail::dev_mgr::instance().device_count();
921966
}
922-
923-
static inline void
924-
has_capability_or_fail(const sycl::device &dev,
925-
const std::initializer_list<sycl::aspect> &props) {
926-
for (const auto &it : props) {
927-
if (dev.has(it))
928-
continue;
929-
switch (it) {
930-
case sycl::aspect::fp64:
931-
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
932-
"[SYCLcompat] 'double' is not supported in '" +
933-
dev.get_info<sycl::info::device::name>() +
934-
"' device");
935-
break;
936-
case sycl::aspect::fp16:
937-
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
938-
"[SYCLcompat] 'half' is not supported in '" +
939-
dev.get_info<sycl::info::device::name>() +
940-
"' device");
941-
break;
942-
default:
943-
#define __SYCL_ASPECT(ASPECT, ID) \
944-
case sycl::aspect::ASPECT: \
945-
return #ASPECT;
946-
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE) __SYCL_ASPECT(ASPECT, ID)
947-
#define __SYCL_ASPECT_DEPRECATED_ALIAS(ASPECT, ID, MESSAGE)
948-
auto getAspectNameStr = [](sycl::aspect AspectNum) -> std::string {
949-
switch (AspectNum) {
950-
#include <sycl/info/aspects.def>
951-
#include <sycl/info/aspects_deprecated.def>
952-
default:
953-
return "unknown aspect";
954-
}
955-
};
956-
#undef __SYCL_ASPECT_DEPRECATED_ALIAS
957-
#undef __SYCL_ASPECT_DEPRECATED
958-
#undef __SYCL_ASPECT
959-
throw sycl::exception(
960-
sycl::make_error_code(sycl::errc::runtime),
961-
"[SYCLcompat] '" + getAspectNameStr(it) + "' is not supported in '" +
962-
dev.get_info<sycl::info::device::name>() + "' device");
963-
}
964-
break;
965-
}
966-
}
967967
} // namespace syclcompat

0 commit comments

Comments
 (0)