Skip to content

Commit

Permalink
Add AVX512 accelerated 1D/3D LUTS (#1932)
Browse files Browse the repository at this point in the history
* Initial AVX512 support

Signed-off-by: Mark Reid <[email protected]>

* Lut1DOp add AVX512 implementation

Signed-off-by: Mark Reid <[email protected]>

* Lut3DOp add AVX512 implementation

Signed-off-by: Mark Reid <[email protected]>

* Don't use SIMD if only 1 pixel is requested

Signed-off-by: Mark Reid <[email protected]>

* Remove #if, f16c is always available with AVX512

Signed-off-by: Mark Reid <[email protected]>

* Cast pointers to __m512 instead of __m256

Signed-off-by: Mark Reid <[email protected]>

* Use size method from vector being tested

Signed-off-by: Mark Reid <[email protected]>

* Add to help message that f16c is only used with AVX/AVX2

Signed-off-by: Mark Reid <[email protected]>

* Clarify test case by using uint8 maxValue

Signed-off-by: Mark Reid <[email protected]>

---------

Signed-off-by: Mark Reid <[email protected]>
  • Loading branch information
markreidvfx authored Mar 21, 2024
1 parent 50e7d58 commit 91e8826
Show file tree
Hide file tree
Showing 17 changed files with 1,535 additions and 20 deletions.
4 changes: 3 additions & 1 deletion share/cmake/utils/CheckSupportAVX512.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(CheckCXXSourceCompiles)

set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")

if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
Expand All @@ -28,6 +28,8 @@ set(AVX512_CODE "
int main() {
__m512i vec = _mm512_set1_epi32(42);
// gcc <= 6 appear to be missing this intrinsic
__mmask16 k = _mm512_int2mask(42);
return 0;
}
")
Expand Down
8 changes: 8 additions & 0 deletions share/cmake/utils/CheckSupportX86SIMD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ if(MSVC)
if (COMPILER_SUPPORTS_AVX2)
set(OCIO_AVX2_ARGS "/arch:AVX2")
endif()

if (COMPILER_SUPPORTS_AVX512)
set(OCIO_AVX512_ARGS "/arch:AVX512")
endif()
else()
if (COMPILER_SUPPORTS_SSE2)
set(OCIO_SSE2_ARGS "-msse2")
Expand All @@ -42,6 +46,10 @@ else()

if (COMPILER_SUPPORTS_AVX2)
set(OCIO_AVX2_ARGS "-mavx2" "-mfma")
endif()

if (COMPILER_SUPPORTS_AVX512)
set(OCIO_AVX512_ARGS "-mavx512f")
endif()
endif()

Expand Down
Loading

0 comments on commit 91e8826

Please sign in to comment.