MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateFromProgram

Method CreateFromProgram

tensorflow/lite/delegates/gpu/cl/cl_kernel.cc:106–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106Status CLKernel::CreateFromProgram(const CLProgram& program,
107 const std::string& function_name) {
108 int error_code;
109 function_name_ = function_name;
110 kernel_ =
111 clCreateKernel(program.program(), function_name.c_str(), &error_code);
112 if (!kernel_ || error_code != CL_SUCCESS) {
113 kernel_ = nullptr;
114 return UnknownError(absl::StrCat("Failed to create ", function_name,
115 CLErrorCodeToString(error_code)));
116 }
117
118 program_ = program.program();
119 clRetainProgram(program_);
120
121 RETURN_IF_ERROR(GetKernelPrivateMemorySize(kernel_, program.GetDeviceId(),
122 &private_memory_size_));
123 RETURN_IF_ERROR(GetKernelMaxWorkGroupSize(kernel_, program.GetDeviceId(),
124 &max_work_group_size_));
125 return OkStatus();
126}
127
128Status CLKernel::SetMemory(int index, cl_mem memory) {
129 return SetBytes(index, &memory, sizeof(cl_mem));

Callers 1

GetOrCreateCLKernelMethod · 0.80

Calls 9

CLErrorCodeToStringFunction · 0.85
OkStatusFunction · 0.85
programMethod · 0.80
c_strMethod · 0.80
UnknownErrorFunction · 0.50
StrCatFunction · 0.50
GetDeviceIdMethod · 0.45

Tested by

no test coverage detected