| 57 | } |
| 58 | |
| 59 | Status ProgramCache::GetOrCreateCLKernel( |
| 60 | const std::string& code, const std::string& function_name, |
| 61 | const std::vector<CompilerOptions>& compiler_options, |
| 62 | const CLContext& context, const CLDevice& device, CLKernel* result) { |
| 63 | const std::string options = CompilerOptionsToString(device, compiler_options); |
| 64 | ProgramDescriptor desc{code, options, use_fingerprints_}; |
| 65 | auto it = programs_.find(desc); |
| 66 | if (it != programs_.end()) { |
| 67 | RETURN_IF_ERROR(result->CreateFromProgram(it->second, function_name)); |
| 68 | return OkStatus(); |
| 69 | } |
| 70 | |
| 71 | CLProgram program; |
| 72 | RETURN_IF_ERROR(CreateCLProgram(code, options, context, device, &program)); |
| 73 | RETURN_IF_ERROR(result->CreateFromProgram(program, function_name)); |
| 74 | programs_.insert(std::make_pair(std::move(desc), std::move(program))); |
| 75 | return OkStatus(); |
| 76 | } |
| 77 | |
| 78 | Status ProgramCache::GetOrCreateCLKernel(const std::string& code, |
| 79 | const std::string& function_name, |
no test coverage detected