Skip to content

Commit

Permalink
[LAPACK] Add Arm Performance Libraries backend (#633)
Browse files Browse the repository at this point in the history
Signed-off-by: Augustin Degomme <[email protected]>
Co-authored-by: Nicolas Bouton <[email protected]>
Co-authored-by: Romain Dolbeau <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2025
1 parent af66e5e commit f7a6f14
Show file tree
Hide file tree
Showing 15 changed files with 9,274 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ endif()
if(ENABLE_MKLCPU_BACKEND
OR ENABLE_MKLGPU_BACKEND
OR ENABLE_CUSOLVER_BACKEND
OR ENABLE_ROCSOLVER_BACKEND)
OR ENABLE_ROCSOLVER_BACKEND
OR ENABLE_ARMPL_BACKEND)
list(APPEND DOMAINS_LIST "lapack")
endif()
if(ENABLE_MKLCPU_BACKEND
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,18 @@ Supported compilers include:
<td align="center">Dynamic, Static</td>
</tr>
<tr>
<td rowspan=4 align="center">LAPACK</td>
<td rowspan=5 align="center">LAPACK</td>
<td align="center">x86 CPU</td>
<td align="center">Intel(R) oneMKL</td>
<td align="center">Intel DPC++</td>
<td align="center">Dynamic, Static</td>
</tr>
<tr>
<td align="center">aarch64 CPU</td>
<td align="center">Arm Performance Libraries</td>
<td align="center">Open DPC++</br>AdaptiveCpp</td>
<td align="center">Dynamic, Static</td>
</tr>
<tr>
<td align="center">Intel GPU</td>
<td align="center">Intel(R) oneMKL</td>
Expand Down
7 changes: 7 additions & 0 deletions include/oneapi/math/detail/backends_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ static std::map<domain, std::map<device, std::vector<const char*>>> libraries =
LIB_NAME("lapack_mklcpu")
#endif
} },
{ device::aarch64cpu,
{
#ifdef ONEMATH_ENABLE_ARMPL_BACKEND
LIB_NAME("lapack_armpl"),
#endif
} },

{ device::intelgpu,
{
#ifdef ONEMATH_ENABLE_MKLGPU_BACKEND
Expand Down
3 changes: 3 additions & 0 deletions include/oneapi/math/lapack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
#ifdef ONEMATH_ENABLE_ROCSOLVER_BACKEND
#include "oneapi/math/lapack/detail/rocsolver/lapack_ct.hpp"
#endif
#ifdef ONEMATH_ENABLE_ARMPL_BACKEND
#include "oneapi/math/lapack/detail/armpl/lapack_ct.hpp"
#endif

#include "oneapi/math/lapack/detail/lapack_rt.hpp"
43 changes: 43 additions & 0 deletions include/oneapi/math/lapack/detail/armpl/lapack_ct.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright 2025 SiPearl
* Copyright 2021 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
*
* 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.
*
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

#pragma once

#include <complex>
#include <cstdint>

#include <sycl/sycl.hpp>

#include "oneapi/math/types.hpp"
#include "oneapi/math/lapack/types.hpp"
#include "oneapi/math/detail/backend_selector.hpp"
#include "oneapi/math/lapack/detail/armpl/onemath_lapack_armpl.hpp"

namespace oneapi {
namespace math {
namespace lapack {

#define LAPACK_BACKEND armpl
#include "oneapi/math/lapack/detail/armpl/lapack_ct.hxx"
#undef LAPACK_BACKEND

} //namespace lapack
} //namespace math
} //namespace oneapi
2,588 changes: 2,588 additions & 0 deletions include/oneapi/math/lapack/detail/armpl/lapack_ct.hxx

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions include/oneapi/math/lapack/detail/armpl/onemath_lapack_armpl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright 2025 SiPearl
*
* 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
*
* 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.
*
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

#pragma once

#include <sycl/sycl.hpp>

#include <complex>
#include <cstdint>

#include "oneapi/math/types.hpp"
namespace oneapi {
namespace math {
namespace lapack {
namespace armpl {

#include "onemath_lapack_armpl.hxx"

} // namespace armpl
} // namespace lapack
} // namespace math
} // namespace oneapi
1,523 changes: 1,523 additions & 0 deletions include/oneapi/math/lapack/detail/armpl/onemath_lapack_armpl.hxx

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/lapack/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ endif()
if(ENABLE_ROCSOLVER_BACKEND)
add_subdirectory(rocsolver)
endif()

if(ENABLE_ARMPL_BACKEND)
add_subdirectory(armpl)
endif()

66 changes: 66 additions & 0 deletions src/lapack/backends/armpl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#===============================================================================
# Copyright 2025 SiPearl
#
# 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
#
# 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.
#
#
# SPDX-License-Identifier: Apache-2.0
#===============================================================================

set(LIB_NAME onemath_lapack_armpl)
set(LIB_OBJ ${LIB_NAME}_obj)

# Add third-party library
find_package(ARMPL REQUIRED)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
armpl_wrappers.cpp
armpl_batch.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: armpl_wrappers_table_dyn.cpp>

)

target_include_directories(${LIB_OBJ}
PUBLIC ${ONEMATH_INCLUDE_DIRS}
PRIVATE ${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src
${ARMPL_INCLUDE}
)

target_link_libraries(${LIB_OBJ}
PUBLIC ONEMATH::SYCL::SYCL ${ARMPL_LINK}
)

target_compile_features(${LIB_OBJ} PUBLIC cxx_std_14)
set_target_properties(${LIB_OBJ} PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(${LIB_NAME} PRIVATE ${LIB_OBJ})
target_include_directories(${LIB_NAME} PUBLIC ${ONEMATH_INCLUDE_DIRS})

# Add major version to the library
set_target_properties(${LIB_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
)

# Add dependencies rpath to the library
list(APPEND CMAKE_BUILD_RPATH $<TARGET_FILE_DIR:${LIB_NAME}>)

# Add the library to install package
install(TARGETS ${LIB_OBJ} EXPORT oneMathTargets)
install(TARGETS ${LIB_NAME} EXPORT oneMathTargets
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
Loading

0 comments on commit f7a6f14

Please sign in to comment.