Skip to content

Commit

Permalink
Feature/alignment 8 (#141)
Browse files Browse the repository at this point in the history
* Set RTNEURAL_DEFAULT_ALIGNMENT=8 on armv7

* Add Eigen::Aligned8 to RTNeuralEigenAlignment options
  • Loading branch information
MaxPayne86 authored Jun 22, 2024
1 parent 680f620 commit 8c1847d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions RTNeural/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ constexpr T ceil_div(T num, T den)
namespace RTNEURAL_NAMESPACE
{
#if RTNEURAL_DEFAULT_ALIGNMENT == 32
constexpr auto RTNeuralEigenAlignment = Eigen::Aligned32;
constexpr auto RTNeuralEigenAlignment = Eigen::Aligned32;
#elif RTNEURAL_DEFAULT_ALIGNMENT == 16
constexpr auto RTNeuralEigenAlignment = Eigen::Aligned16;
#elif RTNEURAL_DEFAULT_ALIGNMENT == 8
constexpr auto RTNeuralEigenAlignment = Eigen::Aligned8;
#else
constexpr auto RTNeuralEigenAlignment = Eigen::Aligned16;
#error "Unsupported alignment"
#endif
} // namespace RTNEURAL_NAMESPACE

Expand Down
6 changes: 5 additions & 1 deletion cmake/SIMDExtensions.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
option(RTNEURAL_USE_AVX "Enables AVX SIMD Support" OFF)
if(NOT RTNEURAL_USE_AVX)
target_compile_definitions(RTNeural PUBLIC RTNEURAL_DEFAULT_ALIGNMENT=16)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7")
target_compile_definitions(RTNeural PUBLIC RTNEURAL_DEFAULT_ALIGNMENT=8)
else()
target_compile_definitions(RTNeural PUBLIC RTNEURAL_DEFAULT_ALIGNMENT=16)
endif()
else()
message(STATUS "RTNeural -- Attempting to enable AVX...")

Expand Down

0 comments on commit 8c1847d

Please sign in to comment.