Commit Graph
2818 Commits
Author SHA1 Message Date
Alexander Smorkalov 7fdaf488e8 Merge pull request #29571 from antonio-rojas:patch-1
Fix Rect dimensions in getChannelFromBlob
2026-08-11 14:25:52 +03:00
Alexander Smorkalov 7e9fc68d21 Merge pull request #29673 from abhishek-gola:lstm_optimization
Optimize LSTM (batched input projection, weight pre-packing, parallel directions)
2026-08-10 15:32:26 +03:00
Abhishek Gola 841e8a7984 Merge pull request #29628 from velonica0/dnn-rvv-hal-depthwise
dnn(rvv): HAL kernel for depthwise convolution (blocked NCHWc)
2026-08-09 21:31:43 +05:30
Abhishek Gola 34600510e4 lstm optimizations 2026-08-06 16:55:09 +05:30
Abhishek Gola dcf26f8ede Merge pull request #29657 from varun-jaiswal17/fix/python-64bit-and-bfloat16-dtype
Add dnn conformance python tests
2026-08-05 18:06:47 +05:30
velonica0 515ad7725a activation is nullptr 2026-08-04 20:27:23 -07:00
velonica0 7253ddaa9b dnn: add HAL replacement hook for depthwise convolution 2026-08-04 19:40:58 -07:00
vrooomy c964008158 remove equal_nan for older npy compatibility U20 2026-08-04 21:21:14 +05:30
Abhishek Gola 2c00686ec7 Merge pull request #29625 from velonica0/dnn-rvv-hal-pooling
RVV HAL kernels for DNN max/average pooling
2026-08-04 20:09:01 +05:30
vrooomy 851ee7046c adding the deny list to python similarly 2026-08-04 14:32:03 +05:30
vrooomy 6e338fb03b extract test list into a separate .py file 2026-08-04 13:46:33 +05:30
vrooomy 5fcdb9b01e code cleanup 2026-08-03 14:41:43 +05:30
vrooomy 25ed5d4c0d map 64bit int anf bfloat16 2026-08-03 12:26:19 +05:30
velonica0 f04ff17028 dnn: fix pooling HAL doc-build warnings (unresolvable ConvState @ref and partial avgpool param docs) 2026-08-02 19:12:51 -07:00
Yang Guanyuhan 143b084be2 dnn: remove redundant ORT test skips 2026-07-31 23:42:48 +08:00
Yang Guanyuhan 7669897910 dnn: preserve Cast semantics after ONNX Mul 2026-07-31 00:21:42 +08:00
vrooomy 4ed880f045 Added dnn conformance test python scripts 2026-07-30 20:07:29 +05:30
Yang Guanyuhan 0e36cafcf4 dnn: preserve Cast semantics after ONNX Gather 2026-07-30 22:22:31 +08:00
Abhishek Gola 0f83d516bf Merge pull request #29630 from varun-jaiswal17/heavy_test_skip
skip test DNNTestNetwork.AlexNet/0 on 32-bit target
2026-07-30 15:02:28 +05:30
velonica0 b907960e0b dnn:rvv: rename pooling HAL hooks to *pool3d and correct the NCDHWc layout comment 2026-07-29 23:17:19 -07:00
velonica0 4d976ffb19 dnn: add HAL replacement hooks for max and average pooling 2026-07-29 23:17:19 -07:00
Abhishek Gola 3ef693c48a warning fix 2026-07-29 21:18:11 +05:30
Varun Jaiswal e0e52c14b1 restrict skip to windows 32 only 2026-07-29 20:38:18 +05:30
Abhishek Gola 34c478016d Adapt merged 5.x Scan helpers to the LayerInfo split
# Ptr<LayerInfo> over body->prog().
 # (matches sibling parseLoop/parseIf).
 # sliceScanAxis/stackScanAxis helpers (definition order only).
