summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/utilities.cc15
2 files changed, 11 insertions, 6 deletions
diff --git a/README.md b/README.md
index 3b4b789e..f1a50ff4 100644
--- a/README.md
+++ b/README.md
@@ -200,7 +200,7 @@ CLBlast is in active development but already supports almost all the BLAS routin
| IxAMAX | ✔ | ✔ | ✔ | ✔ | ✔ |
| Level-2 | S | D | C | Z | H |
-| ---------|---|---|---|---| --|
+| ---------|---|---|---|---|---|
| xGEMV | ✔ | ✔ | ✔ | ✔ | ✔ |
| xGBMV | ✔ | ✔ | ✔ | ✔ | ✔ |
| xHEMV | - | - | ✔ | ✔ | - |
diff --git a/src/utilities.cc b/src/utilities.cc
index 477f4a5f..1a7c8e45 100644
--- a/src/utilities.cc
+++ b/src/utilities.cc
@@ -79,7 +79,6 @@ std::string ToString(T value) {
}
template std::string ToString<int>(int value);
template std::string ToString<size_t>(size_t value);
-template std::string ToString<half>(half value);
template std::string ToString<float>(float value);
template std::string ToString<double>(double value);
@@ -99,6 +98,12 @@ std::string ToString(double2 value) {
return real.str()+"+"+imag.str()+"i";
}
+// If not possible directly: special case for half-precision
+template <>
+std::string ToString(half value) {
+ return std::to_string(HalfToFloat(value));
+}
+
// If not possible directly: special cases for CLBlast data-types
template <>
std::string ToString(Layout value) {
@@ -157,7 +162,7 @@ T ConvertArgument(const char* value) {
return static_cast<T>(std::stoi(value));
}
template <> half ConvertArgument(const char* value) {
- return static_cast<half>(std::stod(value));
+ return FloatToHalf(static_cast<float>(std::stod(value)));
}
template <> float ConvertArgument(const char* value) {
return static_cast<float>(std::stod(value));
@@ -285,11 +290,11 @@ void PopulateVector(std::vector<double2> &vector) {
// Specialized versions of the above for half-precision
template <>
void PopulateVector(std::vector<half> &vector) {
- auto lower_limit = static_cast<float>(kTestDataLowerLimit);
- auto upper_limit = static_cast<float>(kTestDataUpperLimit);
+ const auto lower_limit = static_cast<float>(kTestDataLowerLimit);
+ const auto upper_limit = static_cast<float>(kTestDataUpperLimit);
std::mt19937 mt(GetRandomSeed());
std::uniform_real_distribution<float> dist(lower_limit, upper_limit);
- for (auto &element: vector) { element = static_cast<half>(dist(mt)); }
+ for (auto &element: vector) { element = FloatToHalf(dist(mt)); }
}
// =================================================================================================