Skip to content

Commit

Permalink
Move generic_device support pragma
Browse files Browse the repository at this point in the history
Moved pragma and simplified if-statement to increase code readability
  • Loading branch information
s-Nick committed Sep 6, 2024
1 parent 922a654 commit 3466d6f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/include/function_table_initializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ class table_initializer {
}

private:
#ifdef ENABLE_PORTBLAS_BACKEND
static constexpr bool is_generic_device_supported = true;
#else
static constexpr bool is_generic_device_supported = false;
#endif

#ifdef _WIN64
// Create a string with last error message
std::string GetLastErrorStdStr() {
Expand Down Expand Up @@ -99,17 +105,14 @@ class table_initializer {
break;
}
if (!handle) {
#ifndef ENABLE_PORTBLAS_BACKEND
if (key == oneapi::mkl::device::generic_device) {
if constexpr (!is_generic_device_supported &&
key == oneapi::mkl::device::generic_device) {
throw mkl::unsupported_device("", "", q.get_device());
}
else {
#endif
std::cerr << ERROR_MSG << '\n';
throw mkl::backend_not_found();
#ifndef ENABLE_PORTBLAS_BACKEND
}
#endif
}
auto t =
reinterpret_cast<function_table_t *>(::GET_FUNC(handle.get(), table_names[domain_id]));
Expand Down

0 comments on commit 3466d6f

Please sign in to comment.