| 138 | } |
| 139 | |
| 140 | Status CreateCLProgram(const std::string& code, |
| 141 | const std::string& compiler_options, |
| 142 | const CLContext& context, const CLDevice& device, |
| 143 | CLProgram* result) { |
| 144 | int error_code; |
| 145 | const char* source = code.c_str(); |
| 146 | |
| 147 | cl_program program = clCreateProgramWithSource(context.context(), 1, &source, |
| 148 | nullptr, &error_code); |
| 149 | if (!program || error_code != CL_SUCCESS) { |
| 150 | return UnknownError(absl::StrCat("Failed to create compute program - ", |
| 151 | CLErrorCodeToString(error_code))); |
| 152 | } |
| 153 | |
| 154 | *result = CLProgram(program, device.id()); |
| 155 | RETURN_IF_ERROR(BuildProgram(program, device, compiler_options)); |
| 156 | return OkStatus(); |
| 157 | } |
| 158 | |
| 159 | Status CreateCLProgramFromBinary(const CLContext& context, |
| 160 | const CLDevice& device, |
no test coverage detected