Skip to content

Commit 3ee2959

Browse files
[Cherry-pick][OpenCL] Fix select built-in function (#5757)
1 parent 3c7b06f commit 3ee2959

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

lite/backends/opencl/cl_kernel/cl_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ __constant sampler_t SAMPLER =
9393
inline CL_DTYPE activation(CL_DTYPE in, CL_DTYPE prelu_alpha) {
9494
CL_DTYPE output = in;
9595
#ifdef PRELU
96-
output = select(prelu_alpha * in, in, in >= (CL_DTYPE)0);
96+
output = select(prelu_alpha * in, in, (ushort)(isgreaterequal(in, 0)));
9797
#endif
9898

9999
#ifdef RELU

lite/backends/opencl/cl_runtime.cc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ bool CLRuntime::CheckFromPrecompiledBinary(const std::string& program_key,
215215
"and you have Write&Read permission. Jump to build program "
216216
"from source.";
217217
} else {
218+
LOG(INFO) << "Load opencl kernel bin file: " << bin_file;
218219
ret = Deserialize(bin_file, &programs_precompiled_binary_);
219220
CHECK(ret) << "Deserialize failed.";
220221

@@ -236,9 +237,9 @@ bool CLRuntime::CheckFromPrecompiledBinary(const std::string& program_key,
236237
} else if (host::memcmp(((sn_iter->second)[0]).data(),
237238
GetSN(build_option).data(),
238239
GetSN(build_option).length())) {
239-
LOG(INFO) << "size of sn_info: " << ((sn_iter->second)[0]).size();
240-
LOG(INFO) << "size of GetSN: " << GetSN(build_option).length();
241-
LOG(INFO) << "GetSN: " << GetSN(build_option);
240+
LOG(INFO) << "size of sn_info: " << ((sn_iter->second)[0]).size()
241+
<< "\nsize of GetSN: " << GetSN(build_option).length()
242+
<< "\nGetSN: " << GetSN(build_option);
242243
LOG(WARNING) << "The precompiled OpenCL binary[" << bin_file
243244
<< "] is invalid!";
244245
delete_bin_flag = true;
@@ -264,19 +265,17 @@ bool CLRuntime::CheckFromPrecompiledBinary(const std::string& program_key,
264265
std::unique_ptr<cl::Program> ptr(new cl::Program(program));
265266
programs_[prog_key] = std::move(ptr);
266267
}
267-
}
268268

269-
auto it = programs_.find(program_key);
270-
if (it != programs_.end()) {
271-
#ifdef LITE_WITH_LOG
272-
VLOG(3) << " --- program -> " << program_key
273-
<< " has been built in binary --- ";
274-
#endif
275-
gotten_bin_flag_ = true;
276-
ret = true;
277-
} else {
278-
delete_bin_flag = true;
279-
// Jump to build from source
269+
auto it = programs_.find(program_key);
270+
if (it != programs_.end()) {
271+
VLOG(3) << " --- program -> " << program_key
272+
<< " has been built in binary --- ";
273+
gotten_bin_flag_ = true;
274+
ret = true;
275+
} else {
276+
delete_bin_flag = true;
277+
// Jump to build from source
278+
}
280279
}
281280
}
282281

0 commit comments

Comments
 (0)