diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-01-24 09:10:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 09:10:35 +0100 |
commit | e943fe77d64f42ed1e57c9919de8ca6787760f2b (patch) | |
tree | 9da420f6259d2e7a5aafffd530d6a84dea8402e3 /src/routine.cpp | |
parent | 2e4f6e16098d36d0572769a1092d1e54cdb6d4ea (diff) | |
parent | 46a59eb8821e3c92db7be347fca099405246d9ec (diff) |
Merge pull request #131 from intelfx/misc
Assorted minor fixes
Diffstat (limited to 'src/routine.cpp')
-rw-r--r-- | src/routine.cpp | 15 |
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 |