summaryrefslogtreecommitdiff
path: root/src/tuning
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-05-17 10:45:10 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2018-05-17 10:45:10 +0100
commitb855af681f2d6b7cf6d80504fd4601c64f2034c1 (patch)
treee2b9120619ea2e05e5371eadf69ee9274c5bb1e7 /src/tuning
parent8b381480f8bd3b40cc030b07a599da10092b8117 (diff)
Added a canary region for overflow detection to the tuners
Diffstat (limited to 'src/tuning')
-rw-r--r--src/tuning/tuning.cpp8
-rw-r--r--src/tuning/tuning_api.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/tuning/tuning.cpp b/src/tuning/tuning.cpp
index dd4a83e6..216f4b31 100644
--- a/src/tuning/tuning.cpp
+++ b/src/tuning/tuning.cpp
@@ -150,11 +150,11 @@ void Tuner(int argc, char* argv[], const int V,
const auto device_architecture = GetDeviceArchitecture(device);
const auto device_name = GetDeviceName(device);
- // Creates input buffers with random data
+ // Creates input buffers with random data. Adds a 'canary' region to detect buffer overflows.
const auto buffer_sizes = std::vector<size_t>{
- settings.size_x, settings.size_y,
- settings.size_a, settings.size_b, settings.size_c,
- settings.size_temp
+ settings.size_x + kCanarySize, settings.size_y + kCanarySize,
+ settings.size_a + kCanarySize, settings.size_b + kCanarySize, settings.size_c + kCanarySize,
+ settings.size_temp + kCanarySize
};
std::mt19937 mt(kSeed);
std::uniform_real_distribution<double> dist(kTestDataLowerLimit, kTestDataUpperLimit);
diff --git a/src/tuning/tuning_api.cpp b/src/tuning/tuning_api.cpp
index f1da40c1..2eec2e2e 100644
--- a/src/tuning/tuning_api.cpp
+++ b/src/tuning/tuning_api.cpp
@@ -241,11 +241,11 @@ StatusCode TunerAPI(Queue &queue, const Arguments<T> &args, const int V,
const auto device_architecture = GetDeviceArchitecture(device);
const auto device_name = GetDeviceName(device);
- // Creates input buffers with random data
+ // Creates input buffers with random data. Adds a 'canary' region to detect buffer overflows.
const auto buffer_sizes = std::vector<size_t>{
- settings.size_x, settings.size_y,
- settings.size_a, settings.size_b, settings.size_c,
- settings.size_temp
+ settings.size_x + kCanarySize, settings.size_y + kCanarySize,
+ settings.size_a + kCanarySize, settings.size_b + kCanarySize, settings.size_c + kCanarySize,
+ settings.size_temp + kCanarySize
};
const auto seed = static_cast<unsigned long>(time(nullptr));
std::mt19937 mt(seed);