summaryrefslogtreecommitdiff
path: root/src/routine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/routine.cpp')
-rw-r--r--src/routine.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/routine.cpp b/src/routine.cpp
index acafb0d2..d5a6b589 100644
--- a/src/routine.cpp
+++ b/src/routine.cpp
@@ -52,24 +52,21 @@ Routine::Routine(Queue &queue, EventPointer event, const std::string &name,
auto program = Program(device_, context_, binary);
program.Build(device_, options);
StoreProgramToCache(program, context_, precision_, routine_name_);
+ return;
}
// Otherwise, the kernel will be compiled and program will be built. Both the binary and the
// 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