diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2021-05-22 20:31:12 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2021-05-22 20:31:12 +0200 |
commit | 468a4a74eb9fae9d640c7a1a06ff3490c8710ee0 (patch) | |
tree | c278d9450954195ce59e59ca8d54040162b8a2af | |
parent | 856c850113fe25bc1afed56a3495405bec72d3ed (diff) |
Fix issue with printing out-of-bounds local/global sizes for level 1 tuners
-rw-r--r-- | src/tuning/tuning.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tuning/tuning.cpp b/src/tuning/tuning.cpp index 4160faf7..36da4a80 100644 --- a/src/tuning/tuning.cpp +++ b/src/tuning/tuning.cpp @@ -227,7 +227,12 @@ void Tuner(int argc, char* argv[], const int V, for (auto i=size_t{0}; i<global.size(); ++i) { while ((global[i] / local[i]) * local[i] != global[i]) { global[i]++; } } - printf("%8zu%8zu |%8zu%8zu |", local[0], local[1], global[0], global[1]); + if (local.size() > 1 && global.size() > 1) { + printf("%8zu%8zu |%8zu%8zu |", local[0], local[1], global[0], global[1]); + } + else { + printf("%8zu%8d |%8zu%8d |", local[0], 1, global[0], 1); + } // Compiles the kernel auto compiler_options = std::vector<std::string>(); @@ -283,7 +288,12 @@ void Tuner(int argc, char* argv[], const int V, for (auto i=size_t{0}; i<global.size(); ++i) { while ((global[i] / local[i]) * local[i] != global[i]) { global[i]++; } } - printf("%8zu%8zu |%8zu%8zu |", local[0], local[1], global[0], global[1]); + if (local.size() > 1 && global.size() > 1) { + printf("%8zu%8zu |%8zu%8zu |", local[0], local[1], global[0], global[1]); + } + else { + printf("%8zu%8d |%8zu%8d |", local[0], 1, global[0], 1); + } // Sets the parameters for this configuration auto kernel_source = std::string{""}; |