Skip to content

Commit 01a5363

Browse files
committed
CPU: fix compile error on macOS x86
1 parent 42a8410 commit 01a5363

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

devices/cpu/CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ endif()
2828

2929
# ISPC
3030
if(OIDN_ARCH STREQUAL "X64")
31-
set(OIDN_ISPC_TARGET_LIST sse4.1-i32x8 avx2-i32x8 avx512skx-x16 avx512gnr-x16)
31+
if(APPLE)
32+
set(OIDN_ISPC_TARGET_LIST sse4.1-i32x8 avx2-i32x8 avx512skx-x16)
33+
else()
34+
set(OIDN_ISPC_TARGET_LIST sse4.1-i32x8 avx2-i32x8 avx512skx-x16 avx512gnr-x16)
35+
endif()
3236
elseif(OIDN_ARCH STREQUAL "ARM64")
3337
set(OIDN_ISPC_TARGET_LIST neon-i32x8)
3438
endif()
@@ -97,7 +101,7 @@ else()
97101
cpu_conv.cpp
98102
)
99103

100-
if(OIDN_ARCH STREQUAL "X64")
104+
if(OIDN_ARCH STREQUAL "X64" AND NOT APPLE)
101105
list(APPEND OIDN_CPU_SOURCES
102106
cpu_conv_amx.h
103107
cpu_conv_amx.cpp
@@ -138,7 +142,7 @@ ispc_target_add_sources(OpenImageDenoise_device_cpu
138142
TARGET_LIST ${OIDN_ISPC_TARGET_LIST}
139143
)
140144

141-
if(OIDN_ARCH STREQUAL "X64")
145+
if(OIDN_ARCH STREQUAL "X64" AND NOT APPLE)
142146
ispc_target_add_sources(OpenImageDenoise_device_cpu
143147
cpu_input_process_f16.ispc
144148
cpu_output_process_f16.ispc
@@ -168,6 +172,18 @@ elseif(OIDN_ARCH STREQUAL "ARM64")
168172
cpu_upsample_f16.ispc
169173
TARGET_LIST neon-i16x16
170174
)
175+
else()
176+
ispc_target_add_sources(OpenImageDenoise_device_cpu
177+
cpu_input_process_f16.ispc
178+
cpu_output_process_f16.ispc
179+
TARGET_LIST avx512skx-x16
180+
)
181+
182+
ispc_target_add_sources(OpenImageDenoise_device_cpu
183+
cpu_pool_f16.ispc
184+
cpu_upsample_f16.ispc
185+
TARGET_LIST avx512skx-x32
186+
)
171187
endif()
172188

173189
target_link_libraries(OpenImageDenoise_device_cpu PRIVATE OpenImageDenoise_core ${CMAKE_THREAD_LIBS_INIT} TBB::tbb)

devices/cpu/cpu_common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "cpu_common.h"
55
#if !defined(OIDN_BNNS)
66
#include "cpu_conv_ispc.h"
7-
#if defined(OIDN_ARCH_X64)
7+
#if defined(OIDN_ARCH_X64) && !defined(__APPLE__)
88
#include "cpu_conv_amx_ispc.h"
99
#endif
1010
#endif
@@ -125,7 +125,7 @@ OIDN_NAMESPACE_BEGIN
125125
return acc;
126126
}
127127

128-
#if defined(OIDN_ARCH_X64)
128+
#if defined(OIDN_ARCH_X64) && !defined(__APPLE__)
129129
Tensor::operator ispc::TensorAccessor4D_OIhwPoQiRoSi()
130130
{
131131
if (getRank() != 4 || layout != TensorLayout::OIhw2o16i16o2i)

devices/cpu/cpu_engine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "cpu_engine.h"
66
#if !defined(OIDN_BNNS)
77
#include "cpu_conv.h"
8-
#if defined(OIDN_ARCH_X64)
8+
#if defined(OIDN_ARCH_X64) && !defined(__APPLE__)
99
#include "cpu_conv_amx.h"
1010
#endif
1111
#endif
@@ -78,7 +78,7 @@ OIDN_NAMESPACE_BEGIN
7878
#if !defined(OIDN_BNNS)
7979
Ref<Conv> CPUEngine::newConv(const ConvDesc& desc)
8080
{
81-
#if defined(OIDN_ARCH_X64)
81+
#if defined(OIDN_ARCH_X64) && !defined(__APPLE__)
8282
if (device->getArch() == CPUArch::AVX512_AMXFP16)
8383
return makeRef<CPUConvAMX>(this, desc);
8484
else

0 commit comments

Comments
 (0)