2026-07-29 20:32:42 +05:30
Abhishek Gola 58c28e1e82 wrapper-free GpuMatND forward path 2026-07-29 20:23:02 +05:30
Abhishek Gola 059a93339c code refactoring 2026-07-29 20:23:02 +05:30
Abhishek Gola 12fb9a6c24 using gpuMat instead of backend wrappers 2026-07-29 20:23:02 +05:30
Abhishek Gola 7f63fede4c added unsupported tests to denylist 2026-07-29 20:23:02 +05:30
Abhishek Gola e7dc3a9a9b added support check 2026-07-29 20:23:02 +05:30
Abhishek Gola 0843a0bb17 fusion fix 2026-07-29 20:23:02 +05:30
Abhishek Gola 2089d7fdb1 fixed test 2026-07-29 20:19:40 +05:30
Abhishek Gola dd3f3f6d9d build issue fixed 2026-07-29 20:19:40 +05:30
Abhishek Gola c48e3f7f3e changed OpData to LayerInfo 2026-07-29 20:19:40 +05:30
Abhishek Gola bc5c1b4da8 bug fix 2026-07-29 20:17:42 +05:30
Abhishek Gola cab931296f cleanup 2026-07-29 20:17:42 +05:30
Abhishek Gola 72ffdfc170 cuda support and Layer Split + per-op executors 2026-07-29 20:17:42 +05:30
Varun Jaiswal 204725ea18 skip AlexNet on 32-bit target 2026-07-29 18:15:37 +05:30
Abhishek Gola a5e4c04903 Merge pull request #29341 from abhishek-gola/disable_engine_classic
Remove ENGINE CLASSIC, switching to ENGINE NEW as default engine
2026-07-29 13:00:29 +05:30
Abhishek Gola 62732ab966 Merge pull request #29524 from abhishek-gola/onnx_coverage
Fix: 0-D / empty-Mat Python binding
2026-07-28 22:14:50 +05:30
Abhishek Gola 51f7547bf1 refactoring 2026-07-28 20:27:29 +05:30
Abhishek Gola 57bcf14e78 moved to engine_opencv 2026-07-28 20:27:29 +05:30
Abhishek Gola c2e0e4edb9 removed engine classic related elements 2026-07-28 20:27:29 +05:30
Abhishek Gola 940810b589 java warning fix 2026-07-28 20:27:29 +05:30
Abhishek Gola 0bc2636564 fixed single output 2026-07-28 20:27:29 +05:30
Abhishek Gola 2c67582020 slope fix 2026-07-28 20:27:29 +05:30
Abhishek Gola ad8056f9b0 Support named output subset 2026-07-28 20:27:29 +05:30
Abhishek Gola 46331314a5 removed classic engine 2026-07-28 20:27:29 +05:30
Abhishek Gola 49b8f7c03f engine classic removed 2026-07-28 20:27:29 +05:30
Alexander Smorkalov 4ba2752f36 Merge pull request #29601 from Teddy-Yangjiale:rvv-fast-attn
dnn: enable the existing SIMD attention-softmax on scalable RVV
2026-07-26 12:06:45 +03:00
velonica0 18b39f1f34 RVV: switch scalable universal intrinsics from LMUL=2 to LMUL=1 (#29493)
* dnn:rvv: restore the fixed block size C0 == 8

#29304 made the net-wide block size follow the RVV vector width
(defaultC0 = max(8, vlanes())), so the blocked memory layout of every tensor
depended on the host's VLEN and on the LMUL of the universal intrinsics in core.
The same model gets a different layout on a 128-, 256- or 1024-bit machine.

Restore the fixed default of 8, which is the mainstream, well-tested setting on
every platform. C0/K0 become compile-time constants again on RVV as they already
were elsewhere, so the runtime block-size plumbing and the vlanes()-based scratch
sizing are dropped, and getConvFunc_ no longer advertises block sizes the kernels
cannot handle.

The blocked kernels currently require C0 == vlanes(), which this alone does not
satisfy; the next commit removes that requirement.

* dnn:rvv: pin the vector length to the channel block

The blocked kernels assumed one channel block is exactly one vector
(C0 == vlanes()). That is not a property of the layout, it is a property of the
hardware, so the kernels only worked where the two happened to coincide: with
C0 fixed at 8 they break wherever vlanes() != 8 -- under-filling the block when
the vector is narrower (silently leaving output channels unwritten) and
overrunning it when the vector is wider (CV_Assert).

The universal intrinsics cannot express this: v_float32 is always vlanes() wide
and there is no way to make it span exactly C0 elements. So the RVV paths drop to
native intrinsics and set the vector length explicitly:

    const size_t _vl = __riscv_vsetvl_e32m2(C0);   // == 8 on every VLEN >= 128

LMUL=2 is required, not incidental: vlmax(e32,m2) = VLEN/32*2 >= 8 even at
VLEN=128, the narrowest RVV configuration, so _vl == C0 on every RVV 1.0 core.
One vector then spans precisely one channel block regardless of VLEN, and the
C0-vs-vlanes asserts and VLEN-dependent branches are removed rather than extended.
The existing int8 kernels already choose LMUL=2 for the same reason
(conv2_int8_kernels.simd.hpp).

This is a native per-kernel choice and is independent of the LMUL the universal
intrinsics are built with; dnn no longer reads the vector width of
intrin_rvv_scalable.hpp at all.

conv, deconv, maxpool, avgpool and depthwise use native intrinsics. batch_norm
stays portable and instead replicates the C0-wide coefficient pattern across the
vector, which keeps full lane utilisation where a fixed vl would idle most of it.
The x86/ARM paths are restored to their pre-#29304 form and are unchanged.

Tested on SpaceMIT K3 (X100 VLEN=256, A100 VLEN=1024), opencv_test_dnn: no
regressions against upstream on either core.

* core:rvv: switch scalable universal intrinsics from LMUL=2 to LMUL=1

Move the RVV universal-intrinsic types (v_uint8..v_float64) from m2 (paired
registers, 16 usable) to m1 (individual registers, 32 usable) per #29454, to
relieve register pressure in the complex kernels that rely on universal
intrinsics. Simple kernels that regress can take native RVV branches; the complex
ones cannot, so the default should suit them.

Only intrin_rvv_scalable.hpp changes. The widening/narrowing cascades and
max_nlanes are adjusted, and helpers that spell an LMUL into the intrinsic name
shift down one step (m2->m1, m1->mf2): v_popcount, v_lut (vector and f64 paths),
the f64 dot-product reduction (#27003), v_matmul, and the byte-indexed v_lut
added by #29250, whose __riscv_vluxei8_v_u8m2 no longer matches the m1 base type.

VLEN=1024 needs no change: under m1, max_nlanes = CV_RVV_MAX_VLEN/SZ equals
vlanes() at 1024, and CV_RVV_MAX_VLEN already defaults to 1024. Verified on a
1024-bit core.

Tested on SpaceMIT K3, which exposes both a 256-bit (X100) and a 1024-bit (A100)
core. opencv_test_core: 5605/5612, the 7 failures (filestorage_base64, globbing)
non-SIMD and failing identically on the m2 baseline. Perf (x-factor = m2/m1,
>1 = m1 faster), median >= 300us: core 0.966 -> 0.996 and imgproc 0.950 -> 1.038
as VLEN goes 256 -> 1024, i.e. m2's width advantage disappears once both are wide
while m1's register headroom persists. m1 wins resize (1.50/1.41), Exp (1.28),
gaussianBlur (1.23), norm (1.22), scharr (1.20); m2 still wins the light
memory-streaming kernels addWeighted (0.76), compare (0.82) and dot (0.87), which
are the natural candidates for native RVV branches.

* Revert "dnn:rvv: pin the vector length to the channel block"

This reverts commit 40587c6dd9.

* dnn:rvv: disable CV_SIMD_SCALABLE in the new-engine conv kernel

Under the m1 switch the RVV conv kernel breaks at VLEN=128: it assumes
K0 == vlanes(), but m1 makes vlanes()=4 while the block stays C0=K0=8, so it
computes only half of each output block. Temporarily disable the RVV
(CV_SIMD_SCALABLE) branches so conv runs scalar on RVV, exactly as #29180 did for
the other new-engine layers. The vectorized path will be restored in a follow-up.

Only conv is affected: maxpool/avgpool/depthwise/deconv/batch_norm already handle
C0 == 2*vlanes (the SSE/NEON case) and stay on their universal-intrinsic paths.

* dnn:rvv: document the supported VLEN range and the v_setvlmax follow-up

With the fixed C0=8 the RVV blocked kernels cover VLEN=128 and 256 (C0 >= vlanes);
VLEN>=512 (C0 < vlanes) is not yet handled. Add TODO notes recording this and
pointing at the planned fix: a portable v_setvlmax<VT>(n) universal intrinsic that
caps the vector to the block (no-op on fixed-width ISAs, sets the vl/mask on
RVV/SVE), with an optimized multi-pixel variant as a later step, possibly an RVV
HAL for the new dnn engine. See the #29493 discussion.

* dnn:rvv: disable CV_SIMD_SCALABLE in max/avg pooling and depthwise

These three blocked kernels assert (C0 == nlanes || ...) at VLEN>=512, where the
fixed C0=8 is narrower than the vector register — breaking whole networks
(AlexNet/ResNet/YOLO) on wide RVV cores, though CI (VLEN=128) is unaffected.
Disable their RVV (CV_SIMD_SCALABLE) paths so they run scalar on RVV at every
VLEN, matching #29180's scope. Verified on a SpaceMIT K3: this removes the 92
VLEN=1024 assert failures, with no change at VLEN=128/256.

deconv and batch_norm are left enabled: they degrade to scalar at VLEN>=512
(deconv's C0 % vlanes guard, batch_norm's vector-loop bound) without asserting,
so they stay correct and keep their 128/256 vectorization. All of these
re-vectorize uniformly via the v_setvlmax<VT>(n) follow-up.
2026-07-26 02:31:52 +03:00