Skip to content

Commit

Permalink
Update from IPP-ICV (from OpenCV) to 2021.11 IPP
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Jun 3, 2024
1 parent 146e222 commit c28a890
Show file tree
Hide file tree
Showing 21 changed files with 146 additions and 180 deletions.
29 changes: 14 additions & 15 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1828,26 +1828,25 @@ if (BUILD_CUDA_MODULE)
endif ()

# IPP
if (WITH_IPPICV)
if (WITH_IPP)
# Ref: https://stackoverflow.com/a/45125525
set(IPPICV_SUPPORTED_HW AMD64 x86_64 x64 x86 X86 i386 i686)
set(IPP_SUPPORTED_HW AMD64 x86_64 x64) # 32 bit deprecated: x86 X86 i386 i686
# Unsupported: ARM64 aarch64 armv7l armv8b armv8l ...
if (NOT CMAKE_HOST_SYSTEM_PROCESSOR IN_LIST IPPICV_SUPPORTED_HW)
set(WITH_IPPICV OFF)
message(WARNING "IPP-ICV disabled: Unsupported Platform.")
if (NOT CMAKE_HOST_SYSTEM_PROCESSOR IN_LIST IPP_SUPPORTED_HW)
set(WITH_IPP OFF)
message(WARNING "Intel IPP disabled: Unsupported Platform.")
else ()
include(${Open3D_3RDPARTY_DIR}/ippicv/ippicv.cmake)
if (WITH_IPPICV)
message(STATUS "IPP-ICV ${IPPICV_VERSION_STRING} available. Building interface wrappers IPP-IW.")
open3d_import_3rdparty_library(3rdparty_ippicv
include(${Open3D_3RDPARTY_DIR}/ipp/ipp.cmake)
if (WITH_IPP)
message(STATUS "Using Intel IPP ${IPP_VERSION_STRING}. IPP_LIBRARIES: ${IPP_LIBRARIES}")
open3d_import_3rdparty_library(3rdparty_ipp
HIDDEN
INCLUDE_DIRS ${IPPICV_INCLUDE_DIR}
LIBRARIES ${IPPICV_LIBRARIES}
LIB_DIR ${IPPICV_LIB_DIR}
DEPENDS ext_ippicv
INCLUDE_DIRS ${IPP_INCLUDE_DIR}
LIBRARIES ${IPP_LIBRARIES}
LIB_DIR ${IPP_LIB_DIR}
DEPENDS ext_ipp
)
target_compile_definitions(3rdparty_ippicv INTERFACE ${IPPICV_DEFINITIONS})
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_ippicv)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_ipp)
endif()
endif()
endif ()
Expand Down
File renamed without changes.
52 changes: 52 additions & 0 deletions 3rdparty/ipp/ipp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Output variables:
# - IPP_INCLUDE_DIR
# - IPP_LIBRARIES
# - IPP_LIB_DIR

include(ExternalProject)

# Check in order APPLE -> WIN32 -> UNIX, since UNIX may be defined on APPLE / WIN32 as well
set(IPP_VERSION_STRING "2021.11.0") # From ipp/ippversion.h
if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64)
set(IPP_VERSION_STRING "2021.9.1") # From ipp/ippversion.h
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.9.1-macosx_10_15_x86_64.tar.xz")
set(IPP_HASH "f27e45da604a1f6d1d2a747a0f67ffafeaff084b0f860a963d8c3996e2f40bb3")
elseif(WIN32 AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64)
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.11.0-win_amd64.zip")
set(IPP_HASH "69e8a7dc891609de6fea478a67659d2f874d12b51a47bd2e3e5a7c4c473c53a6")
elseif(UNIX AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64)
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.11.0-linux_x86_64.tar.xz")
set(IPP_HASH "51f33fd5bf5011e9eae0e034e5cc70a7c0ac0ba93d6a3f66fd7e145cf1a5e30b")
else()
set(WITH_IPP OFF)
message(FATAL_ERROR "Intel IPP disabled: Unsupported Platform.")
return()
endif()

if(WIN32)
set(TL mt_tl_tbb)
set(IPP_SUBPATH "Library/")
else()
set(TL _tl_tbb)
set(IPP_SUBPATH "")
endif()

