blob: b02faf57ae53bbe1713c0f05b60a9194a906aabd [file]
# SPDX-FileCopyrightText: The Eigen Authors
# SPDX-License-Identifier: MPL-2.0
if(BLAS_FOUND)
# HAVE_BLAS adds BM_BlasGemm, the reference sgemm_/dgemm_ on the same grid.
eigen_add_benchmark(bench_gemm bench_gemm.cpp
LIBRARIES ${BLAS_LIBRARIES} DEFINITIONS HAVE_BLAS)
eigen_add_benchmark(bench_gemm_double bench_gemm.cpp
LIBRARIES ${BLAS_LIBRARIES} DEFINITIONS HAVE_BLAS SCALAR=double)
else()
eigen_add_benchmark(bench_gemm bench_gemm.cpp)
eigen_add_benchmark(bench_gemm_double bench_gemm.cpp DEFINITIONS SCALAR=double)
endif()
eigen_add_benchmark(bench_gemm_complex bench_gemm.cpp
DEFINITIONS "SCALAR=std::complex<float>" EIGEN_BENCH_COMPLEX_SCALAR)
eigen_add_benchmark(bench_gemm_complex_double bench_gemm.cpp
DEFINITIONS "SCALAR=std::complex<double>" EIGEN_BENCH_COMPLEX_SCALAR)
eigen_add_benchmark(bench_gemm_threads bench_gemm_threads.cpp)
eigen_add_benchmark(bench_gemm_threads_double bench_gemm_threads.cpp DEFINITIONS SCALAR=double)
eigen_add_benchmark(bench_gemm_scaled bench_gemm_scaled.cpp)
eigen_add_benchmark(bench_gemm_scaled_double bench_gemm_scaled.cpp DEFINITIONS SCALAR=double)
eigen_add_benchmark(bench_gemm_scaled_complex bench_gemm_scaled.cpp DEFINITIONS "SCALAR=std::complex<float>")
eigen_add_benchmark(bench_gemm_scaled_complex_double bench_gemm_scaled.cpp DEFINITIONS "SCALAR=std::complex<double>")
eigen_add_benchmark(bench_gemv bench_gemv.cpp)
eigen_add_benchmark(bench_vecadd bench_vecadd.cpp)
foreach(scalar float double)
foreach(operation abs:0 square:1 add:2 copy:3 exp:4)
string(REPLACE ":" ";" operation ${operation})
list(GET operation 0 name)
list(GET operation 1 index)
eigen_add_benchmark(bench_assignment_${name}_${scalar} bench_assignment.cpp
DEFINITIONS EIGEN_BENCH_ASSIGN_SCALAR=${scalar} EIGEN_BENCH_ASSIGN_OP=${index})
endforeach()
endforeach()
eigen_add_benchmark(bench_trsm bench_trsm.cpp)
eigen_add_benchmark(bench_trsm_packet bench_trsm_packet.cpp)
eigen_add_benchmark(bench_reverse bench_reverse.cpp)
eigen_add_benchmark(bench_permutation_product bench_permutation_product.cpp)
eigen_add_benchmark(bench_permutation_transposition bench_permutation_transposition.cpp)
eigen_add_benchmark(bench_move_semantics bench_move_semantics.cpp)
eigen_add_benchmark(bench_conservative_resize bench_conservative_resize.cpp)
eigen_add_benchmark(bench_reductions bench_reductions.cpp)
eigen_add_benchmark(bench_vectorwise_norm bench_vectorwise_norm.cpp)
eigen_add_benchmark(bench_complex_components bench_complex_components.cpp)
eigen_add_benchmark(bench_unary_pow bench_unary_pow.cpp)
eigen_add_benchmark(bench_pgather bench_pgather.cpp)
eigen_add_benchmark(bench_boolean_reductions bench_boolean_reductions.cpp)
# One binary per family: in a shared TU, inlining and alignment shift with unrelated benchmark bodies.
foreach(family float:All float:Any float:AllFinite float:IsZero float:ApproxConstant
double:All double:AllFinite double:IsZero int:All int:Any
int16_t:All int16_t:Any bool:All bool:Any)
string(REPLACE ":" ";" family ${family})
list(GET family 0 scalar)
list(GET family 1 operation)
string(TOLOWER ${operation} operation_name)
eigen_add_benchmark(bench_predicate_${operation_name}_${scalar} bench_predicate_reductions.cpp
DEFINITIONS EIGEN_BENCH_PREDICATE_SCALAR=${scalar} EIGEN_BENCH_PREDICATE_OP=${operation})
endforeach()
foreach(family Array4f:Any Array16f:AllFinite Array33f:IsZero Matrix4d:IsZero Vector3f:All)
string(REPLACE ":" ";" family ${family})
list(GET family 0 xpr)
list(GET family 1 operation)
string(TOLOWER "${operation}_${xpr}" target_suffix)
eigen_add_benchmark(bench_predicate_${target_suffix} bench_predicate_reductions.cpp
DEFINITIONS EIGEN_BENCH_PREDICATE_XPR=${xpr} EIGEN_BENCH_PREDICATE_OP=${operation})
endforeach()
eigen_add_benchmark(bench_predicate_block_iszero bench_predicate_reductions.cpp)
# Separate operations and storage families to avoid moving unrelated hot loops.
foreach(operation All Any Count)
string(TOLOWER ${operation} operation_name)
eigen_add_benchmark(bench_visitor_${operation_name} bench_visitor.cpp
DEFINITIONS EIGEN_BENCH_VISITOR_OP=${operation} EIGEN_BENCH_VISITOR_STRIDED=false)
eigen_add_benchmark(bench_visitor_${operation_name}_strided bench_visitor.cpp
DEFINITIONS EIGEN_BENCH_VISITOR_OP=${operation} EIGEN_BENCH_VISITOR_STRIDED=true)
endforeach()
eigen_add_benchmark(bench_count bench_count.cpp)
eigen_add_benchmark(bench_matrix_checks bench_matrix_checks.cpp)
eigen_add_benchmark(bench_dot bench_dot.cpp)
eigen_add_benchmark(bench_stable_norm bench_stable_norm.cpp)
eigen_add_benchmark(bench_approx_comparisons bench_approx_comparisons.cpp)
eigen_add_benchmark(bench_selfadjoint_l1norm bench_selfadjoint_l1norm.cpp)
eigen_add_benchmark(bench_selfadjoint_permutation bench_selfadjoint_permutation.cpp)
eigen_add_benchmark(bench_cwise_math bench_cwise_math.cpp)
eigen_add_benchmark(bench_complex_sqrt bench_complex_sqrt.cpp)
eigen_add_benchmark(bench_cast bench_cast.cpp)
eigen_add_benchmark(bench_complex_log bench_complex_log.cpp)
eigen_add_benchmark(bench_int64_ops bench_int64_ops.cpp)
eigen_add_benchmark(bench_packet_ops bench_packet_ops.cpp)
eigen_add_benchmark(bench_broadcasting bench_broadcasting.cpp)
eigen_add_benchmark(bench_block_ops bench_block_ops.cpp)
eigen_add_benchmark(bench_block_coeffwise bench_block_coeffwise.cpp)
eigen_add_benchmark(bench_map bench_map.cpp)
eigen_add_benchmark(bench_reshaped bench_reshaped.cpp)
eigen_add_benchmark(bench_diagonal bench_diagonal.cpp)
eigen_add_benchmark(bench_diagonal_move bench_diagonal_move.cpp)
eigen_add_benchmark(bench_triangular_product bench_triangular_product.cpp)
eigen_add_benchmark(bench_selfadjoint_product bench_selfadjoint_product.cpp)
eigen_add_benchmark(bench_gemm_packing bench_gemm_packing.cpp)
eigen_add_benchmark(bench_symv bench_symv.cpp)
eigen_add_benchmark(bench_trmv bench_trmv.cpp)
eigen_add_benchmark(bench_syr bench_syr.cpp)
eigen_add_benchmark(bench_syr2 bench_syr2.cpp)
eigen_add_benchmark(bench_construction bench_construction.cpp)
eigen_add_benchmark(bench_fixed_size bench_fixed_size.cpp)
eigen_add_benchmark(bench_fixed_size_double bench_fixed_size.cpp DEFINITIONS SCALAR=double)
eigen_add_benchmark(bench_fixed_size_complex bench_fixed_size.cpp DEFINITIONS "SCALAR=std::complex<float>")
eigen_add_benchmark(bench_fixed_size_complex_double bench_fixed_size.cpp DEFINITIONS "SCALAR=std::complex<double>")
# EIGEN_BENCH_FORCE_GEMM: the same sweep with every product on the GEMM path, to compare against the default.
eigen_add_benchmark(bench_fixed_size_gemm bench_fixed_size.cpp DEFINITIONS EIGEN_BENCH_FORCE_GEMM)
eigen_add_benchmark(bench_fixed_size_gemm_double bench_fixed_size.cpp DEFINITIONS EIGEN_BENCH_FORCE_GEMM SCALAR=double)
eigen_add_benchmark(bench_fixed_size_gemm_complex bench_fixed_size.cpp
DEFINITIONS EIGEN_BENCH_FORCE_GEMM "SCALAR=std::complex<float>")
eigen_add_benchmark(bench_fixed_size_gemm_complex_double bench_fixed_size.cpp
DEFINITIONS EIGEN_BENCH_FORCE_GEMM "SCALAR=std::complex<double>")
eigen_add_benchmark(bench_small_matrix bench_small_matrix.cpp)
eigen_add_benchmark(bench_small_dynamic_product bench_small_dynamic_product.cpp)
eigen_add_benchmark(bench_scaled_product bench_scaled_product.cpp)
eigen_add_benchmark(bench_outer_product bench_outer_product.cpp)
eigen_add_benchmark(bench_selfadjoint_diagonal bench_selfadjoint_diagonal.cpp)
eigen_add_benchmark(bench_segment_tail bench_segment_tail.cpp)
eigen_add_benchmark(bench_boolean_ops bench_boolean_ops.cpp)
eigen_add_benchmark(bench_boolean_ops_novec bench_boolean_ops.cpp DEFINITIONS EIGEN_DONT_VECTORIZE)