mirror of
https://github.com/opencv/opencv.git
synced 2026-09-13 05:42:51 -05:00
Merge pull request #29542 from intel-staging:ipp/enable_instrumentation_fix
Implemented a check to enable instrumentation for IPP HAL #29542 To enable instrumentation for IPP HAL correctly it needed to generalize a part of `private.hpp` and put it to the separate file that can be included in `private.hpp` and `ipp_utils.hpp` both to avoid duplication. Built with `-DENABLE_INSTRUMENTATION=ON` and ran `opencv_perf_imgproc --perf_instrument=1`: | Test | IPP weight before | IPP weight after | |---|---|---| | `distanceTransform` (8U->32F) | 0.0% | ~76% | | `ippSobel` | 0.0% | ~98% | | `scharrViaSobelFilter` | 0.0% | ~90% | ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -46,6 +46,13 @@ if(WITH_IPP_CALLS_ENFORCED)
|
||||
message("WITH_IPP_CALLS_ENFORCED=${WITH_IPP_CALLS_ENFORCED}: enforced IPP calls are enabled in IPP HAL")
|
||||
endif()
|
||||
|
||||
# Enable cv::instr tracing of IPP calls inside the HAL so they show up in the
|
||||
# instrumentation trace / IPP weight. Reuses the engine exported from
|
||||
# opencv_core (symbols resolved at link time as ipphal is archived into core).
|
||||
if(ENABLE_INSTRUMENTATION)
|
||||
target_compile_definitions(ipphal PRIVATE ENABLE_INSTRUMENTATION)
|
||||
endif()
|
||||
|
||||
target_include_directories(ipphal PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-suggest-override)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
// Copyright (C) 2026, Intel Corporation, all rights reserved.
|
||||
|
||||
#ifndef __IPP_HAL_UTILS_HPP__
|
||||
#define __IPP_HAL_UTILS_HPP__
|
||||
@@ -23,7 +24,22 @@
|
||||
# include "ipp.h"
|
||||
#endif
|
||||
|
||||
// IPP call instrumentation for the standalone IPP HAL.
|
||||
//
|
||||
// The HAL is built as a separate static library that does not include the
|
||||
// internal core/private.hpp, so by default its IPP calls never appear in the
|
||||
// cv::instr trace (reported IPP weight = 0%). When the parent build enables
|
||||
// ENABLE_INSTRUMENTATION, the shared instrumentation.private.hpp provides the
|
||||
// exact same CV_INSTRUMENT_FUN_IPP macro used by core (backed by symbols exported
|
||||
// from libopencv_core, resolved at link time), so HAL IPP calls are traced
|
||||
// identically to in-module ones. Otherwise the no-op passthrough is used.
|
||||
#if !defined(CV_INSTRUMENT_FUN_IPP)
|
||||
#if defined(ENABLE_INSTRUMENTATION)
|
||||
#include "opencv2/core/utils/instrumentation.private.hpp"
|
||||
#else
|
||||
#define CV_INSTRUMENT_FUN_IPP(FUN, ...) ((FUN)(__VA_ARGS__))
|
||||
#endif // defined(ENABLE_INSTRUMENTATION)
|
||||
#endif // !defined(CV_INSTRUMENT_FUN_IPP)
|
||||
|
||||
#define CV_HAL_CHECK_USE_IPP() if(!cv::ipp::useIPP()) return CV_HAL_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user