diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-03-30 10:23:33 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-03-30 10:23:33 +0200 |
commit | d86ff75fa567202c2c15628f33b52282e76f47f9 (patch) | |
tree | 2c656f75ed43d8a19a56b71b8d2e3558bb3edd52 | |
parent | 7e69c422af77b24675f91969c2b2faecf1058b36 (diff) |
Added argument checking for the GEMM tuner: expects m/n to be multiples of MWG/NWG
-rw-r--r-- | src/tuning/kernels/xgemm.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tuning/kernels/xgemm.hpp b/src/tuning/kernels/xgemm.hpp index 5f191ba9..51549bee 100644 --- a/src/tuning/kernels/xgemm.hpp +++ b/src/tuning/kernels/xgemm.hpp @@ -118,7 +118,16 @@ TunerSettings XgemmGetTunerSettings(const int V, const Arguments<T> &args) { // Tests for valid arguments template <typename T> -void XgemmTestValidArguments(const int, const Arguments<T> &) { } +void XgemmTestValidArguments(const int V, const Arguments<T> &args) { + const auto mwg_max = (V == 1) ? 64 : 128; + const auto nwg_max = (V == 1) ? 64 : 128; + if (!IsMultiple(args.m, mwg_max)) { + throw std::runtime_error("'Xgemm' kernel requires 'm' to be a multiple of MWG (max " + ToString(mwg_max) + ")"); + } + if (!IsMultiple(args.n, nwg_max)) { + throw std::runtime_error("'Xgemm' kernel requires 'n' to be a multiple of NWG (max " + ToString(nwg_max) + ")"); + } +} std::vector<Constraint> XgemmSetConstraints(const int V) { auto constraints = std::vector<Constraint>(); auto MultipleOfX = [] (std::vector<size_t> v) { return IsMultiple(v[0], v[1]); }; |