Files
caa20dd196 Adsk contrib - Add support for neon intrinsic integration (#1828)
* Merging the previous ARM Neon branch

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Testing each SIMD variants using a small code snippet and first pass on unifying the way related cmake variables

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing the usage of USE_SSE in favor of the new OCIO_USE_SSE2 as they serve the same purpose

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Using try_compile instead of check_cxx_source_compiles as it was given false positive.  Stubbing cpuinfo for Apple ARM plateform. Handling Apple M1 correctly and adding support for SSE2NEON.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Comments clean up and refactor some comments and documentations

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Added something in the documentation for Rosetta and small change in cmake

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fixing the build under Rosetta and fixing issue in the MacOS CI.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Using try_compile for CheckSupportSSEUsingSSE2NEON to standardize the code and fixed CheckSupport compiler flags.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* use emmintrin.h for only sse2 features

Signed-off-by: Mark Reid <mindmark@gmail.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Allow F16C to be completely turned off

Signed-off-by: Mark Reid <mindmark@gmail.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Seperate SIMD test code from code that adds unit tests.

This isolates the compulation units and
avoids executing illegal hardware instructions

Signed-off-by: Mark Reid <mindmark@gmail.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* remove uneeded checks

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* use software implementations of f16c intrinsics for SSE2

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Added preprocessor checks for ARM as it is needed for universal build on APPLE platform

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding missing checks for "not arm64"

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Ease the future maintainability a the new OCIO_USE_xyz be moving the logic into CPUInfoConfig.h.in as well as fixing issue on ARM when building with OCIO_USE_SSE2NEON=OFF.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fixing some spacing, documentations and making some cmake conditions clearer.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding a build in ci_workflow for macos USE_OCIO_SSE2NEON=OFF

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* typo

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Changing back all the macOS (except one) builds to x86_64 only as it takes double the time to do the universal build.
OCIO no longuer build a universal binary by default

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Update the CMakeLists.txt logic to accomodate all scenario and fixing documentations.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Update documentation and remove ocio_use_sse2neon from the CI matrix

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

---------

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Mark Reid <mindmark@gmail.com>
Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
Co-authored-by: Mark Reid <mindmark@gmail.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
2023-08-31 21:10:29 -04:00

77 lines
2.0 KiB
C++

#include "testutils/UnitTest.h"
#include "CPUInfo.h"
namespace OCIO = OCIO_NAMESPACE;
#if OCIO_USE_SSE2
#define SSE2_CHECK() \
if (!OCIO::CPUInfo::instance().hasSSE2()) throw SkipException()
#define OCIO_ADD_TEST_SSE2(name) \
void sse2_test_##name(); \
OCIO_ADD_TEST(SSE2, name) \
{ \
SSE2_CHECK(); \
sse2_test_##name(); \
}
OCIO_ADD_TEST_SSE2(packed_uint8_to_float_test)
OCIO_ADD_TEST_SSE2(packed_uint10_to_f32_test)
OCIO_ADD_TEST_SSE2(packed_uint12_to_f32_test)
OCIO_ADD_TEST_SSE2(packed_uint16_to_f32_test)
OCIO_ADD_TEST_SSE2(packed_f16_to_f32_test)
OCIO_ADD_TEST_SSE2(packed_nan_inf_test)
OCIO_ADD_TEST_SSE2(packed_all_test)
#endif
#if OCIO_USE_AVX
#define AVX_CHECK() \
if (!OCIO::CPUInfo::instance().hasAVX()) throw SkipException()
#define OCIO_ADD_TEST_AVX(name) \
void avx_test_##name(); \
OCIO_ADD_TEST(AVX, name) \
{ \
AVX_CHECK(); \
avx_test_##name(); \
}
OCIO_ADD_TEST_AVX(packed_uint8_to_float_test)
OCIO_ADD_TEST_AVX(packed_uint10_to_f32_test)
OCIO_ADD_TEST_AVX(packed_uint12_to_f32_test)
OCIO_ADD_TEST_AVX(packed_uint16_to_f32_test)
#if OCIO_USE_F16C
OCIO_ADD_TEST_AVX(packed_f16_to_f32_test)
#endif
OCIO_ADD_TEST_AVX(packed_nan_inf_test)
OCIO_ADD_TEST_AVX(packed_all_test)
#endif
#if OCIO_USE_AVX2
#define AVX2_CHECK() \
if (!OCIO::CPUInfo::instance().hasAVX2()) throw SkipException()
#define OCIO_ADD_TEST_AVX2(name) \
void avx2_test_##name(); \
OCIO_ADD_TEST(AVX2, name) \
{ \
AVX2_CHECK(); \
avx2_test_##name(); \
}
OCIO_ADD_TEST_AVX2(packed_uint8_to_float_test)
OCIO_ADD_TEST_AVX2(packed_uint10_to_f32_test)
OCIO_ADD_TEST_AVX2(packed_uint12_to_f32_test)
OCIO_ADD_TEST_AVX2(packed_uint16_to_f32_test)
#if OCIO_USE_F16C
OCIO_ADD_TEST_AVX2(packed_f16_to_f32_test)
#endif
OCIO_ADD_TEST_AVX2(packed_nan_inf_test)
OCIO_ADD_TEST_AVX2(packed_all_test)
#endif