ExternalProject_Add(ext_ipp
PREFIX ipp
URL ${IPP_URL}
URL_HASH SHA256=${IPP_HASH}
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/ipp"
# Copy all libs from lib/tl/tbb to lib/ since Open3D cmake scripts only support one LIB_DIR per dependency
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/${IPP_SUBPATH}lib/tl/tbb/ <SOURCE_DIR>/${IPP_SUBPATH}lib/
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(ext_ipp SOURCE_DIR)
set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/")
# Threading layer libs must be linked first.
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html
# Library dependency order:
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html
set(IPP_LIBRARIES ipp_iw ippcv${TL} ippcv ippi${TL} ippi ippcc${TL} ippcc ipps ippvm ippcore${TL} ippcore)
set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib")
34 changes: 0 additions & 34 deletions 3rdparty/ippicv/CMakeLists.txt

This file was deleted.

57 changes: 0 additions & 57 deletions 3rdparty/ippicv/ippicv.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endif()
option(BUILD_COMMON_ISPC_ISAS "Build for common ISPC ISAs (for release)" OFF)
option(BUILD_GUI "Builds new GUI" ON )
option(WITH_OPENMP "Use OpenMP multi-threading" ON )
option(WITH_IPPICV "Use Intel Performance Primitives" ON )
option(WITH_IPP "Use Intel Integrated Performance Primitives" ON )
option(ENABLE_HEADLESS_RENDERING "Use OSMesa for headless rendering" OFF)
if(BUILD_SHARED_LIBS)
option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Open3DPrintConfigurationSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function(open3d_print_configuration_summary)
GLFW
googletest
imgui
ippicv
ipp
JPEG
jsoncpp
liblzf
Expand Down
4 changes: 2 additions & 2 deletions cmake/Open3DSetGlobalProperties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function(open3d_set_global_properties target)
if (USE_BLAS)
target_compile_definitions(${target} PRIVATE USE_BLAS)
endif()
if (WITH_IPPICV)
target_compile_definitions(${target} PRIVATE WITH_IPPICV)
if (WITH_IPP)
target_compile_definitions(${target} PRIVATE WITH_IPP)
endif()
if (GLIBCXX_USE_CXX11_ABI)
target_compile_definitions(${target} PUBLIC _GLIBCXX_USE_CXX11_ABI=1)
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (BUILD_CUDA_MODULE)
target_include_directories(benchmarks SYSTEM PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
endif()

if (WITH_IPPICV)
if (WITH_IPP)
target_compile_definitions(benchmarks PRIVATE IPP_CONDITIONAL_TEST_STR=) # Empty string (test not disabled)
else()
target_compile_definitions(benchmarks PRIVATE IPP_CONDITIONAL_TEST_STR=DISABLED_)
Expand Down
4 changes: 2 additions & 2 deletions cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static core::Tensor CreateIntrisicTensor() {

static void ComputeOdometryResultPointToPlane(benchmark::State& state,
const core::Device& device) {
if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) {
if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) {
return;
}

Expand Down Expand Up @@ -97,7 +97,7 @@ static void RGBDOdometryMultiScale(
benchmark::State& state,
const core::Device& device,
const t::pipelines::odometry::Method& method) {
if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) {
if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) {
return;
}

Expand Down
16 changes: 8 additions & 8 deletions cpp/open3d/t/geometry/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Image Image::To(core::Dtype dtype,
dst_im.data_ = core::Tensor::Empty(
{GetRows(), GetCols(), GetChannels()}, dtype, GetDevice());
}
if (HAVE_IPPICV && // Check for IPP fast implementation.
if (HAVE_IPP && // Check for IPP fast implementation.
data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(), GetDtype()) >
0 &&
Expand Down Expand Up @@ -140,7 +140,7 @@ Image Image::RGBToGray() const {
std::count(npp_supported.begin(), npp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::RGBToGray, data_, dst_im.data_);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::RGBToGray, data_, dst_im.data_);
Expand Down Expand Up @@ -180,7 +180,7 @@ Image Image::Resize(float sampling_rate, InterpType interp_type) const {
std::count(npp_supported.begin(), npp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::Resize, data_, dst_im.data_, interp_type);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::Resize, data_, dst_im.data_, interp_type);
Expand Down Expand Up @@ -217,7 +217,7 @@ Image Image::Dilate(int kernel_size) const {
std::count(npp_supported.begin(), npp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::Dilate, data_, dst_im.data_, kernel_size);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::Dilate, data_, dst_im.data_, kernel_size);
Expand Down Expand Up @@ -254,7 +254,7 @@ Image Image::FilterBilateral(int kernel_size,
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::FilterBilateral, data_, dst_im.data_, kernel_size,
value_sigma, dist_sigma);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::FilterBilateral, data_, dst_im.data_, kernel_size,
Expand Down Expand Up @@ -286,7 +286,7 @@ Image Image::Filter(const core::Tensor &kernel) const {
std::count(npp_supported.begin(), npp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::Filter, data_, dst_im.data_, kernel);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::Filter, data_, dst_im.data_, kernel);
Expand Down Expand Up @@ -322,7 +322,7 @@ Image Image::FilterGaussian(int kernel_size, float sigma) const {
std::count(npp_supported.begin(), npp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::FilterGaussian, data_, dst_im.data_, kernel_size, sigma);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::FilterGaussian, data_, dst_im.data_, kernel_size, sigma);
Expand Down Expand Up @@ -371,7 +371,7 @@ std::pair<Image, Image> Image::FilterSobel(int kernel_size) const {
std::make_pair(GetDtype(), GetChannels())) > 0) {
CUDA_CALL(npp::FilterSobel, data_, dst_im_dx.data_, dst_im_dy.data_,
kernel_size);
} else if (HAVE_IPPICV && data_.IsCPU() &&
} else if (HAVE_IPP && data_.IsCPU() &&
std::count(ipp_supported.begin(), ipp_supported.end(),
std::make_pair(GetDtype(), GetChannels())) > 0) {
IPP_CALL(ipp::FilterSobel, data_, dst_im_dx.data_, dst_im_dy.data_,
Expand Down
8 changes: 4 additions & 4 deletions cpp/open3d/t/geometry/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ class Image : public Geometry {
/// \brief Text description.
std::string ToString() const;

/// Do we use IPP ICV for accelerating image processing operations?
#ifdef WITH_IPPICV
static constexpr bool HAVE_IPPICV = true;
/// Do we use IPP for accelerating image processing operations?
#ifdef WITH_IPP
static constexpr bool HAVE_IPP = true;
#else
static constexpr bool HAVE_IPPICV = false;
static constexpr bool HAVE_IPP = false;
#endif

protected:
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/t/geometry/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (BUILD_CUDA_MODULE)
)
endif()

if (WITH_IPPICV)
if (WITH_IPP)
target_sources(tgeometry_kernel PRIVATE
IPPImage.cpp
)
Expand Down
Loading

0 comments on commit c28a890

Please sign in to comment.