diff options
author | Ivan Shapovalov <intelfx@intelfx.name> | 2016-09-10 03:38:17 +0300 |
---|---|---|
committer | Ivan Shapovalov <intelfx@intelfx.name> | 2017-01-20 17:20:45 +0300 |
commit | 43c7707173434da61ff83dbc79956c9b192bcecf (patch) | |
tree | 03d53d76cd7375f04644636b830440960cafcaa1 /src/routine.cpp | |
parent | 2e4f6e16098d36d0572769a1092d1e54cdb6d4ea (diff) |
Routine: use PrecisionSupported<>() instead of duplicating the check
Diffstat (limited to 'src/routine.cpp')
-rw-r--r-- | src/routine.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/routine.cpp b/src/routine.cpp index acafb0d2..faa7da7c 100644 --- a/src/routine.cpp +++ b/src/routine.cpp @@ -58,18 +58,14 @@ Routine::Routine(Queue &queue, EventPointer event, const std::string &name, // program will be added to the cache. // Inspects whether or not cl_khr_fp64 is supported in case of double precision - const auto extensions = device_.Capabilities(); - if (precision_ == Precision::kDouble || precision_ == Precision::kComplexDouble) { - if (extensions.find(kKhronosDoublePrecision) == std::string::npos) { - throw RuntimeErrorCode(StatusCode::kNoDoublePrecision); - } + if ((precision_ == Precision::kDouble && !PrecisionSupported<double>(device_)) || + (precision_ == Precision::kComplexDouble && !PrecisionSupported<double2>(device_))) { + throw RuntimeErrorCode(StatusCode::kNoDoublePrecision); } // As above, but for cl_khr_fp16 (half precision) - if (precision_ == Precision::kHalf) { - if (extensions.find(kKhronosHalfPrecision) == std::string::npos) { - throw RuntimeErrorCode(StatusCode::kNoHalfPrecision); - } + if (precision_ == Precision::kHalf && !PrecisionSupported<half>(device_)) { + throw RuntimeErrorCode(StatusCode::kNoHalfPrecision); } // Collects the parameters for this device in the form of defines, and adds the precision |