5 Commits
Author SHA1 Message Date
Savya Sanchi Sharma 61127d3812 Merge pull request #29656 from SavyaSanchi-Sharma:backendAgnostic
Added Backend Agnostic fusion in DNN - #29656

# What This Adds

A way for any layer, on any backend, to absorb trailing per-element math — with the pass knowing nothing about either layer and holding no list of op types.

- **Description**: `LayerMath` (one layer's math) → `AdjacencyGraph` (hash-consed chain)
- **Contract**: two `bool` virtuals on `Layer`
- **CPU implementations**: three, behind that contract

Pointwise fusion is the first consumer, not the point.

## The Problem

```cpp
ActivationLayer* activ = dynamic_cast<ActivationLayer*>(layer_ptr);
Conv2Layer* conv = getLayer<Conv2Layer>(newprog, conv_layer_idx);
if (conv) conv->fuseActivation(layer);
```

Guest type, host type, method name all hardcoded in the pass. `Clip` never fused (fails the cast), `Gemm` never fused (no virtual), no 2-op chain fused at all, and no backend could fuse anything without a CPU-specific method.


## Results

| Model                 | 5.x      | this PR  | speedup |
|-----------------------|----------|----------|---------|
| MPHand                | 2.34 ms  | 1.03 ms  | 2.27    |
| EfficientNet          | 9.82 ms  | 5.00 ms  | 1.96    |
| MPPose                | 5.14 ms  | 2.81 ms  | 1.83    |
| MobileNet_SSD_v1_ONNX | 12.58 ms | 8.38 ms  | 1.50    |
| BlazeFace             | 0.95 ms  | 0.77 ms  | 1.23    |
| DenseNet_121          | 20.56 ms | 19.08 ms | 1.08    |
| MobileNetv2_ONNX      | 2.07 ms  | 1.99 ms  | 1.04    |
| MobileViT_XS          | 6.33 ms  | 6.11 ms  | 1.04    |
| YuNet_320             | 1.33 ms  | 1.27 ms  | 1.04    |
| PPOCRv3               | 43.05 ms | 42.15 ms | 1.02    |
| BERT                  | 9.78 ms  | 9.68 ms  | 1.01    |
| BEiT_Base_Patch16_224 | 27.48 ms | 27.08 ms | 1.01    |
| DeiT_Tiny_Patch16_224 | 4.74 ms  | 4.72 ms  | 1.01    |
| MPPalm                | 1.88 ms  | 1.85 ms  | 1.01    |
| SSD                   | 50.19 ms | 49.82 ms | 1.01    |
| YOLOv4_tiny           | 7.10 ms  | 7.03 ms  | 1.01    |



### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2026-09-16 11:56:51 +03:00
Savya Sanchi Sharma e16382025c Merge pull request #29658 from SavyaSanchi-Sharma:cudnnjit
This PR is about Introducing cuDNN JIT support for the DNN Module

### 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
2026-08-27 09:31:21 +03:00
Savya Sanchi Sharma 4f42b649c0 docs: document the CUDA UMat allocator and T-API constraints 2026-08-21 16:56:38 +05:30
SavyaSanchi-Sharma 4e5f30977b dnn(onnx): cut peak memory of DNNTestNetwork.AlexNet 2026-08-18 20:38:45 +05:30
Savya Sanchi Sharma 5d121b768f Merge pull request #29386 from SavyaSanchi-Sharma:test_debug
fixed Dynamic quantized linear layer error #29386

### 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
2026-06-25 15:44:02 +03:00