MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_winograd_benchmark_args

Function get_winograd_benchmark_args

dnn/test/common/conv_bias.cpp:904–967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903#if MEGDNN_WITH_BENCHMARK
904std::vector<conv_bias::TestArg> get_winograd_benchmark_args(
905 size_t kernel, size_t pack_size, size_t io_pack_size) {
906 megdnn_assert(io_pack_size == 1 || io_pack_size == 4 || io_pack_size == 8);
907 std::vector<conv_bias::TestArg> args;
908 auto pack = [&](size_t oc, size_t ic, size_t w, size_t h, size_t kernel, size_t p) {
909 if (ic % pack_size != 0 || oc % pack_size != 0)
910 return;
911 if (w + 2 * p < kernel || h + 2 * p < kernel)
912 return;
913 param::ConvBias param;
914 param.stride_h = 1;
915 param.stride_w = 1;
916 param.pad_h = p;
917 param.pad_w = p;
918
919 if (io_pack_size == 4) {
920 param.format = param::ConvBias::Format::NCHW44;
921 args.push_back(conv_bias::TestArg{
922 param,
923 TensorShape{1, ic / 4, h, w, 4},
924 TensorShape{oc / 4, ic / 4, kernel, kernel, 4, 4},
925 {1, oc / 4, 1, 1, 4}});
926 } else if (io_pack_size == 8) {
927 param.format = param::ConvBias::Format::NCHW88;
928 args.push_back(conv_bias::TestArg{
929 param,
930 TensorShape{1, ic / 8, h, w, 8},
931 TensorShape{oc / 8, ic / 8, kernel, kernel, 8, 8},
932 {1, oc / 8, 1, 1, 8}});
933 } else {
934 args.push_back(conv_bias::TestArg{
935 param,
936 TensorShape{1, ic, h, w},
937 TensorShape{oc, ic, kernel, kernel},
938 {1, oc, 1, 1}});
939 }
940 };
941
942 for (size_t ic : {8, 16, 32, 64}) {
943 for (size_t oc : {8, 16, 32, 64}) {
944 pack(oc, ic, 56, 56, kernel, kernel / 2);
945 pack(oc, ic, 128, 128, kernel, kernel / 2);
946 pack(oc, ic, 256, 256, kernel, kernel / 2);
947 }
948 }
949
950 //! conv in vgg16
951 pack(512, 512, 15, 15, kernel, kernel / 2);
952 pack(512, 256, 15, 15, kernel, kernel / 2);
953 pack(256, 256, 29, 29, kernel, kernel / 2);
954 pack(256, 128, 29, 29, kernel, kernel / 2);
955 pack(128, 128, 57, 57, kernel, kernel / 2);
956 pack(128, 64, 57, 57, kernel, kernel / 2);
957 pack(64, 64, 123, 123, kernel, kernel / 2);
958 pack(64, 24, 123, 123, kernel, kernel / 2);
959 pack(24, 24, 224, 224, kernel, kernel / 2);
960
961 //! conv in resnet18

Callers 3

benchmark_winogradFunction · 0.70

Calls 2

packFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected