MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / create_program_from_bc

Function create_program_from_bc

test_conformance/spir/run_services.cpp:184–207  ·  view source on GitHub ↗

Create program from the BC source file */

Source from the content-addressed store, hash-verified

182 Create program from the BC source file
183 */
184cl_program create_program_from_bc (cl_context context, const std::string& file_name)
185{
186 cl_int load_error = CL_SUCCESS;
187 cl_int error;
188 size_t binary_size;
189 BufferOwningPtr<const unsigned char> binary(load_file_bc(file_name, &binary_size));
190 const unsigned char* ptr = binary;
191
192 cl_device_id device = get_context_device(context);
193 cl_program program = clCreateProgramWithBinary( context, 1, &device, &binary_size, &ptr, &load_error, &error );
194
195
196 if( program == NULL || error != CL_SUCCESS )
197 {
198 throw Exceptions::TestError("clCreateProgramWithBinary failed: Unable to load valid program binary\n", error);
199 }
200
201 if( load_error != CL_SUCCESS )
202 {
203 throw Exceptions::TestError("clCreateProgramWithBinary failed: Unable to load valid device binary into program\n", load_error);
204 }
205
206 return program;
207}
208
209/**
210 Creates the kernel with the given name from the given program.

Callers 5

runBuildTestMethod · 0.85
compareResultMethod · 0.85
test_enum_valuesFunction · 0.85
test_kernel_attributesFunction · 0.85
test_binary_typeFunction · 0.85

Calls 3

load_file_bcFunction · 0.85
get_context_deviceFunction · 0.85
TestErrorClass · 0.85

Tested by 4

runBuildTestMethod · 0.68
test_enum_valuesFunction · 0.68
test_kernel_attributesFunction · 0.68
test_binary_typeFunction · 0.68