summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2023-05-07 20:03:16 +0200
committerGitHub <noreply@github.com>2023-05-07 20:03:16 +0200
commit4f24d927302078a416dea1bc29d714a95732b8e9 (patch)
treeae8b34c8810c080a6d71a91b2fe16939f4d3d49d /src
parent3d0c227fa5004067d857c74f7963876b34ed4170 (diff)
TRMV: Use the minimum x buffer size for copying to a temp buffer (#458)
Diffstat (limited to 'src')
-rw-r--r--src/routines/level2/xtrmv.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/routines/level2/xtrmv.cpp b/src/routines/level2/xtrmv.cpp
index 80e29009..3be176b0 100644
--- a/src/routines/level2/xtrmv.cpp
+++ b/src/routines/level2/xtrmv.cpp
@@ -36,8 +36,9 @@ void Xtrmv<T>::DoTrmv(const Layout layout, const Triangle triangle,
const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) {
// Creates a copy of X: a temporary scratch buffer
- auto scratch_buffer = Buffer<T>(context_, n*x_inc + x_offset);
- x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer);
+ const auto x_size = (1 + (n - 1) * x_inc) + x_offset;
+ auto scratch_buffer = Buffer<T>(context_, x_size);
+ x_buffer.CopyTo(queue_, x_size, scratch_buffer);
// The data is either in the upper or lower triangle
size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) ||