From 43c7707173434da61ff83dbc79956c9b192bcecf Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sat, 10 Sep 2016 03:38:17 +0300 Subject: Routine: use PrecisionSupported<>() instead of duplicating the check --- src/routine.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src') 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(device_)) || + (precision_ == Precision::kComplexDouble && !PrecisionSupported(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(device_)) { + throw RuntimeErrorCode(StatusCode::kNoHalfPrecision); } // Collects the parameters for this device in the form of defines, and adds the precision -- cgit v1.2.3