diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-10-17 21:35:09 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-10-17 21:35:09 +0200 |
commit | ab0178c56bf989e3399a1a9738887fb59d0496ed (patch) | |
tree | 61a1dbfcc856bc7e64c54cd7b5961e44f0341b22 /test/correctness | |
parent | 9a1454496d557c7b0c2daeb84a5506a25c309477 (diff) |
Fixed MSVC's compilation error C1061 due to too many for-loops
Diffstat (limited to 'test/correctness')
-rw-r--r-- | test/correctness/testblas.hpp | 83 |
1 files changed, 55 insertions, 28 deletions
diff --git a/test/correctness/testblas.hpp b/test/correctness/testblas.hpp index e9a995fd..137df30f 100644 --- a/test/correctness/testblas.hpp +++ b/test/correctness/testblas.hpp @@ -163,6 +163,55 @@ static StatusCode ReferenceNotAvailable(const Arguments<U> &, BufferType &, Queu return StatusCode::kNotImplemented; } +// Helper for the below function: MSVC's C1061 error requires part of the for-loops to be in a +// separate file. This part handles the im2col/xconv arguments. +template <typename C, typename T, typename U> +void handle_remaining_of_options(std::vector<Arguments<U>> ®ular_test_vector, Arguments<U> &r_args, + TestBlas<T,U> &tester, + const std::vector<size_t> &channelss, + const std::vector<size_t> &heights, + const std::vector<size_t> &widths, + const std::vector<size_t> &kernel_hs, + const std::vector<size_t> &kernel_ws, + const std::vector<size_t> &pad_hs, + const std::vector<size_t> &pad_ws, + const std::vector<size_t> &stride_hs, + const std::vector<size_t> &stride_ws, + const std::vector<size_t> &dilation_hs, + const std::vector<size_t> &dilation_ws, + const std::vector<size_t> &batch_counts, + const std::vector<size_t> &num_kernelss) { + for (auto &channels: channelss) { r_args.channels = channels; + for (auto &height: heights) { r_args.height = height; + for (auto &width: widths) { r_args.width = width; + for (auto &kernel_h: kernel_hs) { r_args.kernel_h = kernel_h; + for (auto &kernel_w: kernel_ws) { r_args.kernel_w = kernel_w; + for (auto &pad_h: pad_hs) { r_args.pad_h = pad_h; + for (auto &pad_w: pad_ws) { r_args.pad_w = pad_w; + for (auto &stride_h: stride_hs) { r_args.stride_h = stride_h; + for (auto &stride_w: stride_ws) { r_args.stride_w = stride_w; + for (auto &dilation_h: dilation_hs) { r_args.dilation_h = dilation_h; + for (auto &dilation_w: dilation_ws) { r_args.dilation_w = dilation_w; + for (auto &batch_count: batch_counts) { r_args.batch_count = batch_count; + for (auto &num_kernels: num_kernelss) { r_args.num_kernels = num_kernels; + C::SetSizes(r_args, tester.queue_); + regular_test_vector.push_back(r_args); + } + } + } + } + } + } + } + } + } + } + } + } + } + +} + // The interface to the correctness tester. This is a separate function in the header such that it // is automatically compiled for each routine, templated by the parameter "C". template <typename C, typename T, typename U> @@ -346,34 +395,12 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na for (auto &imax_offset: imax_offsets) { r_args.imax_offset = imax_offset; for (auto &alpha: alphas) { r_args.alpha = alpha; for (auto &beta: betas) { r_args.beta = beta; - for (auto &channels: channelss) { r_args.channels = channels; - for (auto &height: heights) { r_args.height = height; - for (auto &width: widths) { r_args.width = width; - for (auto &kernel_h: kernel_hs) { r_args.kernel_h = kernel_h; - for (auto &kernel_w: kernel_ws) { r_args.kernel_w = kernel_w; - for (auto &pad_h: pad_hs) { r_args.pad_h = pad_h; - for (auto &pad_w: pad_ws) { r_args.pad_w = pad_w; - for (auto &stride_h: stride_hs) { r_args.stride_h = stride_h; - for (auto &stride_w: stride_ws) { r_args.stride_w = stride_w; - for (auto &dilation_h: dilation_hs) { r_args.dilation_h = dilation_h; - for (auto &dilation_w: dilation_ws) { r_args.dilation_w = dilation_w; - for (auto &batch_count: batch_counts) { r_args.batch_count = batch_count; - for (auto &num_kernels: num_kernelss) { r_args.num_kernels = num_kernels; - C::SetSizes(r_args, tester.queue_); - regular_test_vector.push_back(r_args); - } - } - } - } - } - } - } - } - } - } - } - } - } + // Cannot have more for-loops because of MSVC's C1061 error + handle_remaining_of_options<C>(regular_test_vector, r_args, tester, + channelss, heights, widths, kernel_hs, kernel_ws, + pad_hs, pad_ws, stride_hs, stride_ws, + dilation_hs, dilation_ws, + batch_counts, num_kernelss); } } } |