From a8aef2916379402e241d9f2c5e0faf3f99c860f7 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Mon, 14 May 2018 14:21:39 +0100 Subject: COMPMID-792 - Re-enabled Winograd on NEON in all graph examples. Since now the input transform can be multi-threaded, I re-ebaled Winograd in all graph examples Change-Id: I39ef78243bb47fdae135e18dcae2102af0675b3b Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/131048 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- examples/graph_alexnet.cpp | 3 +-- examples/graph_googlenet.cpp | 8 +++----- examples/graph_inception_v3.cpp | 8 +++----- examples/graph_inception_v4.cpp | 8 +++----- examples/graph_resnet50.cpp | 8 +++----- examples/graph_squeezenet.cpp | 8 +++----- examples/graph_squeezenet_v1_1.cpp | 8 +++----- 7 files changed, 19 insertions(+), 32 deletions(-) (limited to 'examples') diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp index b97ca54c78..ffcd8b8411 100644 --- a/examples/graph_alexnet.cpp +++ b/examples/graph_alexnet.cpp @@ -56,10 +56,9 @@ public: const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; Target target_hint = set_target_hint(target); - // TODO (geopin01) : Get GPU target somehow and set gemm also for midgard ? const bool is_neon = (target_hint == Target::NEON); ConvolutionMethod convolution_5x5_hint = is_neon ? ConvolutionMethod::GEMM : ConvolutionMethod::DIRECT; - ConvolutionMethod convolution_3x3_hint = is_neon ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; + ConvolutionMethod convolution_3x3_hint = ConvolutionMethod::DEFAULT; FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp index bac3c7c6d5..a47fc9d588 100644 --- a/examples/graph_googlenet.cpp +++ b/examples/graph_googlenet.cpp @@ -52,10 +52,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -107,7 +106,6 @@ public: get_weights_accessor(data_path, "/cnn_data/googlenet_model/conv1/conv1_7x7_s2_w.npy"), get_weights_accessor(data_path, "/cnn_data/googlenet_model/conv1/conv1_7x7_s2_b.npy"), PadStrideInfo(2, 2, 3, 3)) - << convolution_hint << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))) << NormalizationLayer(NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f)) diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp index 8e30fd97f2..1d4eb53233 100644 --- a/examples/graph_inception_v3.cpp +++ b/examples/graph_inception_v3.cpp @@ -51,10 +51,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -111,7 +110,6 @@ public: get_random_accessor(1.f, 1.f), get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_1a_3x3_BatchNorm_beta.npy"), 0.001f) - << convolution_hint << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) << ConvolutionLayer(3U, 3U, 32U, get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_2a_3x3_weights.npy"), diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp index 827370ec5e..ed95baa99e 100644 --- a/examples/graph_inception_v4.cpp +++ b/examples/graph_inception_v4.cpp @@ -54,10 +54,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(); // Set target. 0 (NEON), 1 (OpenCL). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -114,7 +113,6 @@ public: get_weights_accessor(data_path, "/cnn_data/inceptionv4_model/Conv2d_1a_3x3_BatchNorm_beta.npy"), 0.001f) << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) - << convolution_hint // Conv2d_2a_3x3 << ConvolutionLayer(3U, 3U, 32U, get_weights_accessor(data_path, "/cnn_data/inceptionv4_model/Conv2d_2a_3x3_weights.npy"), diff --git a/examples/graph_resnet50.cpp b/examples/graph_resnet50.cpp index 6fac372550..7332bb8b15 100644 --- a/examples/graph_resnet50.cpp +++ b/examples/graph_resnet50.cpp @@ -52,10 +52,9 @@ public: false /* Do not convert to BGR */); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -108,7 +107,6 @@ public: std::unique_ptr(nullptr), PadStrideInfo(2, 2, 3, 3)) .set_name("conv1/convolution") - << convolution_hint << BatchNormalizationLayer( get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_moving_variance.npy"), diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp index 2627c96774..4d7bcf1ca8 100644 --- a/examples/graph_squeezenet.cpp +++ b/examples/graph_squeezenet.cpp @@ -53,10 +53,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -110,7 +109,6 @@ public: PadStrideInfo(2, 2, 0, 0)) << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))) - << convolution_hint << ConvolutionLayer( 1U, 1U, 16U, get_weights_accessor(data_path, "/cnn_data/squeezenet_v1.0_model/fire2_squeeze1x1_w.npy"), diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp index c4a5433352..f5fede2f70 100644 --- a/examples/graph_squeezenet_v1_1.cpp +++ b/examples/graph_squeezenet_v1_1.cpp @@ -56,10 +56,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint(target); - ConvolutionMethod convolution_hint = target_hint == Target::NEON ? ConvolutionMethod::GEMM : ConvolutionMethod::DEFAULT; - FastMathHint fast_math_hint = FastMathHint::DISABLED; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint(target); + FastMathHint fast_math_hint = FastMathHint::DISABLED; // Parse arguments if(argc < 2) @@ -112,7 +111,6 @@ public: get_weights_accessor(data_path, "/cnn_data/squeezenet_v1_1_model/conv1_w.npy"), get_weights_accessor(data_path, "/cnn_data/squeezenet_v1_1_model/conv1_b.npy"), PadStrideInfo(2, 2, 0, 0)) - << convolution_hint << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))) << ConvolutionMethod::DEFAULT -- cgit v1.2.1