Skip to content

Commit 4489bf3

Browse files
committed
remove template armpl
1 parent 4aeca15 commit 4489bf3

File tree

11 files changed

+37
-49
lines changed

11 files changed

+37
-49
lines changed

src/VecSim/spaces/CMakeLists.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,29 @@ if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(aarch64)|(arm64)|(ARM64)|(armv.*)")
9494
if(NOT ARMPL_LIB)
9595
message(STATUS "Could not find ARM Performance Libraries")
9696
else()
97+
add_compile_definitions(OPT_ARMPL)
9798
message(STATUS "Found ARM Performance Libraries: ${ARMPL_LIB}")
98-
endif()
99-
100-
# Create different optimization implementations for ARM architecture
101-
# ArmPL used for standard ARMv8-A with NEON
102-
if (CXX_ARMV8A)
103-
message("Building with ARMV8A and ArmPL")
104-
set_source_files_properties(functions/ARMPL_NEON.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
105-
list(APPEND OPTIMIZATIONS functions/ARMPL_NEON.cpp)
106-
endif()
107-
108-
# ArmPL with SVE support
109-
if (CXX_SVE)
110-
message("Building with SVE and ArmPL")
111-
set_source_files_properties(functions/ARMPL_SVE.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+sve")
112-
list(APPEND OPTIMIZATIONS functions/ARMPL_SVE.cpp)
113-
endif()
114-
115-
# ArmPL with SVE2 support
116-
if (CXX_SVE2)
117-
message("Building with ARMV9 and ArmPL")
118-
set_source_files_properties(functions/ARMPL_SVE2.cpp PROPERTIES COMPILE_FLAGS "-march=armv9-a+sve2")
119-
list(APPEND OPTIMIZATIONS functions/ARMPL_SVE2.cpp)
99+
# Create different optimization implementations for ARM architecture
100+
# ArmPL used for standard ARMv8-A with NEON
101+
if (CXX_ARMV8A)
102+
message("Building with ARMV8A and ArmPL")
103+
set_source_files_properties(functions/ARMPL_NEON.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
104+
list(APPEND OPTIMIZATIONS functions/ARMPL_NEON.cpp)
105+
endif()
106+
107+
# ArmPL with SVE support
108+
if (CXX_SVE)
109+
message("Building with SVE and ArmPL")
110+
set_source_files_properties(functions/ARMPL_SVE.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+sve")
111+
list(APPEND OPTIMIZATIONS functions/ARMPL_SVE.cpp)
112+
endif()
113+
114+
# ArmPL with SVE2 support
115+
if (CXX_SVE2)
116+
message("Building with ARMV9 and ArmPL")
117+
set_source_files_properties(functions/ARMPL_SVE2.cpp PROPERTIES COMPILE_FLAGS "-march=armv9-a+sve2")
118+
list(APPEND OPTIMIZATIONS functions/ARMPL_SVE2.cpp)
119+
endif()
120120
endif()
121121
endif()
122122

src/VecSim/spaces/IP/IP_ARMPL_NEON_FP32.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include <armpl.h>
99

10-
template <unsigned char residual> // 0..15
1110
float FP32_InnerProduct_ARMPL_NEON(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
auto *vec1 = (float *)pVect1v;
1312
auto *vec2 = (float *)pVect2v;

src/VecSim/spaces/IP/IP_ARMPL_SVE2_FP32.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include <armpl.h>
99

10-
template <unsigned char residual> // 0..15
1110
float FP32_InnerProduct_ARMPL_SVE2(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
auto *vec1 = (float *)pVect1v;
1312
auto *vec2 = (float *)pVect2v;

src/VecSim/spaces/IP/IP_ARMPL_SVE_FP32.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include <armpl.h>
99

10-
template <unsigned char residual> // 0..15
1110
float FP32_InnerProduct_ARMPL_SVE(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
auto *vec1 = (float *)pVect1v;
1312
auto *vec2 = (float *)pVect2v;

src/VecSim/spaces/IP_space.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,23 @@ dist_func_t<float> IP_FP32_GetDistFunc(size_t dim, unsigned char *alignment, con
4646

4747
#ifdef OPT_SVE2
4848
if (features.sve2) {
49+
#ifdef OPT_ARMPL
4950
return Choose_FP32_IP_implementation_ARMPL_SVE2(dim);
51+
#endif
5052
}
5153
#endif
5254
#ifdef OPT_SVE
5355
if (features.sve) {
56+
#ifdef OPT_ARMPL
5457
return Choose_FP32_IP_implementation_ARMPL_SVE(dim);
58+
#endif
5559
}
5660
#endif
5761
#ifdef OPT_NEON
5862
if (features.asimd) {
63+
#ifdef OPT_ARMPL
5964
return Choose_FP32_IP_implementation_ARMPL_NEON(dim);
65+
#endif
6066
}
6167
#endif
6268

src/VecSim/spaces/L2/L2_ARMPL_NEON_FP32.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include <armpl.h>
99

10-
template <unsigned char residual> // 0..15
1110
float FP32_L2Sqr_ARMPL_NEON(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
const float *vec1 = static_cast<const float *>(pVect1v);
1312
const float *vec2 = static_cast<const float *>(pVect2v);
@@ -47,4 +46,4 @@ float FP32_L2Sqr_ARMPL_NEON(const void *pVect1v, const void *pVect2v, size_t dim
4746
}
4847

4948
return result;
50-
}
49+
}

src/VecSim/spaces/L2/L2_ARMPL_SVE2_FP32.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include "armpl.h"
99

10-
template <unsigned char residual> // 0..15
1110
float FP32_L2Sqr_ARMPL_SVE2(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
const float *vec1 = static_cast<const float *>(pVect1v);
1312
const float *vec2 = static_cast<const float *>(pVect2v);
@@ -47,4 +46,4 @@ float FP32_L2Sqr_ARMPL_SVE2(const void *pVect1v, const void *pVect2v, size_t dim
4746
}
4847

4948
return result;
50-
}
49+
}

src/VecSim/spaces/L2/L2_ARMPL_SVE_FP32.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "VecSim/spaces/space_includes.h"
88
#include "armpl.h"
99

10-
template <unsigned char residual>
1110
float FP32_L2Sqr_ARMPL_SVE(const void *pVect1v, const void *pVect2v, size_t dimension) {
1211
const float *vec1 = static_cast<const float *>(pVect1v);
1312
const float *vec2 = static_cast<const float *>(pVect2v);
@@ -47,4 +46,4 @@ float FP32_L2Sqr_ARMPL_SVE(const void *pVect1v, const void *pVect2v, size_t dime
4746
}
4847

4948
return result;
50-
}
49+
}

src/VecSim/spaces/functions/ARMPL_NEON.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@ namespace spaces {
1313
#include "implementation_chooser.h"
1414

1515
dist_func_t<float> Choose_FP32_IP_implementation_ARMPL_NEON(size_t dim) {
16-
dist_func_t<float> ret_dist_func;
17-
CHOOSE_IMPLEMENTATION(ret_dist_func, dim, 1, FP32_InnerProduct_ARMPL_NEON);
18-
return ret_dist_func;
16+
return FP32_InnerProduct_ARMPL_NEON;
1917
}
2018

2119
dist_func_t<float> Choose_FP32_L2_implementation_ARMPL_NEON(size_t dim) {
22-
dist_func_t<float> ret_dist_func;
23-
CHOOSE_IMPLEMENTATION(ret_dist_func, dim, 1, FP32_L2Sqr_ARMPL_NEON);
24-
return ret_dist_func;
20+
return FP32_L2Sqr_ARMPL_NEON;
2521
}
2622

2723
#include "implementation_chooser_cleanup.h"

src/VecSim/spaces/functions/ARMPL_SVE.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ namespace spaces {
1414
#include "implementation_chooser.h"
1515

1616
dist_func_t<float> Choose_FP32_IP_implementation_ARMPL_SVE(size_t dim) {
17-
dist_func_t<float> ret_dist_func;
18-
CHOOSE_IMPLEMENTATION(ret_dist_func, dim, 16, FP32_InnerProduct_ARMPL_SVE);
19-
return ret_dist_func;
17+
return FP32_InnerProduct_ARMPL_SVE;
2018
}
2119

2220
dist_func_t<float> Choose_FP32_L2_implementation_ARMPL_SVE(size_t dim) {
23-
dist_func_t<float> ret_dist_func;
24-
CHOOSE_IMPLEMENTATION(ret_dist_func, dim, 16, FP32_L2Sqr_ARMPL_SVE);
25-
return ret_dist_func;
21+
return FP32_L2Sqr_ARMPL_SVE;
2622
}
2723

2824
#include "implementation_chooser_cleanup.h"

0 commit comments

Comments
 (0)