|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477 |
- /**
- * \file dnn/test/cuda/conv_bias.cpp
- * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
- *
- * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- */
- #include "megdnn/dtype.h"
- #include "test/cuda/fixture.h"
-
- #include "megdnn/opr_param_defs.h"
- #include "megdnn/oprs.h"
- #include "src/cuda/handle.h"
- #include "test/common/benchmarker.h"
- #include "test/common/checker.h"
- #include "test/common/conv_bias.h"
- #include "test/common/rng.h"
- #include "test/common/tensor.h"
- #include "test/common/workspace_wrapper.h"
- #include "test/cuda/utils.h"
-
- using namespace megdnn;
- using namespace test;
- using namespace conv_bias;
-
- namespace {
- #if CUDA_VERSION >= 10000
- void test_conv_bias_forward_wmma_int4_nchw8(Handle* handle_cuda, size_t fh) {
- require_compute_capability(7, 5);
- using namespace conv_bias;
- Checker<ConvBiasForward> checker(handle_cuda);
-
- UniformIntRNG int_rng{0, 8};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW8;
-
- using NonlineMode = ConvBias::Param::NonlineMode;
- for (NonlineMode mode : {NonlineMode::RELU}) {
- for (size_t batch : {1}) {
- for (size_t ic : {128, 32}) {
- for (size_t oc : {32}) {
- for (int ph : {static_cast<int>(fh / 2), 0}) {
- for (size_t ih : {8, 9, 13, 15, 16}) {
- for (size_t iw : {8, 16, 24, 32, 40}) {
- param.nonlineMode = mode;
- param.stride_h = param.stride_w = 1;
- param.pad_h = param.pad_w = ph;
- checker.set_dtype(
- 0, dtype::Quantized4Asymm(
- 1.3f, (uint8_t)(1)))
- .set_dtype(
- 1, dtype::Quantized4Asymm(
- 1.3f, (uint8_t)(2)))
- .set_dtype(2, dtype::QuantizedS32(1.3f * 1.3f))
- .set_dtype(4, dtype::QuantizedS32(1.3f * 1.3f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param);
- if (!ph)
- iw += 2 * (fh / 2);
- size_t oh = infer_conv_shape(ih, fh, 1, ph);
- size_t ow = infer_conv_shape(iw, fh, 1, ph);
- if (ow % 8 != 0)
- continue;
- checker.execs(
- {{batch, ic / 8, ih, iw, 8},
- {oc, ic / 8, fh, fh, 8},
- {1, oc / 8, 1, 1, 8},
- {},
- {}});
- checker.execs(
- {{batch, ic / 8, ih, iw, 8},
- {oc, ic / 8, fh, fh, 8},
- {batch, oc / 8, oh, ow, 8},
- {},
- {}});
- }
- }
- }
- }
- }
- }
- }
- }
- #endif
- } // namespace
-
- #if CUDNN_VERSION >= 7400
- TEST_F(CUDA, CONV_BIAS_FORWARD_F32) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- NormalRNG default_rng;
- for (auto&& arg : args) {
- checker.set_dtype(0, dtype::Float32())
- .set_dtype(1, dtype::Float32())
- .set_dtype(2, dtype::Float32())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(1e-3)
- .set_param(arg.param)
- .execs({arg.src, arg.filter, arg.bias, {}, {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_BF16) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- checker.set_before_exec_callback(AlgoChecker<ConvBiasForward>(
- ExecutionPolicyAlgoName{"CONVBIAS_BFLOAT16", {{"MATMUL", {}}}}));
- NormalRNG default_rng;
- for (auto&& arg : args) {
- arg.param.compute_mode = param::Convolution::ComputeMode::FLOAT32;
- checker.set_dtype(0, dtype::BFloat16())
- .set_dtype(1, dtype::BFloat16())
- .set_dtype(2, dtype::BFloat16())
- .set_dtype(3, dtype::BFloat16())
- .set_dtype(4, dtype::BFloat16())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(2e-2)
- .set_param(arg.param)
- .execs({arg.src, arg.filter, arg.bias, {}, {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_QS8) {
- require_compute_capability(6, 1);
-
- UniformIntRNG int_rng{-50, 50};
- Checker<ConvBiasForward> checker(handle_cuda());
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NHWC;
- param.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
- {
- auto src_shape = TensorShape{20, 224, 224, 4};
- auto filter_shape = TensorShape{24, 1, 1, 4};
- auto bias_shape = TensorShape{1, 1, 1, 24};
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(60.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(40.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- }
- {
- auto src_shape = TensorShape{20, 224, 224, 4};
- auto filter_shape = TensorShape{24, 1, 1, 4};
- auto bias_shape = TensorShape{1, 1, 1, 24};
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(60.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(40.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- }
-
- {
- param.sparse = ConvBias::Param::Sparse::GROUP;
- auto src_shape = TensorShape{20, 224, 224, 16};
- auto filter_shape = TensorShape{4, 4, 1, 1, 4};
- auto bias_shape = TensorShape{1, 1, 1, 16};
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(60.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(40.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_param(param)
- .execs({src_shape, filter_shape, bias_shape, {}, {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_FLOAT16) {
- require_compute_capability(6, 1);
-
- Checker<ConvBiasForward> checker(handle_cuda());
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NHWC;
- param.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
-
- checker.set_epsilon(2e-2)
- .set_dtype(0, dtype::Float16())
- .set_dtype(1, dtype::Float16())
- .set_dtype(2, dtype::Float16())
- .set_dtype(3, dtype::Float16())
- .set_dtype(4, dtype::Float16());
- {
- auto src_shape = TensorShape{20, 224, 224, 4};
- auto filter_shape = TensorShape{24, 1, 1, 4};
- auto bias_shape = TensorShape{1, 1, 1, 24};
- checker.set_param(param).execs({src_shape, filter_shape, bias_shape, {}, {}});
- param.compute_mode = ConvBias::Param::ComputeMode::FLOAT32;
- checker.set_param(param).execs({src_shape, filter_shape, bias_shape, {}, {}});
- }
-
- {
- param.sparse = ConvBias::Param::Sparse::GROUP;
- auto src_shape = TensorShape{20, 224, 224, 16};
- auto filter_shape = TensorShape{4, 4, 1, 1, 4};
- auto bias_shape = TensorShape{1, 1, 1, 16};
- checker.set_param(param).execs({src_shape, filter_shape, bias_shape, {}, {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_NCHW_QS8) {
- //! not support NonlineMode::SIGMOID and NonlineMode::H_SWISH
- require_compute_capability(6, 1);
- Checker<ConvBiasForward> checker(handle_cuda());
- UniformIntRNG int_rng{-128, 127};
- using NonlineMode = ConvBias::Param::NonlineMode;
-
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW;
-
- checker.set_dtype(0, dtype::QuantizedS8(1.f))
- .set_dtype(1, dtype::QuantizedS8(1.f))
- .set_dtype(2, dtype::QuantizedS32(1.f))
- .set_dtype(3, dtype::QuantizedS8(1.f))
- .set_dtype(4, dtype::QuantizedS8(1.f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_rng(3, &int_rng);
-
- for (NonlineMode mode :
- {NonlineMode::RELU, NonlineMode::IDENTITY, NonlineMode::H_SWISH}) {
- for (size_t g : {1, 2}) {
- for (size_t b : {2}) {
- for (size_t ic : {6, 16}) {
- for (size_t oc : {4}) {
- for (size_t fh : {1, 3}) {
- for (int ph : {static_cast<int>(fh / 2)}) {
- for (int sh : {1, 2}) {
- size_t ih = 16, iw = 16;
- param.nonlineMode = mode;
- param.stride_h = param.stride_w = sh;
- param.pad_h = param.pad_w = ph;
- param.sparse = ConvBias::Param::Sparse::DENSE;
- checker.set_param(param).execs(
- {{b, ic / 2, ih, iw},
- {oc, ic / 2, fh, fh},
- {1, oc, 1, 1},
- {},
- {}});
- param.sparse = ConvBias::Param::Sparse::GROUP;
- checker.set_param(param).execs(
- {{b, ic, ih, iw},
- {g, oc / g, ic / g, fh, fh},
- {1, oc, 1, 1},
- {},
- {}});
- }
- }
- }
- }
- }
- }
- }
- }
-
- for (NonlineMode mode :
- {NonlineMode::RELU, NonlineMode::IDENTITY, NonlineMode::H_SWISH}) {
- for (size_t g : {13}) {
- for (size_t b : {1, 2}) {
- for (size_t ic : {13}) {
- for (size_t oc : {13}) {
- for (size_t fh : {1, 3}) {
- for (int ph : {static_cast<int>(fh / 2)}) {
- for (int sh : {1, 2}) {
- size_t ih = 16, iw = 16;
- param.nonlineMode = mode;
- param.stride_h = param.stride_w = sh;
- param.pad_h = param.pad_w = ph;
- param.sparse = ConvBias::Param::Sparse::GROUP;
- checker.set_param(param).execs(
- {{b, ic, ih, iw},
- {g, oc / g, ic / g, fh, fh},
- {1, oc, 1, 1},
- {},
- {}});
- }
- }
- }
- }
- }
- }
- }
- }
- {
- size_t ih = 16, iw = 16, b = 1, oc = 14, ic = 14;
- size_t fh = 3, sh = 1, ph = 1;
- param.nonlineMode = NonlineMode::IDENTITY;
- param.stride_h = param.stride_w = sh;
- param.pad_h = param.pad_w = ph;
- param.sparse = ConvBias::Param::Sparse::DENSE;
- checker.set_param(param).execs({{b, ic, ih, iw}, {oc, ic, fh, fh}, {}, {}, {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_NCHW_QS8_FUSE_Z) {
- require_compute_capability(6, 1);
- Checker<ConvBiasForward> checker(handle_cuda());
- UniformIntRNG int_rng{-128, 127};
- using NonlineMode = ConvBias::Param::NonlineMode;
-
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW;
-
- checker.set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(3, dtype::QuantizedS8(0.25f))
- .set_dtype(4, dtype::QuantizedS8(0.25f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_rng(3, &int_rng);
-
- for (NonlineMode mode :
- {NonlineMode::RELU, NonlineMode::IDENTITY, NonlineMode::H_SWISH}) {
- for (size_t b : {2}) {
- for (size_t ic : {6, 16}) {
- for (size_t oc : {4}) {
- for (size_t fh : {1, 3}) {
- for (int ph : {static_cast<int>(fh / 2)}) {
- for (int sh : {1, 2}) {
- size_t ih = 16, iw = 16;
- param.nonlineMode = mode;
- param.stride_h = param.stride_w = sh;
- param.pad_h = param.pad_w = ph;
- param.sparse = ConvBias::Param::Sparse::DENSE;
- const size_t oh = (ih - fh + 2 * ph) / sh + 1;
- const size_t ow = (iw - fh + 2 * ph) / sh + 1;
- checker.set_param(param).execs(
- {{b, ic, ih, iw},
- {oc, ic, fh, fh},
- {1, oc, 1, 1},
- {b, oc, oh, ow},
- {}});
- }
- }
- }
- }
- }
- }
- }
- }
-
- #if MEGDNN_WITH_BENCHMARK
- TEST_F(CUDA, BENCHMARK_CONV_BIAS_NCHW4_INT8) {
- require_compute_capability(6, 1);
- Benchmarker<ConvBiasForward> bencher(handle_cuda());
- bencher.set_display(false);
- ConvBias::Param param_nchw;
- param_nchw.format = ConvBias::Param::Format::NCHW;
- ConvBias::Param param_nchw4;
- param_nchw4.format = ConvBias::Param::Format::NCHW4;
-
- auto i8_min = std::numeric_limits<int8_t>().min();
- auto i8_max = std::numeric_limits<int8_t>().max();
- UniformIntRNG int_rng{i8_min, i8_max};
-
- param_nchw.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
- auto run_bench = [&](size_t b, size_t ci, size_t hi, size_t wi, size_t co,
- size_t fh, size_t fw, size_t sh, size_t sw, size_t nr_times) {
- param_nchw.pad_h = fh / 2;
- param_nchw.pad_w = fw / 2;
- param_nchw.stride_h = sh;
- param_nchw.stride_w = sw;
- param_nchw4.pad_h = fh / 2;
- param_nchw4.pad_w = fh / 2;
- param_nchw4.stride_h = sh;
- param_nchw4.stride_w = sw;
- bencher.set_times(nr_times)
- .set_dtype(0, dtype::QuantizedS8(2.5f))
- .set_dtype(1, dtype::QuantizedS8(2.5f))
- .set_dtype(2, dtype::QuantizedS32(6.25f))
- .set_dtype(4, dtype::QuantizedS8(0.35f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng);
- bencher.set_param(param_nchw);
- size_t ho = infer_conv_shape(hi, fh, sh, param_nchw.pad_h);
- size_t wo = infer_conv_shape(wi, fw, sw, param_nchw.pad_w);
- TensorShape inp{b, ci, hi, wi}, kern{co, ci, fh, fw}, out{b, co, ho, wo};
- auto time_in_ms = bencher.execs({inp, kern, {1, co, 1, 1}, {}, out}) / nr_times;
- auto ops_nchw =
- 2.0 * b * co * ho * wo * ci * fh * fw / (time_in_ms * 1e-3) * 1e-12;
- printf("inp=%s, kern=%s, out=%s, time: %.2fms, perf: %.2f Tops "
- "(NCHW)\n",
- inp.to_string().c_str(), kern.to_string().c_str(),
- out.to_string().c_str(), time_in_ms, ops_nchw);
- bencher.set_param(param_nchw4);
- decltype(ops_nchw) ops_nchw4;
- {
- TensorShape inp{b, ci / 4, hi, wi, 4}, kern{co, ci / 4, fh, fw, 4},
- out{b, co / 4, ho, wo, 4};
- auto time_in_ms =
- bencher.execs({inp, kern, {1, co / 4, 1, 1, 4}, {}, out}) /
- nr_times;
- ops_nchw4 =
- 2.0 * b * co * ho * wo * ci * fh * fw / (time_in_ms * 1e-3) * 1e-12;
- printf("inp=%s, kern=%s, out=%s, time: %.2fms, perf: %.2f Tops "
- "(NCHW4)\n",
- inp.to_string().c_str(), kern.to_string().c_str(),
- out.to_string().c_str(), time_in_ms, ops_nchw4);
- }
- printf("speedup: %.2fx\n", ops_nchw4 / ops_nchw);
- };
- // resnet-50
- // bottleneck-1
- // proj
- run_bench(1, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
-
- // bottleneck-2
- // proj
- run_bench(1, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(1, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(1, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(1, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
-
- // bottleneck-3
- // proj
- run_bench(1, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(1, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(1, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(1, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
-
- // bottleneck-4
- // proj
- run_bench(1, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(1, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(1, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(1, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
-
- run_bench(32, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(32, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(32, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(32, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(32, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
- run_bench(32, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(32, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(32, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(32, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
- run_bench(32, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(32, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(32, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(32, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
-
- run_bench(256, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(256, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(256, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(256, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(256, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
- run_bench(256, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(256, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(256, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(256, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
- run_bench(256, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(256, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(256, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(256, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
- }
- #endif
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_NCHW4) {
- require_compute_capability(6, 1);
- using namespace conv_bias;
- Checker<ConvBiasForward> checker(handle_cuda());
- UniformIntRNG int_rng{-5, 5};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW4;
- param.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
-
- checker.set_dtype(0, dtype::QuantizedS8(0.5f))
- .set_dtype(1, dtype::QuantizedS8(0.5f))
- .set_dtype(2, dtype::QuantizedS32(0.25f))
- .set_dtype(3, dtype::QuantizedS8(0.13f))
- .set_dtype(4, dtype::QuantizedS8(0.35f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_rng(3, &int_rng)
- .set_param(param);
-
- auto opr = handle_cuda()->create_operator<ConvBias>();
-
- auto run = [&](const TensorShapeArray& shapes) {
- opr->param() = param;
- TensorLayout dst_layout;
- opr->deduce_layout(
- {shapes[0], dtype::Float32()}, {shapes[1], dtype::Float32()}, {}, {},
- dst_layout);
- checker.execs({shapes[0], shapes[1], shapes[2], dst_layout, {}});
- };
-
- run({{1, 4, 4, 4, 4}, {4, 4, 3, 3, 4}, {1, 1, 1, 1, 4}});
- run({{1, 4, 4, 4, 4}, {260, 4, 3, 3, 4}, {1, 65, 1, 1, 4}});
- run({{20, 1, 24, 24, 4}, {24, 1, 2, 2, 4}, {1, 6, 1, 1, 4}});
- run({{20, 2, 24, 24, 4}, {24, 2, 3, 3, 4}, {1, 6, 1, 1, 4}});
-
- param.sparse = ConvBias::Param::Sparse::GROUP;
- checker.set_param(param);
- run({{1, 4, 24, 24, 4}, {4, 4, 1, 1, 1, 4}, {1, 4, 1, 1, 4}});
- run({{20, 8, 24, 24, 4}, {4, 24, 2, 2, 2, 4}, {1, 24, 1, 1, 4}});
- run({{1, 3, 24, 24, 4}, {3, 8, 1, 3, 3, 4}, {1, 6, 1, 1, 4}});
-
- param.pad_h = param.pad_w = 1;
- param.stride_h = param.stride_w = 2;
- checker.set_param(param);
- run({{10, 16, 28, 28, 4}, {8, 8, 2, 3, 3, 4}, {1, 16, 1, 1, 4}});
-
- // case which cudnn not supported
- param.sparse = ConvBias::Param::Sparse::DENSE;
- param.pad_h = param.pad_w = 1;
- param.stride_h = param.stride_w = 1;
- checker.set_param(param);
- checker.exec({{1, 4, 2, 2, 4}, {16, 4, 3, 3, 4}, {1, 4, 1, 1, 4}, {}, {}});
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_NCHW4_NCHW) {
- require_compute_capability(6, 1);
- using namespace conv_bias;
- Checker<ConvBiasForward> checker(handle_cuda());
- UniformIntRNG int_rng{-3, 3};
- UniformFloatRNG float_rng{-50, 50};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW4_NCHW;
- param.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
-
- checker.set_dtype(0, dtype::QuantizedS8(1.9980618f))
- .set_dtype(1, dtype::QuantizedS8(1.9980927f))
- .set_dtype(2, dtype::Float32())
- .set_dtype(3, dtype::Float32())
- .set_dtype(4, dtype::Float32())
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &float_rng)
- .set_rng(3, &float_rng)
- .set_param(param);
-
- auto opr = handle_cuda()->create_operator<ConvBias>();
-
- auto run = [&](const TensorShapeArray& shapes) {
- opr->param() = param;
- TensorLayout dst_layout;
- opr->deduce_layout(
- {shapes[0], dtype::Float32()}, {shapes[1], dtype::Float32()}, {}, {},
- dst_layout);
- checker.execs({shapes[0], shapes[1], shapes[2], dst_layout, {}});
- };
-
- run({{1, 4, 4, 4, 4}, {4, 4, 3, 3, 4}, {1, 4, 1, 1}});
- run({{20, 1, 24, 24, 4}, {24, 1, 2, 2, 4}, {1, 24, 1, 1}});
- run({{20, 2, 24, 24, 4}, {24, 2, 3, 3, 4}, {1, 24, 1, 1}});
-
- param.sparse = ConvBias::Param::Sparse::GROUP;
- param.nonlineMode = ConvBias::Param::NonlineMode::RELU;
- checker.set_param(param);
- run({{1, 4, 24, 24, 4}, {4, 4, 1, 1, 1, 4}, {1, 16, 1, 1}});
- run({{20, 8, 24, 24, 4}, {4, 24, 2, 2, 2, 4}, {1, 96, 1, 1}});
- run({{1, 3, 24, 24, 4}, {3, 8, 1, 3, 3, 4}, {1, 24, 1, 1}});
-
- param.pad_h = param.pad_w = 1;
- param.stride_h = param.stride_w = 2;
- checker.set_param(param);
- run({{10, 16, 28, 28, 4}, {8, 8, 2, 3, 3, 4}, {1, 64, 1, 1}});
-
- // case which cudnn not supported
- param.sparse = ConvBias::Param::Sparse::DENSE;
- param.pad_h = param.pad_w = 1;
- param.stride_h = param.stride_w = 1;
- param.nonlineMode = ConvBias::Param::NonlineMode::H_SWISH;
- checker.set_param(param);
- checker.exec({{1, 4, 2, 2, 4}, {16, 4, 3, 3, 4}, {1, 16, 1, 1}, {}, {}});
- }
- #endif
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_CHANWISE) {
- Checker<ConvBiasForward> checker(handle_cuda());
- std::vector<TestArg> args = get_chanwise_args();
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::DirectParam>("CHANNEL_WISE", {})
- .c_str()));
-
- for (auto dtype : std::vector<DType>{dtype::Float32(), dtype::Float16()}) {
- checker.set_dtype(0, dtype)
- .set_dtype(1, dtype)
- .set_dtype(2, dtype)
- .set_dtype(3, dtype)
- .set_dtype(4, dtype);
- if (dtype.enumv() == DTypeEnum::Float16)
- checker.set_epsilon(2e-2);
- for (auto&& arg : args) {
- checker.set_param(arg.param).execs({arg.src, arg.filter, arg.bias, {}, {}});
- }
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_CHANWISE_SMALL) {
- Checker<ConvBiasForward> checker(handle_cuda());
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::DirectParam>("CHANNEL_WISE_SMALL", {})
- .c_str()));
- param::ConvBias cur_param;
- using NLMode = param::ConvBias::NonlineMode;
- cur_param.mode = param::ConvBias::Mode::CROSS_CORRELATION;
- cur_param.sparse = ConvBias::Param::Sparse::GROUP;
-
- for (auto nlmode :
- {NLMode::IDENTITY, NLMode::RELU, NLMode::SIGMOID, NLMode::H_SWISH}) {
- cur_param.nonlineMode = nlmode;
- for (auto dtype : std::vector<DType> {
- dtype::Float32(),
- #if CUDA_VERSION >= 9000
- dtype::Float16()
- #endif
- }) {
- checker.set_dtype(0, dtype)
- .set_dtype(1, dtype)
- .set_dtype(2, dtype)
- .set_dtype(3, dtype)
- .set_dtype(4, dtype);
- if (dtype.enumv() == DTypeEnum::Float16)
- checker.set_epsilon(2e-2);
-
- for (uint32_t s : {1}) {
- for (uint32_t f : {1, 3, 5, 7}) {
- cur_param.pad_h = cur_param.pad_w = f / 2;
- cur_param.stride_h = cur_param.stride_w = s;
- checker.set_param(cur_param).execs(
- {{2, 3, 16, 16}, {3, 1, 1, f, f}, {1, 3, 1, 1}, {}, {}});
- }
- }
-
- cur_param.pad_h = cur_param.pad_w = 1;
- cur_param.stride_h = cur_param.stride_w = 1;
- checker.set_param(cur_param)
- .execs({{2, 3, 3, 16}, {3, 1, 1, 3, 3}, {1, 3, 1, 1}, {}, {}})
- .execs({{2, 3, 8, 3}, {3, 1, 1, 3, 3}, {1, 3, 1, 1}, {}, {}});
- }
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_CHANWISE_8x8x32) {
- require_compute_capability(6, 1);
- Checker<ConvBiasForward> checker(handle_cuda());
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::DirectParam>("CHANNEL_WISE_8X8X32", {})
- .c_str()));
- param::ConvBias cur_param;
- using NLMode = param::ConvBias::NonlineMode;
- cur_param.mode = param::ConvBias::Mode::CROSS_CORRELATION;
- cur_param.sparse = ConvBias::Param::Sparse::GROUP;
- cur_param.format = ConvBias::Param::Format::NHWC;
-
- UniformIntRNG rng(-4, 4);
- checker.set_dtype(0, dtype::Int8{})
- .set_dtype(1, dtype::Int8{})
- .set_dtype(2, dtype::Int32{})
- .set_dtype(4, dtype::Int32{})
- .set_rng(0, &rng)
- .set_rng(1, &rng)
- .set_rng(2, &rng);
- for (auto nlmode : {NLMode::IDENTITY, NLMode::RELU}) {
- cur_param.nonlineMode = nlmode;
- for (uint32_t s : {1, 2}) {
- for (uint32_t f : {1, 3, 5, 7}) {
- for (uint32_t g : {4, 8}) {
- cur_param.pad_h = cur_param.pad_w = f / 2;
- cur_param.stride_h = cur_param.stride_w = s;
- checker.set_param(cur_param).execs(
- {{2, 9, 16, g}, {g, 1, f, f, 1}, {1, 1, 1, g}, {}, {}});
- }
- }
- }
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_CUDNN_CONVOLUTION) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::DefaultParam>("CUDNN:Convolution", {})
- .c_str()));
-
- NormalRNG default_rng;
- for (auto&& arg : args) {
- checker.set_dtype(0, dtype::Float32())
- .set_dtype(1, dtype::Float32())
- .set_dtype(2, dtype::Float32())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(1e-3)
- .set_param(arg.param)
- .execs({arg.src, arg.filter, arg.bias, {}, {}});
- }
- //! noncontiguous case
- {
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- {{16, 16, 3, 3}, {144, 9, 3, 1}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_INPLACE_MATMUL) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::MatmulParam>("INPLACE_MATMUL", {})
- .c_str()));
- param::ConvBias cur_param;
- using NLMode = param::ConvBias::NonlineMode;
- cur_param.mode = param::ConvBias::Mode::CROSS_CORRELATION;
- cur_param.sparse = ConvBias::Param::Sparse::DENSE;
- NormalRNG default_rng;
- checker.set_dtype(0, dtype::Float32())
- .set_dtype(1, dtype::Float32())
- .set_dtype(2, dtype::Float32())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(1e-3);
-
- for (auto nlmode :
- {NLMode::IDENTITY, NLMode::RELU, NLMode::SIGMOID, NLMode::H_SWISH}) {
- cur_param.nonlineMode = nlmode;
- for (uint32_t s : {1}) {
- for (uint32_t f : {1, 3, 5, 7}) {
- cur_param.pad_h = cur_param.pad_w = f / 2;
- cur_param.stride_h = cur_param.stride_w = s;
- checker.set_param(cur_param).execs(
- {{2, 4, 16, 16}, {4, 4, f, f}, {1, 4, 1, 1}, {}, {}});
- }
- }
-
- cur_param.pad_h = cur_param.pad_w = 1;
- cur_param.stride_h = cur_param.stride_w = 1;
- checker.set_param(cur_param)
- .execs({{2, 3, 3, 16}, {5, 3, 3, 3}, {1, 5, 1, 1}, {}, {}})
- .execs({{2, 2, 8, 3}, {3, 2, 3, 3}, {1, 3, 1, 1}, {}, {}});
- }
- //! noncontiguous case
- {
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- {{16, 16, 3, 3}, {144, 9, 3, 1}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_MATMUL) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- checker.set_before_exec_callback(
- AlgoChecker<ConvBiasForward>(ExecutionPolicyAlgoName{
- ConvBiasForward::algo_name<ConvBiasForward::MatmulParam>(
- "MATMUL", {})
- .c_str(),
- {{"CUBLAS", {}}}}));
- param::ConvBias cur_param;
- using NLMode = param::ConvBias::NonlineMode;
- cur_param.mode = param::ConvBias::Mode::CROSS_CORRELATION;
- cur_param.sparse = ConvBias::Param::Sparse::DENSE;
- NormalRNG default_rng;
- checker.set_dtype(0, dtype::Float32())
- .set_dtype(1, dtype::Float32())
- .set_dtype(2, dtype::Float32())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(1e-3);
-
- for (auto nlmode :
- {NLMode::IDENTITY, NLMode::RELU, NLMode::SIGMOID, NLMode::H_SWISH}) {
- cur_param.nonlineMode = nlmode;
- for (uint32_t s : {1}) {
- for (uint32_t f : {1, 3, 5, 7}) {
- cur_param.pad_h = cur_param.pad_w = f / 2;
- cur_param.stride_h = cur_param.stride_w = s;
- checker.set_param(cur_param).execs(
- {{2, 4, 16, 16}, {4, 4, f, f}, {1, 4, 1, 1}, {}, {}});
- }
- }
-
- cur_param.pad_h = cur_param.pad_w = 0;
- cur_param.stride_h = cur_param.stride_w = 1;
- checker.set_param(cur_param)
- .execs({{2, 3, 3, 16}, {5, 3, 3, 3}, {1, 5, 1, 1}, {}, {}})
- .execs({{2, 2, 8, 3}, {3, 2, 3, 3}, {1, 3, 1, 1}, {}, {}});
- }
- //! noncontiguous case
- {
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- {{16, 16, 3, 3}, {144, 9, 3, 1}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_MATMUL_8x8x32) {
- require_compute_capability(6, 1);
- Checker<ConvBiasForward> checker(handle_cuda());
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBiasForward::MatmulParam>("MATMUL8X8X32", {})
- .c_str()));
- param::ConvBias cur_param;
- using NLMode = param::ConvBias::NonlineMode;
- cur_param.mode = param::ConvBias::Mode::CROSS_CORRELATION;
- cur_param.sparse = ConvBias::Param::Sparse::DENSE;
- cur_param.format = param::ConvBias::Format::NHWC;
-
- UniformIntRNG rng{-100, 100};
- UniformIntRNG bias_rng{-1000, 1000};
- checker.set_rng(0, &rng)
- .set_rng(1, &rng)
- .set_rng(2, &bias_rng)
- .set_rng(3, &rng)
- .set_dtype(0, dtype::QuantizedS8{1.2f})
- .set_dtype(1, dtype::QuantizedS8{1.3f})
- .set_dtype(2, dtype::QuantizedS32{1.2f * 1.3f})
- .set_dtype(3, dtype::QuantizedS8{1.1f})
- .set_dtype(4, dtype::QuantizedS8{1.0f})
- .set_epsilon(1);
-
- for (auto nlmode : {NLMode::IDENTITY, NLMode::RELU}) {
- cur_param.nonlineMode = nlmode;
- for (uint32_t s : {1}) {
- for (uint32_t f : {1, 3, 5, 7}) {
- cur_param.pad_h = cur_param.pad_w = f / 2;
- cur_param.stride_h = cur_param.stride_w = s;
- checker.set_param(cur_param).execs(
- {{2, 16, 16, 4}, {4, f, f, 4}, {1, 1, 1, 4}, {}, {}});
- }
- }
-
- cur_param.pad_h = cur_param.pad_w = 0;
- cur_param.stride_h = cur_param.stride_w = 1;
- checker.set_param(cur_param)
- .execs({{2, 3, 16, 3}, {5, 3, 3, 3}, {1, 1, 1, 5}, {}, {}})
- .execs({{2, 8, 3, 2}, {3, 3, 3, 2}, {1, 1, 1, 3}, {}, {}});
- }
- //! noncontiguous case
- {
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- param.format = param::ConvBias::Format::NHWC;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 7, 7, 16}, {1568, 224, 32, 1}, dtype::QuantizedS8{1.2f}},
- {{16, 3, 3, 16}, {144, 48, 16, 1}, dtype::QuantizedS8{1.3f}},
- {{}, {}, dtype::QuantizedS32{1.2f * 1.3f}},
- {{}, {}, dtype::QuantizedS8{1.1f}},
- {{2, 7, 7, 16}, {1568, 224, 32, 1}, dtype::QuantizedS32{1.2f * 1.3f}},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_MATMUL_NCHW4) {
- require_compute_capability(6, 1);
- Checker<ConvBiasForward> checker(handle_cuda());
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBiasForward::MatmulParam>("MATMUL8X8X32", {})
- .c_str()));
-
- UniformIntRNG int_rng{-127, 127};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW4;
- using NLMode = ConvBias::Param::NonlineMode;
-
- checker.set_dtype(0, dtype::QuantizedS8(0.5f))
- .set_dtype(1, dtype::QuantizedS8(0.5f))
- .set_dtype(2, dtype::QuantizedS32(0.25f))
- .set_dtype(4, dtype::QuantizedS8(0.35f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng);
-
- param.sparse = Convolution::Param::Sparse::DENSE;
- param.nonlineMode = NLMode::IDENTITY;
- param.pad_h = param.pad_w = 1;
- param.stride_h = param.stride_w = 1;
- checker.set_param(param);
- checker.exec({{8, 4, 10, 10, 4}, {16, 4, 3, 3, 4}, {1, 4, 1, 1, 4}, {}, {}});
- checker.exec({{1, 4, 2, 2, 4}, {16, 4, 3, 3, 4}, {1, 4, 1, 1, 4}, {}, {}});
- checker.exec({{8, 64, 12, 12, 4}, {256, 64, 3, 3, 4}, {1, 64, 1, 1, 4}, {}, {}});
- //! noncontiguous case
- {
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- param.format = ConvBias::Param::Format::NCHW4;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 4, 7, 7, 4}, {1568, 196, 28, 4, 1}, dtype::QuantizedS8{1.2f}},
- {{16, 4, 3, 3, 4}, {144, 36, 12, 4, 1}, dtype::QuantizedS8{1.3f}},
- {{}, {}, dtype::QuantizedS32{1.2f * 1.3f}},
- {{}, {}, dtype::QuantizedS8{1.1f}},
- {{2, 4, 7, 7, 4},
- {1568, 196, 28, 4, 1},
- dtype::QuantizedS32{1.2f * 1.3f}},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_BATCHED_MATMUL) {
- using namespace conv_bias;
- std::vector<TestArg> args = get_args_1x1();
- Checker<ConvBiasForward> checker(handle_cuda());
-
- NormalRNG default_rng;
- checker.set_dtype(0, dtype::Float32())
- .set_dtype(1, dtype::Float32())
- .set_dtype(2, dtype::Float32())
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_epsilon(1e-3);
- checker.set_before_exec_callback(
- AlgoChecker<ConvBiasForward>(ExecutionPolicyAlgoName{
- ConvBiasForward::algo_name<ConvBiasForward::MatmulParam>(
- "BATCHED_MATMUL", {})
- .c_str(),
- {{"CUBLAS", {}}}}));
-
- for (auto&& arg : args) {
- checker.set_param(arg.param);
- checker.execs({arg.src, arg.filter, arg.bias, {}, {}});
- }
- //! noncontiguous case
- {
- param::ConvBias param;
- checker.set_param(param).execl(TensorLayoutArray{
- {{2, 16, 7, 7}, {1568, 49, 7, 1}, dtype::Float32()},
- {{16, 16, 1, 1}, {16, 1, 1, 1}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{}, {}, dtype::Float32()},
- {{2, 16, 7, 7}, {784, 49, 7, 1}, dtype::Float32()},
- });
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_GROUP) {
- using NLMode = ConvBias::Param::NonlineMode;
- bool is_int_available = false;
- if (megdnn::test::check_compute_capability(6, 1)) {
- is_int_available = true;
- } else {
- is_int_available = false;
- }
-
- auto run = [&](size_t N, size_t IC, size_t IH, size_t IW, size_t FH, size_t FW,
- size_t OC, size_t PH, size_t PW, size_t SH, size_t SW, size_t DH,
- size_t DW, size_t group, NLMode mode) {
- {
- // float case
- Checker<ConvBiasForward> checker(handle_cuda());
- checker.set_before_exec_callback(
- conv_bias::ConvBiasAlgoChecker<ConvBias>(ExecutionPolicyAlgoName{
- ConvBiasForward::algo_name<ConvBiasForward::DirectParam>(
- "CUDA:GROUP_CONV", {})
- .c_str(),
- {{"DEFAULT:CUDNN", {}}}}));
- ConvBias::Param param;
- param.sparse = ConvBias::Param::Sparse::GROUP;
- param.nonlineMode = mode;
- param.pad_h = PH;
- param.pad_w = PW;
- param.stride_h = SH;
- param.stride_w = SW;
- param.dilate_h = DH;
- param.dilate_w = DW;
- auto ICg = IC / group;
- auto OCg = OC / group;
- checker.set_param(param).exec(
- {{N, IC, IH, IW},
- {group, OCg, ICg, FH, FW},
- {1, OCg * group, 1, 1},
- {},
- {}});
- }
- if (is_int_available) {
- // int 8x8x32 case
- Checker<ConvBiasForward> checker(handle_cuda());
- ConvBias::Param param;
- param.sparse = Convolution::Param::Sparse::GROUP;
- param.format = Convolution::Param::Format::NHWC;
- param.nonlineMode = NLMode::IDENTITY;
- param.pad_h = PH;
- param.pad_w = PW;
- param.stride_h = SH;
- param.stride_w = SW;
- param.dilate_h = DH;
- param.dilate_w = DW;
- auto ICg = IC / group;
- auto OCg = OC / group;
- UniformIntRNG rng(-4, 4);
- checker.set_param(param)
- .set_dtype(0, dtype::QuantizedS8(0.5f))
- .set_dtype(1, dtype::QuantizedS8(0.5f))
- .set_dtype(2, dtype::QuantizedS32(0.25f))
- .set_dtype(3, dtype::QuantizedS8(0.13f))
- .set_dtype(4, dtype::QuantizedS8(0.35f))
- .set_rng(0, &rng)
- .set_rng(1, &rng)
- .set_rng(2, &rng)
- .exec({{N, IH, IW, IC},
- {group, OCg, FH, FW, ICg},
- {1, 1, 1, OCg * group},
- {},
- {}});
- }
- };
-
- for (NLMode nlmode :
- {NLMode::IDENTITY, NLMode::RELU, NLMode::SIGMOID, NLMode::H_SWISH}) {
- // normal case
- run(2, 64, 7, 7, 3, 3, 32, 0, 0, 1, 1, 1, 1, 2, nlmode);
- // padded case
- run(2, 32, 7, 7, 3, 3, 64, 1, 1, 1, 1, 1, 1, 4, nlmode);
- // strided case
- run(2, 32, 7, 7, 3, 3, 64, 0, 0, 2, 2, 1, 1, 8, nlmode);
- // dilated case
- run(2, 32, 7, 7, 3, 3, 64, 0, 0, 1, 1, 2, 2, 8, nlmode);
- }
- }
-
- #if CUDA_VERSION >= 10000
- TEST_F(CUDA, CONV_BIAS_FORWARD_NCHW8_PART_1) {
- test_conv_bias_forward_wmma_int4_nchw8(handle_cuda(), 3);
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_NCHW8_PART_2) {
- test_conv_bias_forward_wmma_int4_nchw8(handle_cuda(), 5);
- }
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_NCHW8_PART_3) {
- test_conv_bias_forward_wmma_int4_nchw8(handle_cuda(), 7);
- }
-
- #if MEGDNN_WITH_BENCHMARK
- TEST_F(CUDA, BENCHMARK_CONV_BIAS_QUANTIZED4x4x32) {
- require_compute_capability(7, 5);
- Benchmarker<ConvBiasForward> bencher(handle_cuda());
-
- UniformIntRNG int_rng{0, 8};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW8;
- param.stride_h = param.stride_w = 1;
-
- using NonlineMode = ConvBias::Param::NonlineMode;
- param.nonlineMode = NonlineMode::RELU;
- auto run_bench = [&](size_t batch, size_t ci, size_t hi, size_t wi, size_t co,
- size_t fh, size_t fw, size_t nr_times) {
- param.pad_h = fh / 2;
- param.pad_w = fw / 2;
- bencher.set_param(param)
- .set_dtype(0, dtype::Quantized4Asymm(1.3f, (uint8_t)(1)))
- .set_dtype(1, dtype::Quantized4Asymm(1.3f, (uint8_t)(2)))
- .set_dtype(2, dtype::QuantizedS32(1.3f * 1.3f))
- .set_dtype(4, dtype::QuantizedS32(1.3f * 1.3f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng);
- bencher.set_times(nr_times);
- size_t ho = infer_conv_shape(hi, fh, 1, param.pad_h);
- size_t wo = infer_conv_shape(wi, fw, 1, param.pad_w);
- TensorShape inp{batch, ci / 8, hi, wi, 8}, kern{co, ci / 8, fh, fw, 8},
- out{batch, co / 8, ho, wo, 8};
- auto time_in_ms =
- bencher.execs({inp, kern, {1, co / 8, 1, 1, 8}, {}, out}) / nr_times;
- auto ops =
- 2.0 * batch * co * ho * wo * ci * fh * fw / (time_in_ms * 1e-3) * 1e-12;
- printf("inp=%s, kern=%s, out=%s, time: %.2fms, perf: %.2f Tops\n",
- inp.to_string().c_str(), kern.to_string().c_str(),
- out.to_string().c_str(), time_in_ms, ops);
- };
- run_bench(256, 256, 16, 16, 256, 3, 3, 1000);
-
- run_bench(1, 32, 224, 224, 64, 7, 7, 1000);
- run_bench(1, 8192, 64, 64, 4096, 3, 3, 1000);
- run_bench(1, 256, 64, 64, 256, 3, 3, 1000);
- run_bench(1, 64, 128, 128, 64, 3, 3, 1000);
- run_bench(1, 512, 32, 32, 512, 3, 3, 1000);
- run_bench(1, 1024, 16, 16, 1024, 3, 3, 1000);
-
- run_bench(1, 64, 56, 56, 64, 3, 3, 1000);
- run_bench(1, 128, 32, 32, 128, 3, 3, 1000);
- run_bench(1, 256, 16, 16, 256, 3, 3, 1000);
- run_bench(1, 512, 8, 8, 512, 3, 3, 1000);
-
- run_bench(32, 32, 224, 224, 64, 7, 7, 1000);
- run_bench(32, 64, 56, 56, 64, 3, 3, 1000);
- run_bench(32, 128, 32, 32, 128, 3, 3, 1000);
- run_bench(32, 256, 16, 16, 256, 3, 3, 1000);
- run_bench(32, 512, 8, 8, 512, 3, 3, 1000);
-
- run_bench(256, 32, 224, 224, 64, 7, 7, 1000);
- run_bench(256, 64, 56, 56, 64, 3, 3, 1000);
- run_bench(256, 128, 32, 32, 128, 3, 3, 1000);
- run_bench(256, 256, 16, 16, 256, 3, 3, 1000);
- run_bench(256, 512, 8, 8, 512, 3, 3, 1000);
- }
- #endif
- #endif
-
- TEST_F(CUDA, CONV_BIAS_FORWARD_DILATED) {
- require_compute_capability(6, 0);
- auto run = [&](size_t N, size_t IC, size_t IH, size_t IW, size_t FH, size_t FW,
- size_t OC, size_t PH, size_t PW, size_t SH, size_t SW, size_t DH,
- size_t DW) {
- {
- // float case
- Checker<ConvBiasForward> checker(handle_cuda());
- ConvBias::Param param;
- param.sparse = ConvBias::Param::Sparse::DENSE;
- param.pad_h = PH;
- param.pad_w = PW;
- param.stride_h = SH;
- param.stride_w = SW;
- param.dilate_h = DH;
- param.dilate_w = DW;
- param.nonlineMode = ConvBias::Param::NonlineMode::IDENTITY;
- checker.set_param(param).exec(
- {{N, IC, IH, IW}, {OC, IC, FH, FW}, {1, OC, 1, 1}, {}, {}});
- }
- };
-
- // dilated case
- run(2, 8, 7, 7, 3, 3, 4, 0, 0, 1, 1, 2, 2);
- }
-
- #if CUDNN_VERSION >= 7500
- TEST_F(CUDA, CONV_BIAS_FORWARD_TENSORCORE_INT8) {
- require_compute_capability(7, 5);
- using namespace conv_bias;
- Checker<ConvBiasForward> checker(handle_cuda());
- auto opr = handle_cuda()->create_operator<ConvBias>();
- auto i8_min = std::numeric_limits<int8_t>().min();
- auto i8_max = std::numeric_limits<int8_t>().max();
- UniformIntRNG int_rng{i8_min, i8_max};
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW32;
-
- using NonlineMode = ConvBias::Param::NonlineMode;
- for (NonlineMode mode : {NonlineMode::IDENTITY, NonlineMode::RELU}) {
- for (size_t batch : {2}) {
- for (size_t ic : {64, 32}) {
- for (size_t oc : {32}) {
- for (size_t fh : {3, 5, 7}) {
- for (int ph : {static_cast<int>(fh / 2), 0}) {
- for (int sh : {1, 2}) {
- for (size_t ih : {9, 11, 12}) {
- for (size_t iw : {8, 27, 32}) {
- param.nonlineMode = mode;
- param.stride_h = param.stride_w = sh;
- param.pad_h = param.pad_w = ph;
-
- opr->param() = param;
- TensorLayout dst_layout;
- opr->deduce_layout(
- {{batch, ic / 32, ih, iw, 32},
- dtype::Float32()},
- {{oc, ic / 32, fh, fh, 32},
- dtype::Float32()},
- {}, {}, dst_layout);
-
- checker.set_dtype(0, dtype::QuantizedS8(1.3f))
- .set_dtype(1, dtype::QuantizedS8(1.3f))
- .set_dtype(
- 2, dtype::QuantizedS32(
- 1.3f * 1.3f))
- .set_dtype(3, dtype::QuantizedS8(1.7f))
-
- .set_dtype(
- 4,
- dtype::QuantizedS8(1.2f * 1.2f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_rng(3, &int_rng)
- .set_epsilon(1 + 1e-3)
- .set_param(param)
- .execs({{batch, ic / 32, ih, iw, 32},
- {oc, ic / 32, fh, fh, 32},
- {1, oc / 32, 1, 1, 32},
- dst_layout,
- {}});
- }
- }
- }
- }
- }
- }
- }
- }
- }
- { //! convbiasactivation algo crash when oc > 256 && cudnn v8.0.4
- param.nonlineMode = NonlineMode::RELU;
- param.stride_h = param.stride_w = 1;
- param.pad_h = param.pad_w = 0;
-
- checker.set_dtype(0, dtype::QuantizedS8(1.3f))
- .set_dtype(1, dtype::QuantizedS8(1.3f))
- .set_dtype(2, dtype::QuantizedS32(1.3f * 1.3f))
- .set_dtype(3, dtype::QuantizedS8(1.7f))
-
- .set_dtype(4, dtype::QuantizedS8(1.2f * 1.2f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng)
- .set_rng(3, &int_rng)
- .set_epsilon(1 + 1e-3)
- .set_param(param)
- .execs({{2, 8, 12, 12, 32},
- {512, 8, 1, 1, 32},
- {1, 16, 1, 1, 32},
- {},
- {}});
- }
- }
-
- TEST_F(CUDA, CONV_BIAS_ADD_Z_CUDNN_CONVOLUTION) {
- using namespace conv_bias;
- Checker<ConvBiasForward> checker(handle_cuda());
-
- checker.set_before_exec_callback(conv_bias::ConvBiasAlgoChecker<ConvBias>(
- ConvBiasForward::algo_name<ConvBias::DefaultParam>("CUDNN:Convolution", {})
- .c_str()));
-
- NormalRNG default_rng;
- param::ConvBias param;
- param.pad_h = param.pad_w = 1;
- using Format = param::ConvBias::Format;
- using NLMode = param::ConvBias::NonlineMode;
- param.nonlineMode = NLMode::RELU;
- auto c = [&](DType dt) {
- param.format = Format::NCHW;
- /// set epsilon to be 2e-3 to bypass low accuracy of winograd algorithm
- float eps = 2e-3;
- if (dt == dtype::Float16()) {
- eps = 1e-2;
- param.compute_mode = param::ConvBias::ComputeMode::FLOAT32;
- }
- checker.set_dtype(0, dt)
- .set_dtype(1, dt)
- .set_dtype(2, dt)
- .set_dtype(3, dt)
- .set_dtype(4, dt)
- .set_rng(0, &default_rng)
- .set_rng(1, &default_rng)
- .set_rng(2, &default_rng)
- .set_rng(3, &default_rng)
- .set_epsilon(eps)
- .set_param(param)
- .execs({{16, 256, 7, 7},
- {256, 256, 3, 3},
- {1, 256, 1, 1},
- {16, 256, 7, 7},
- {}});
- param.format = Format::NHWC;
- checker.set_param(param).execs(
- {{16, 7, 7, 256},
- {256, 3, 3, 256},
- {1, 1, 1, 256},
- {16, 7, 7, 256},
- {}});
- };
- c(dtype::Float32());
- c(dtype::Float16());
- }
-
- #if MEGDNN_WITH_BENCHMARK
- TEST_F(CUDA, BENCHMARK_CONV_BIAS_FORWARD_TENSORCORE_INT8) {
- require_compute_capability(7, 5);
- Benchmarker<ConvBiasForward> bencher(handle_cuda());
- bencher.set_display(false);
-
- ConvBias::Param param;
- param.format = ConvBias::Param::Format::NCHW32;
- ConvBias::Param param_without_tensorcore;
- param_without_tensorcore.format = ConvBias::Param::Format::NCHW4;
-
- auto i8_min = std::numeric_limits<int8_t>().min();
- auto i8_max = std::numeric_limits<int8_t>().max();
- UniformIntRNG int_rng{i8_min, i8_max};
-
- using NonlineMode = ConvBias::Param::NonlineMode;
- param.nonlineMode = NonlineMode::IDENTITY;
- auto run_bench = [&](size_t batch, size_t ci, size_t hi, size_t wi, size_t co,
- size_t fh, size_t fw, size_t sh, size_t sw, size_t nr_times) {
- param.pad_h = fh / 2;
- param.pad_w = fw / 2;
- param.stride_h = sh;
- param.stride_w = sw;
-
- param_without_tensorcore.pad_h = fh / 2;
- param_without_tensorcore.pad_w = fw / 2;
- param_without_tensorcore.stride_h = sh;
- param_without_tensorcore.stride_w = sw;
- bencher.set_param(param)
- .set_dtype(0, dtype::QuantizedS8(1.3f))
- .set_dtype(1, dtype::QuantizedS8(1.3f))
- .set_dtype(2, dtype::QuantizedS32(1.3f * 1.3f))
- .set_dtype(4, dtype::QuantizedS8(1.2f))
- .set_rng(0, &int_rng)
- .set_rng(1, &int_rng)
- .set_rng(2, &int_rng);
- bencher.set_times(nr_times);
- size_t ho = infer_conv_shape(hi, fh, sh, param.pad_h);
- size_t wo = infer_conv_shape(wi, fw, sw, param.pad_w);
- TensorShape inp{batch, ci / 32, hi, wi, 32}, kern{co, ci / 32, fh, fw, 32},
- out{batch, co / 32, ho, wo, 32};
- auto time_in_ms =
- bencher.execs({inp, kern, {1, co / 32, 1, 1, 32}, {}, out}) / nr_times;
- auto ops =
- 2.0 * batch * co * ho * wo * ci * fh * fw / (time_in_ms * 1e-3) * 1e-12;
- printf("inp=%s, kern=%s, out=%s, time: %.2fms, perf: %.2f Tops "
- "(TensorCore)",
- inp.to_string().c_str(), kern.to_string().c_str(),
- out.to_string().c_str(), time_in_ms, ops);
- decltype(ops) ops_without_tensorcore;
- bencher.set_param(param_without_tensorcore);
- {
- TensorShape inp{batch, ci / 4, hi, wi, 4}, kern{co, ci / 4, fh, fw, 4},
- out{batch, co / 4, ho, wo, 4};
- auto time_in_ms =
- bencher.execs({inp, kern, {1, co / 4, 1, 1, 4}, {}, out}) /
- nr_times;
- ops_without_tensorcore = 2.0 * batch * co * ho * wo * ci * fh * fw /
- (time_in_ms * 1e-3) * 1e-12;
- printf(", time: %.2fms perf: %.2f Tops (without TensorCore) ", time_in_ms,
- ops_without_tensorcore);
- }
- printf("speedup: %.2fx\n", ops / ops_without_tensorcore);
- };
-
- // resnet-50
- // bottleneck-1
- // proj
- run_bench(1, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(1, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
-
- // bottleneck-2
- // proj
- run_bench(1, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(1, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(1, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(1, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
-
- // bottleneck-3
- // proj
- run_bench(1, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(1, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(1, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(1, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
-
- // bottleneck-4
- // proj
- run_bench(1, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(1, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(1, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(1, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
-
- run_bench(32, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(32, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(32, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(32, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(32, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(32, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
- run_bench(32, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(32, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(32, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(32, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
- run_bench(32, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(32, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(32, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(32, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
-
- run_bench(256, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 64, 1, 1, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 64, 3, 3, 1, 1, 1000);
- run_bench(256, 64, 56, 56, 256, 1, 1, 1, 1, 1000);
- run_bench(256, 256, 56, 56, 512, 1, 1, 2, 2, 1000);
- run_bench(256, 256, 56, 56, 128, 1, 1, 2, 2, 1000);
- run_bench(256, 128, 28, 28, 128, 3, 3, 1, 1, 1000);
- run_bench(256, 128, 28, 28, 512, 1, 1, 1, 1, 1000);
- run_bench(256, 512, 28, 28, 1024, 1, 1, 2, 2, 1000);
- run_bench(256, 512, 28, 28, 256, 1, 1, 2, 2, 1000);
- run_bench(256, 256, 14, 14, 256, 3, 3, 1, 1, 1000);
- run_bench(256, 256, 14, 14, 1024, 1, 1, 1, 1, 1000);
- run_bench(256, 1024, 14, 14, 2048, 1, 1, 2, 2, 1000);
- run_bench(256, 1024, 14, 14, 512, 1, 1, 2, 2, 1000);
- run_bench(256, 512, 7, 7, 512, 3, 3, 1, 1, 1000);
- run_bench(256, 512, 7, 7, 2048, 1, 1, 1, 1, 1000);
- }
- #endif
- #endif
-
- // vim: syntax=cpp.doxygen
|