Skip to content

dnn: cleanup of halide backend for 5.x#24231

Merged
asmorkalov merged 9 commits intoopencv:5.xfrom
fengyuentau:halide_cleanup_5.x
Oct 13, 2023
Merged

dnn: cleanup of halide backend for 5.x#24231
asmorkalov merged 9 commits intoopencv:5.xfrom
fengyuentau:halide_cleanup_5.x

Conversation

@fengyuentau
Copy link
Copy Markdown
Member

Merge with opencv/opencv_extra#1092.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • 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

@fengyuentau fengyuentau added category: dnn cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) labels Sep 6, 2023
@fengyuentau fengyuentau added this to the 5.0 milestone Sep 6, 2023
@fengyuentau fengyuentau mentioned this pull request Sep 6, 2023
7 tasks

testing::internal::ParamGenerator< tuple<Backend, Target> > dnnBackendsAndTargets(
bool withInferenceEngine = true,
bool withHalide = false,
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.

Might break the tests. Can we just check for CV_Assert(!withHalide)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can review every location where dnnBackendsAndTargets is used, and make changes if needed. Let me try.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

All dnnBackendsAndTargets called with parameters should be taken well care now.

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.

Sounds good, thanks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can review every location

This is not one time activity.
In case of parameter change we need to review each of "(5.x) Merge 4.x" PRs.
It is much safer to rename this parameter to bool obsolete_withHalide = false.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, fixing it here will not resolve merging 4.x->5.x issues (no errors would be raised in the most part of cases) which would lead to mistakes.

Copy link
Copy Markdown
Member Author

@fengyuentau fengyuentau Sep 18, 2023

Choose a reason for hiding this comment

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

So how about removing the parameter from 4.x like what we want to do with modules/dnn/test/test_halide_layers.cpp? Does this address your concern?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So how do we do for this issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Series of boolean parameters is anti-pattern, especially in form with optional default values.
Any obvious refactoring is dangerous here, especially in case of regular merges between branches.

It is much safer to rename this parameter to bool obsolete_withHalide = false

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is much safer to rename this parameter to bool obsolete_withHalide = false

Okay, I will do this. I guess we can safely remove this legacy once our main dev branch switches to 5.x, right?

@asmorkalov asmorkalov assigned dkurt and unassigned asmorkalov Sep 7, 2023
@asmorkalov
Copy link
Copy Markdown
Contributor

@fengyuentau There are merge conflicts after 4.x->5.x merge. Please take a look.

@fengyuentau
Copy link
Copy Markdown
Member Author

Thank you for the notification. Conflicts are resolved.

dkurt
dkurt previously approved these changes Sep 15, 2023
Copy link
Copy Markdown
Member

@dkurt dkurt left a comment

Choose a reason for hiding this comment

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

Thanks!

@fengyuentau
Copy link
Copy Markdown
Member Author

Wait, I am doing the merge. Shouldn't we merge test_halide_layers.cpp into test_backends.cpp?

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Sep 15, 2023

@fengyuentau, that would be great, please do.

@dkurt dkurt dismissed their stale review September 15, 2023 08:37

wait for tests merge

Copy link
Copy Markdown
Contributor

@opencv-alalek opencv-alalek left a comment

Choose a reason for hiding this comment

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

On tech meeting there were an agreement on these steps:

  • on 4.x branch refactor modules/dnn/test/test_halide_layers.cpp to extract "generic layers tests"
  • merge 4.x to 5.x
  • update PR with halide drop from 5.x

Such backport is necessary to avoid future 4.x->5.x merge conflicts.

/cc @asmorkalov

@fengyuentau
Copy link
Copy Markdown
Member Author

fengyuentau commented Sep 18, 2023

On tech meeting there were an agreement on these steps:

  • on 4.x branch refactor modules/dnn/test/test_halide_layers.cpp to extract "generic layers tests"
  • merge 4.x to 5.x
  • update PR with halide drop from 5.x

Such backport is necessary to avoid future 4.x->5.x merge conflicts.

/cc @asmorkalov

Just submitted a pr for this #24283

asmorkalov pushed a commit that referenced this pull request Sep 27, 2023
dnn: merge tests from test_halide_layers to test_backends #24283

Context: #24231 (review)

### 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
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@fengyuentau
Copy link
Copy Markdown
Member Author

Waiting for a 4.x -> 5.x merge containing #24283.

@asmorkalov
Copy link
Copy Markdown
Contributor

@fengyuentau I merged 4x->5x and Halide related part has been merged.

hanliutong pushed a commit to hanliutong/opencv that referenced this pull request Oct 7, 2023
dnn: merge tests from test_halide_layers to test_backends opencv#24283

Context: opencv#24231 (review)

### 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
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov
Copy link
Copy Markdown
Contributor

@dkurt @opencv-alalek Friendly reminder.

platform details.
- More than Halide:
- Kernels can be written in unconstrained platform-native code;
- Halide can serve as a backend (one of many).
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 keep this reference. Not related to Halide in dnn.

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.

BTW, @dmatveev, does G-API even support Halide? If not, only some statements are actual:

- Similar to Halide -- separates logic from
  platform details.
- More than Halide:
  - Kernels can be written in unconstrained platform-native code;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I basically revert every gapi doc change about halide.

@asmorkalov
Copy link
Copy Markdown
Contributor

@opencv-alalek Please take a look again.

Copy link
Copy Markdown
Contributor

@opencv-alalek opencv-alalek left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@asmorkalov asmorkalov merged commit d789cb4 into opencv:5.x Oct 13, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
dnn: merge tests from test_halide_layers to test_backends opencv#24283

Context: opencv#24231 (review)

### 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
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
dnn: merge tests from test_halide_layers to test_backends opencv#24283

Context: opencv#24231 (review)

### 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
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@fengyuentau fengyuentau deleted the halide_cleanup_5.x branch June 28, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants