-
Notifications
You must be signed in to change notification settings - Fork 172
Adding rocSOLVER support for LAPACK domain with hip backend #208
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
Changes from all commits
d1b768b
d063638
93cd795
acb494b
326ccbd
ca2b2b7
285b3a1
1d35c39
93e8659
48b03d3
d8c4a72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#========================================================================== | ||
# Copyright 2022 Intel Corporation | ||
sknepper marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#========================================================================= | ||
|
||
if(NOT DEFINED HIP_PATH) | ||
if(NOT DEFINED ENV{HIP_PATH}) | ||
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed") | ||
else() | ||
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed") | ||
endif() | ||
endif() | ||
|
||
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH}) | ||
list(APPEND CMAKE_PREFIX_PATH | ||
"${HIP_PATH}/lib/cmake" | ||
"${HIP_PATH}/../lib/cmake" | ||
"${HIP_PATH}/../lib/cmake/rocsolver") | ||
|
||
find_package(HIP QUIET) | ||
find_package(rocsolver REQUIRED) | ||
|
||
# this is work around to avoid duplication half creation in both hip and SYCL | ||
add_compile_definitions(HIP_NO_HALF) | ||
|
||
find_package(Threads REQUIRED) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(rocSOLVER | ||
REQUIRED_VARS | ||
HIP_INCLUDE_DIRS | ||
rocsolver_INCLUDE_DIR | ||
rocsolver_LIBRARIES) | ||
|
||
if(NOT TARGET ONEMKL::rocSOLVER::rocSOLVER) | ||
add_library(ONEMKL::rocSOLVER::rocSOLVER SHARED IMPORTED) | ||
set_target_properties(ONEMKL::rocSOLVER::rocSOLVER PROPERTIES | ||
IMPORTED_LOCATION "${HIP_PATH}/../rocsolver/lib/librocsolver.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "${rocsolver_INCLUDE_DIR};${HIP_INCLUDE_DIRS};" | ||
INTERFACE_LINK_LIBRARIES "Threads::Threads;hip::host;${rocsolver_LIBRARIES};") | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/******************************************************************************* | ||
* Copyright 2020-2021 Intel Corporation | ||
* Copyright 2020-2022 Intel Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -124,6 +124,18 @@ inline void backend_selector_precondition<backend::rocrand>(sycl::queue& queue) | |
#endif | ||
} | ||
|
||
template <> | ||
inline void backend_selector_precondition<backend::rocsolver>(sycl::queue& queue) { | ||
#ifndef ONEMKL_DISABLE_PREDICATES | ||
unsigned int vendor_id = | ||
static_cast<unsigned int>(queue.get_device().get_info<sycl::info::device::vendor_id>()); | ||
if (!(queue.get_device().is_gpu() && vendor_id == AMD_ID)) { | ||
throw unsupported_device( | ||
"", "backend_selector<backend::" + backend_map[backend::rocsolver] + ">", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor, but the spacing doesn't seem to match the spacing above it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like line 135 with the queue get device is still misaligned compared to line 122 above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ran clang-format to fix the indentation of this section which differs from the format of the code with line #122 |
||
queue.get_device()); | ||
} | ||
#endif | ||
} | ||
} // namespace mkl | ||
} // namespace oneapi | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*************************************************************************** | ||
* Copyright (C) Codeplay Software Limited | ||
* Copyright 2022 Intel Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* For your convenience, a copy of the License has been included in this | ||
* repository. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
|
||
#ifndef _DETAIL_ROCSOLVER_LAPACK_CT_HPP_ | ||
#define _DETAIL_ROCSOLVER_LAPACK_CT_HPP_ | ||
|
||
#if __has_include(<sycl/sycl.hpp>) | ||
#include <sycl/sycl.hpp> | ||
#else | ||
#include <CL/sycl.hpp> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be guarded similarly as in #if __has_include(<sycl/sycl.hpp>)
#include <sycl/sycl.hpp>
#else
#include <CL/sycl.hpp>
#endif |
||
#endif | ||
#include <complex> | ||
#include <cstdint> | ||
|
||
#include "oneapi/mkl/types.hpp" | ||
#include "oneapi/mkl/lapack/types.hpp" | ||
#include "oneapi/mkl/detail/backend_selector.hpp" | ||
#include "oneapi/mkl/lapack/detail/rocsolver/onemkl_lapack_rocsolver.hpp" | ||
|
||
namespace oneapi { | ||
namespace mkl { | ||
namespace lapack { | ||
|
||
#define LAPACK_BACKEND rocsolver | ||
sknepper marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include "lapack_ct.hxx" | ||
#undef LAPACK_BACKEND | ||
|
||
} // namespace lapack | ||
} // namespace mkl | ||
} // namespace oneapi | ||
|
||
#endif //_DETAIL_ROCSOLVER_LAPACK_CT_HPP_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table formatting looks off when viewing the README in your branch: https://github.com/srilekhainkulu99/oneMKL/tree/rocsolver_hip_support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for such a detailed feedback. I've addressed majority of the comments.
Do let us know if you have any further suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table formatting still appears off, please address this. https://github.com/srilekhainkulu99/oneMKL/tree/rocsolver_hip_support