Skip to content

Commit 25c8daa

Browse files
authored
Merge branch 'CNugteren:master' into master
2 parents 7d2790d + 999a532 commit 25c8daa

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Development version (next version)
44
- Added tuned parameters for many devices (see doc/tuning.md)
55
- Enabled parallel kernel compilation for faster kernel tuning (see doc/tuning.md)
66
- Removed all generator scripts for the API
7+
- Added 3 new error codes for vector Z in routine XHAD
78

89
Version 1.6.3
910
- Fixed a bug in the GEMMK=1 kernel (with 2D register tiling) when MWG!=NWG

include/clblast.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ enum class StatusCode {
123123
kDatabaseError = -2041, // Entry for the device was not found in the database
124124
kUnknownError = -2040, // A catch-all error code representing an unspecified error
125125
kUnexpectedError = -2039, // A catch-all error code representing an unexpected exception
126+
kInvalidVectorZ = -2038, // Vector Z is not a valid OpenCL buffer
127+
kInvalidIncrementZ = -2037, // Increment of vector Z cannot be zero
128+
kInsufficientMemoryZ = -2036, // Vector Z's OpenCL buffer is too small
126129
};
127130

128131
// Matrix layout and transpose types

include/clblast_c.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ typedef enum CLBlastStatusCode_ {
122122
CLBlastDatabaseError = -2041, // Entry for the device was not found in the database
123123
CLBlastUnknownError = -2040, // A catch-all error code representing an unspecified error
124124
CLBlastUnexpectedError = -2039, // A catch-all error code representing an unexpected exception
125+
CLBlastInvalidVectorZ = -2038, // Vector Z is not a valid OpenCL buffer
126+
CLBlastInvalidIncrementZ = -2037, // Increment of vector Z cannot be zero
127+
CLBlastInsufficientMemoryZ = -2036, // Vector Z's OpenCL buffer is too small
125128
} CLBlastStatusCode;
126129

127130
// Matrix layout and transpose types

include/clblast_cuda.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ enum class StatusCode {
7777
kDatabaseError = -2041, // Entry for the device was not found in the database
7878
kUnknownError = -2040, // A catch-all error code representing an unspecified error
7979
kUnexpectedError = -2039, // A catch-all error code representing an unexpected exception
80+
kInvalidVectorZ = -2038, // Vector Z is not a valid OpenCL buffer
81+
kInvalidIncrementZ = -2037, // Increment of vector Z cannot be zero
82+
kInsufficientMemoryZ = -2036, // Vector Z's OpenCL buffer is too small
8083
};
8184

8285
// Matrix layout and transpose types

src/routines/levelx/xhad.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void Xhad<T>::DoHad(const size_t n, const T alpha, const Buffer<T>& x_buffer, co
4141
// Tests the vectors for validity
4242
TestVectorX(n, x_buffer, x_offset, x_inc);
4343
TestVectorY(n, y_buffer, y_offset, y_inc);
44-
TestVectorY(n, z_buffer, z_offset, z_inc); // TODO: Make a TestVectorZ function with error codes
44+
TestVectorZ(n, z_buffer, z_offset, z_inc);
4545

4646
// Determines whether or not the fast-version can be used
4747
const auto use_faster_kernel = (x_offset == 0) && (x_inc == 1) && (y_offset == 0) && (y_inc == 1) &&

src/utilities/buffer_test.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ void TestVectorY(const size_t n, const Buffer<T>& buffer, const size_t offset, c
116116
}
117117
}
118118

119+
// Tests vector 'Z' for validity
120+
template <typename T>
121+
void TestVectorZ(const size_t n, const Buffer<T>& buffer, const size_t offset, const size_t inc) {
122+
if (inc == 0) {
123+
throw BLASError(StatusCode::kInvalidIncrementZ);
124+
}
125+
try {
126+
const auto required_size = ((n - 1) * inc + 1 + offset) * sizeof(T);
127+
if (buffer.GetSize() < required_size) {
128+
throw BLASError(StatusCode::kInsufficientMemoryZ);
129+
}
130+
} catch (const Error<std::runtime_error>& e) {
131+
throw BLASError(StatusCode::kInvalidVectorZ, e.what());
132+
}
133+
}
134+
119135
// =================================================================================================
120136

121137
// Tests vector 'scalar' for validity

0 commit comments

Comments
 (0)