MCPcopy Create free account
hub / github.com/MegEngine/MegCC / TEST

Function TEST

compiler/test/kernel/opr/arm_common/benchmark_conv.cpp:7–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#ifdef ENABLE_KERNEL_BENCHMARK
6
7TEST(ARMCOMMON, BenchmarkChannelWiseNCHW4Int8) {
8#ifdef __aarch64__
9 Benchmarker<ConvBiasForward> benchmarker(Arch::ARM64);
10#else
11 Benchmarker<ConvBiasForward> benchmarker(Arch::ARMV7);
12#endif
13 ConvBiasForward::Param param;
14 param.pad_h = 1;
15 param.pad_w = 1;
16 param.compute_mode = ConvBiasForward::Param::ComputeMode::DEFAULT;
17 param.format = ConvBiasForward::Param::Format::NCHW44;
18 param.sparse = ConvBiasForward::Param::Sparse::GROUP;
19 benchmarker.set_dtype(0, dtype::QuantizedS8(2.5f))
20 .set_dtype(1, dtype::QuantizedS8(2.5f))
21 .set_dtype(2, dtype::QuantizedS32(6.25f))
22 .set_dtype(4, dtype::QuantizedS8(40.25f));
23
24 auto run = [&]() {
25 for (size_t k : {3, 5})
26 for (size_t h : {112, 56, 28, 14}) {
27 for (size_t channel : {32, 64}) {
28 auto result = benchmarker.execs(
29 {{1, channel, h, h, 4},
30 {channel, 1, 1, k, k, 4},
31 {1, channel, 1, 1, 4},
32 {},
33 {}});
34 printf("Bench kernel %zu channel=%zu, hxw=%zux%zu\n", k, channel, h,
35 h);
36 result.print();
37 }
38 }
39 };
40
41 param.stride_h = 1;
42 param.stride_w = 1;
43 benchmarker.set_param(param);
44 benchmarker.set_before_exec_callback(
45 megdnn::test::AlgoChecker<ConvBiasForward>("S8_CHAN_WISE_STRD1_NCHW44"));
46 printf("-----------stride: 1-----------\n");
47 run();
48
49 param.stride_h = 2;
50 param.stride_w = 2;
51 benchmarker.set_param(param);
52 benchmarker.set_before_exec_callback(
53 megdnn::test::AlgoChecker<ConvBiasForward>("S8_CHAN_WISE_STRD2_NCHW44"));
54 printf("-----------stride: 2-----------\n");
55 run();
56}
57
58TEST(ARMCOMMON, BenchmarkDirectNCHW4Int8) {
59#ifdef __aarch64__

Callers

nothing calls this directly

Calls 3

runFunction · 0.85
printMethod · 0.80
execsMethod · 0.45

Tested by

no test coverage detected