Coverage Report

Created: 2025-12-10 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Simd/src/Simd/SimdAvx512bwSynetConvolution32fNhwcDirect.cpp
Line
Count
Source
1
/*
2
* Simd Library (http://ermig1979.github.io/Simd).
3
*
4
* Copyright (c) 2011-2024 Yermalayeu Ihar.
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
#include "Simd/SimdSynetConvolution32f.h"
25
#include "Simd/SimdAvx512bw.h"
26
#include "Simd/SimdSynet.h"
27
#include "Simd/SimdExp.h"
28
#include "Simd/SimdErf.h"
29
30
namespace Simd
31
{
32
#if defined(SIMD_AVX512BW_ENABLE) && defined(SIMD_SYNET_ENABLE)  
33
    namespace Avx512bw
34
    {
35
        SynetConvolution32fNhwcDirect::SynetConvolution32fNhwcDirect(const ConvParam& p)
36
0
            : Avx2::SynetConvolution32fNhwcDirect(p)
37
0
        {
38
0
            if (p.dstC <= Avx2::F)
39
0
                return;
40
            //_old.enable = true;
41
0
            if (_old.enable)
42
0
            {
43
0
                if (Set2f(p, _old.convolution))
44
0
                    OldSetAlgParam(F);
45
0
            }
46
0
            else
47
0
            {
48
0
                RunFuncs funcs;
49
0
                for (size_t n = 2; n <= 3; ++n)
50
0
                {
51
0
                    funcs.push_back(RunFunc(Ext() + "-" + ToStr(n)));
52
0
                    SetAlgParam(F, n, funcs.back().alg);
53
0
                    if (!SetRt(p, funcs.back().alg))
54
0
                        return;
55
0
                }
56
0
                _run.Init(funcs);
57
0
            }
58
0
        }
59
60
        bool SynetConvolution32fNhwcDirect::SetRt(const ConvParam& p, AlgParam& a)
61
0
        {
62
0
            switch (a.microD)
63
0
            {
64
0
            case 2 * F: return Set2r(p, a);
65
0
            case 3 * F: return Set3r(p, a);
66
0
            default:
67
0
                return false;
68
0
            }
69
0
        }
70
    }
71
#endif
72
}