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

Function TEST

compiler/test/kernel/opr/arm_common/benchmark_pooling.cpp:8–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#ifdef ENABLE_KERNEL_BENCHMARK
7
8TEST(ARMCOMMON, BenchmarkPoolingNchw44Int8) {
9#ifdef __aarch64__
10 Benchmarker<PoolingForward> benchmarker(Arch::ARM64, 0);
11#else
12 Benchmarker<PoolingForward> benchmarker(Arch::ARMV7, 0);
13#endif
14 PoolingForward::Param param;
15 UniformIntRNG rng(-127, 127);
16 benchmarker.set_rng(0, &rng);
17 benchmarker.set_kernel_symbol("ArmCommon_FilterX_modeX_.*");
18 param.format = param::Pooling::Format::NCHW44;
19 auto run = [&](megdnn::DType dtype, std::string dtype_name, Mode mode,
20 std::string mode_name) {
21 for (size_t window : {2, 3, 4, 5})
22 for (size_t stride : {1, 2}) {
23 param.mode = mode;
24 benchmarker.set_dtype(0, dtype).set_dtype(1, dtype);
25 param.pad_h = 1;
26 param.pad_w = 1;
27 param.window_h = window;
28 param.window_w = window;
29 param.stride_h = stride;
30 param.stride_w = stride;
31 benchmarker.set_param(param);
32 printf("Bench hw=112, window= %zu, dtype=%s, mode=%s stride=%zu \n",
33 window, dtype_name.c_str(), mode_name.c_str(), stride);
34 benchmarker.set_before_exec_callback(
35 megdnn::test::AlgoChecker<PoolingForward>(
36 ("ARM_POOLING_FILTER" + std::to_string(window) +
37 "_MODEX_STRIDEX_NCHW44")
38 .c_str()));
39 benchmarker.execs({{1, 1, 112, 112, 4}, {}}).print();
40 }
41 };
42 run(dtype::Int8(), "int8", Mode::MAX, "max");
43 run(dtype::QuantizedS8(1.6f), "qint8", Mode::MAX, "max");
44 run(dtype::QuantizedS8(1.6f), "qint8", Mode::AVERAGE, "avg");
45}
46#endif

Callers

nothing calls this directly

Calls 4

runFunction · 0.85
printMethod · 0.80
to_stringFunction · 0.50
execsMethod · 0.45

Tested by

no test coverage detected