Skip to content

Commit f7a6f14

Browse files
adegommenicolas-boutonrdolbeau
authored
[LAPACK] Add Arm Performance Libraries backend (#633)
Signed-off-by: Augustin Degomme <[email protected]> Co-authored-by: Nicolas Bouton <[email protected]> Co-authored-by: Romain Dolbeau <[email protected]>
1 parent af66e5e commit f7a6f14

15 files changed

+9274
-3
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ endif()
100100
if(ENABLE_MKLCPU_BACKEND
101101
OR ENABLE_MKLGPU_BACKEND
102102
OR ENABLE_CUSOLVER_BACKEND
103-
OR ENABLE_ROCSOLVER_BACKEND)
103+
OR ENABLE_ROCSOLVER_BACKEND
104+
OR ENABLE_ARMPL_BACKEND)
104105
list(APPEND DOMAINS_LIST "lapack")
105106
endif()
106107
if(ENABLE_MKLCPU_BACKEND

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,18 @@ Supported compilers include:
251251
<td align="center">Dynamic, Static</td>
252252
</tr>
253253
<tr>
254-
<td rowspan=4 align="center">LAPACK</td>
254+
<td rowspan=5 align="center">LAPACK</td>
255255
<td align="center">x86 CPU</td>
256256
<td align="center">Intel(R) oneMKL</td>
257257
<td align="center">Intel DPC++</td>
258258
<td align="center">Dynamic, Static</td>
259259
</tr>
260+
<tr>
261+
<td align="center">aarch64 CPU</td>
262+
<td align="center">Arm Performance Libraries</td>
263+
<td align="center">Open DPC++</br>AdaptiveCpp</td>
264+
<td align="center">Dynamic, Static</td>
265+
</tr>
260266
<tr>
261267
<td align="center">Intel GPU</td>
262268
<td align="center">Intel(R) oneMKL</td>

include/oneapi/math/detail/backends_table.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ static std::map<domain, std::map<device, std::vector<const char*>>> libraries =
151151
LIB_NAME("lapack_mklcpu")
152152
#endif
153153
} },
154+
{ device::aarch64cpu,
155+
{
156+
#ifdef ONEMATH_ENABLE_ARMPL_BACKEND
157+
LIB_NAME("lapack_armpl"),
158+
#endif
159+
} },
160+
154161
{ device::intelgpu,
155162
{
156163
#ifdef ONEMATH_ENABLE_MKLGPU_BACKEND

include/oneapi/math/lapack.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@
3333
#ifdef ONEMATH_ENABLE_ROCSOLVER_BACKEND
3434
#include "oneapi/math/lapack/detail/rocsolver/lapack_ct.hpp"
3535
#endif
36+
#ifdef ONEMATH_ENABLE_ARMPL_BACKEND
37+
#include "oneapi/math/lapack/detail/armpl/lapack_ct.hpp"
38+
#endif
3639

3740
#include "oneapi/math/lapack/detail/lapack_rt.hpp"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*******************************************************************************
2+
* Copyright 2025 SiPearl
3+
* Copyright 2021 Intel Corporation
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions
15+
* and limitations under the License.
16+
*
17+
*
18+
* SPDX-License-Identifier: Apache-2.0
19+
*******************************************************************************/
20+
21+
#pragma once
22+
23+
#include <complex>
24+
#include <cstdint>
25+
26+
#include <sycl/sycl.hpp>
27+
28+
#include "oneapi/math/types.hpp"
29+
#include "oneapi/math/lapack/types.hpp"
30+
#include "oneapi/math/detail/backend_selector.hpp"
31+
#include "oneapi/math/lapack/detail/armpl/onemath_lapack_armpl.hpp"
32+
33+
namespace oneapi {
34+
namespace math {
35+
namespace lapack {
36+
37+
#define LAPACK_BACKEND armpl
38+
#include "oneapi/math/lapack/detail/armpl/lapack_ct.hxx"
39+
#undef LAPACK_BACKEND
40+
41+
} //namespace lapack
42+
} //namespace math
43+
} //namespace oneapi

include/oneapi/math/lapack/detail/armpl/lapack_ct.hxx

+2,588
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*******************************************************************************
2+
* Copyright 2025 SiPearl
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions
14+
* and limitations under the License.
15+
*
16+
*
17+
* SPDX-License-Identifier: Apache-2.0
18+
*******************************************************************************/
19+
20+
#pragma once
21+
22+
#include <sycl/sycl.hpp>
23+
24+
#include <complex>
25+
#include <cstdint>
26+
27+
#include "oneapi/math/types.hpp"
28+
namespace oneapi {
29+
namespace math {
30+
namespace lapack {
31+
namespace armpl {
32+
33+
#include "onemath_lapack_armpl.hxx"
34+
35+
} // namespace armpl
36+
} // namespace lapack
37+
} // namespace math
38+
} // namespace oneapi

include/oneapi/math/lapack/detail/armpl/onemath_lapack_armpl.hxx

+1,523
Large diffs are not rendered by default.

src/lapack/backends/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ endif()
3535
if(ENABLE_ROCSOLVER_BACKEND)
3636
add_subdirectory(rocsolver)
3737
endif()
38+
39+
if(ENABLE_ARMPL_BACKEND)
40+
add_subdirectory(armpl)
41+
endif()
42+
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#===============================================================================
2+
# Copyright 2025 SiPearl
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing,
11+
# software distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions
14+
# and limitations under the License.
15+
#
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
#===============================================================================
19+
20+
set(LIB_NAME onemath_lapack_armpl)
21+
set(LIB_OBJ ${LIB_NAME}_obj)
22+
23+
# Add third-party library
24+
find_package(ARMPL REQUIRED)
25+
26+
add_library(${LIB_NAME})
27+
add_library(${LIB_OBJ} OBJECT
28+
armpl_wrappers.cpp
29+
armpl_batch.cpp
30+
$<$<BOOL:${BUILD_SHARED_LIBS}>: armpl_wrappers_table_dyn.cpp>
31+
32+
)
33+
34+
target_include_directories(${LIB_OBJ}
35+
PUBLIC ${ONEMATH_INCLUDE_DIRS}
36+
PRIVATE ${PROJECT_SOURCE_DIR}/src/include
37+
${PROJECT_SOURCE_DIR}/src
38+
${ARMPL_INCLUDE}
39+
)
40+
41+
target_link_libraries(${LIB_OBJ}
42+
PUBLIC ONEMATH::SYCL::SYCL ${ARMPL_LINK}
43+
)
44+
45+
target_compile_features(${LIB_OBJ} PUBLIC cxx_std_14)
46+
set_target_properties(${LIB_OBJ} PROPERTIES
47+
POSITION_INDEPENDENT_CODE ON
48+
)
49+
target_link_libraries(${LIB_NAME} PRIVATE ${LIB_OBJ})
50+
target_include_directories(${LIB_NAME} PUBLIC ${ONEMATH_INCLUDE_DIRS})
51+
52+
# Add major version to the library
53+
set_target_properties(${LIB_NAME} PROPERTIES
54+
SOVERSION ${PROJECT_VERSION_MAJOR}
55+
)
56+
57+
# Add dependencies rpath to the library
58+
list(APPEND CMAKE_BUILD_RPATH $<TARGET_FILE_DIR:${LIB_NAME}>)
59+
60+
# Add the library to install package
61+
install(TARGETS ${LIB_OBJ} EXPORT oneMathTargets)
62+
install(TARGETS ${LIB_NAME} EXPORT oneMathTargets
63+
RUNTIME DESTINATION bin
64+
ARCHIVE DESTINATION lib
65+
LIBRARY DESTINATION lib
66+
)

0 commit comments

Comments
 (0)