Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPD][OPENCL] opencl support x86 mat #1593

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions source/tnn/device/opencl/opencl_blob_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ Status OpenCLBlobConverterAcc::CreateConvertUnit(OpenCLExecuteUnit &unit, Mat &m
if (convert_to_mat) {
program_name = "convert_to_mat";
//DEVICE_NAIVE AND DEVICE_ARM is same for memory type.
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType()) {
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType() ||
DEVICE_X86 == mat.GetDeviceType()) {
Status ret = GetConvertToMatKernelName(mat, kernel_name, program_name);
if (ret != TNN_OK) {
return ret;
Expand All @@ -403,7 +404,8 @@ Status OpenCLBlobConverterAcc::CreateConvertUnit(OpenCLExecuteUnit &unit, Mat &m
}
} else {
program_name = "convert_from_mat";
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType()) {
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType() ||
DEVICE_X86 == mat.GetDeviceType()) {
Status ret = GetConvertFromMatKernelName(mat, kernel_name, program_name);
if (ret != TNN_OK) {
return ret;
Expand Down Expand Up @@ -445,7 +447,8 @@ Status OpenCLBlobConverterAcc::SetConvertArgs(OpenCLExecuteUnit &unit, Mat &mat,
(DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType())) {
idx = SetExecuteUnit2DSizeInfoCNH4(unit, dims);
} else if (blob_->GetBlobDesc().data_format == DATA_FORMAT_NCHW &&
(DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType())) {
(DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType() ||
DEVICE_X86 == mat.GetDeviceType())) {
idx = SetExecuteUnit2DSizeInfoNCHW(unit, dims);
} else {
return Status(TNNERR_PARAM_ERR, "blob data format not support yet");
Expand All @@ -459,7 +462,7 @@ Status OpenCLBlobConverterAcc::SetConvertArgs(OpenCLExecuteUnit &unit, Mat &mat,
}

cl_int cl_ret;
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType()) {
if (DEVICE_NAIVE == mat.GetDeviceType() || DEVICE_ARM == mat.GetDeviceType() || DEVICE_X86 == mat.GetDeviceType()) {
if (blob_->GetBlobDesc().data_format != DATA_FORMAT_NCHW) {
cl_ret = unit.ocl_kernel.setArg(idx++, *image);
CHECK_CL_SUCCESS(cl_ret);
Expand Down