Skip to content

Implementing AVX512 support for 3 channel cv::integral for CV_64F - #13572

Closed
brad-kelly wants to merge 1 commit into
opencv:3.4from
brad-kelly:integral_avx512/3.4
Closed

brad-kelly wants to merge 1 commit into
opencv:3.4from
brad-kelly:integral_avx512/3.4

Conversation

@brad-kelly

@brad-kelly brad-kelly commented Jan 3, 2019 •

Copy link
Copy Markdown
Contributor

Merge with extra: opencv/opencv_extra#567

Implementing AVX512 support using universal intrinsics for the cv::integral method when operating on 3 channel and the result is CV_64F.
Will be following up with other channels and types in later updates.

From opencv_perf_imgproc run results:

Name of Test perfdata no avx512 perfdata avx512 perfdata avx512 vs perfdata no avx512 (x-factor)
integral::Size_MatType_OutMatDepth::(127x61, 8UC3, CV_64F) 0.037 0.009 4.19
integral::Size_MatType_OutMatDepth::(640x480, 8UC3, CV_64F) 1.504 0.374 4.02
integral::Size_MatType_OutMatDepth::(1280x720, 8UC3, CV_64F) 4.710 1.449 3.25
integral::Size_MatType_OutMatDepth::(1920x1080, 8UC3, CV_64F) 10.981 4.030 2.73

@brad-kelly

Copy link
Copy Markdown
Contributor Author

Did I do something wrong here? I thought I submitted the PR for opencv_extra correctly.

@alalek

alalek commented Jan 4, 2019

Copy link
Copy Markdown
Member

integral_avx512/3.4

Problem is forward slash '/' in branch name. It doesn't work well (URL for GitHub API becomes malformed).
Please use letters/numbers/underscore/'.' for branch name.
Need to reopen PRs (opencv_extra branch should be created before opencv PR).

//M*/
#ifndef OPENCV_IMGPROC_SUM_PIXELS_HPP
#define OPENCV_IMGPROC_SUM_PIXELS_HPP
#include "precomp.hpp"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid including of precomp.hpp from .hpp files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks.

{

namespace opt_AVX512_SKX
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra indentation from namespaces

@brad-kelly brad-kelly Jan 4, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. My IDE keeps putting the indentation back after I take it out :-(

sqsum, _sqsumstep, width, height, cn);
return true;
}
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#else
    CV_UNUSED(src); ...
#endif

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2000-2008,2019 Intel Corporation, all rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2000-2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is my understanding that this is not legally allowed. You cannot back-date copyright and since I did not personally publish anything in the range of 2008-2018, it is inaccurate for me to specify any year in that range. I was told this by our legal team a number of years ago when I was training our new hires on coding practices and had to have a section on copyright. For this reason, I believe I need to use a comma to specify my addition of content in 2019 only.

// TODO: Add support for sqsum and 1,2, and 4 channels
class IntegralCalculator_3Channel {
public:
IntegralCalculator_3Channel() {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need class here?
Class is usually used with "template" parameters.
There are no class fields, all members should be "static" (so __always_inline can be safely replaced to inline)

@brad-kelly brad-kelly Jan 4, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the class here is to prepare for the other channels. I am going to use a strategy pattern and factory to handle the rest of the 1,2, and 4 channel integrals and possibly extend this to other architecuture types (AVX2, etc). I haven't templatized it yet because it is not strictly necessary yet.

It is similar to how it is described here but will have a bit more flexibility:
https://github.com/opencv/opencv/wiki/Coding_Style_Guide#high-level-c-interface-algorithms

// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2019, Intel Corporation, all rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use short license header: https://github.com/opencv/opencv/wiki/Coding_Style_Guide#file-structure

// 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) 2019, Intel Corporation, all rights reserved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants