Support OpenCL 1.1 properly by forcing buffer usage in kernels that don't check .SupportsImageBuffer()

This commit is contained in:
Oskar Flordal 2020-12-23 13:12:30 +00:00
parent d7b24ab06f
commit 2332f90301
3 changed files with 3 additions and 3 deletions

View File

@ -236,7 +236,7 @@ std::string GenerateDepthwiseConvolutionCode(
GPUOperation CreateDepthwiseConvolution2D( GPUOperation CreateDepthwiseConvolution2D(
const GpuInfo& gpu_info, const OperationDef& definition, const GpuInfo& gpu_info, const OperationDef& definition,
const DepthwiseConvolution2DAttributes& attr) { const DepthwiseConvolution2DAttributes& attr) {
bool weights_are_buffer = gpu_info.IsMali(); bool weights_are_buffer = !gpu_info.SupportsImageBuffer() || gpu_info.IsMali();
GPUOperation op(definition); GPUOperation op(definition);
op.args_.AddInt("kernel_size_x", attr.weights.shape.w); op.args_.AddInt("kernel_size_x", attr.weights.shape.w);
op.args_.AddInt("stride_x", attr.strides.w); op.args_.AddInt("stride_x", attr.strides.w);

View File

@ -312,7 +312,7 @@ bool IsDepthwiseConv3x3Supported(const DepthwiseConvolution2DAttributes& attr) {
DepthwiseConv3x3 CreateDepthwiseConv3x3( DepthwiseConv3x3 CreateDepthwiseConv3x3(
const GpuInfo& gpu_info, const OperationDef& definition, const GpuInfo& gpu_info, const OperationDef& definition,
const DepthwiseConvolution2DAttributes& attr) { const DepthwiseConvolution2DAttributes& attr) {
bool weights_are_buffer = gpu_info.IsPowerVR() || gpu_info.IsMali(); bool weights_are_buffer = !gpu_info.SupportsImageBuffer() || gpu_info.IsPowerVR() || gpu_info.IsMali();
bool local_mem_uploads = weights_are_buffer && gpu_info.IsPowerVR(); bool local_mem_uploads = weights_are_buffer && gpu_info.IsPowerVR();
DepthwiseConv3x3 result(definition, weights_are_buffer, local_mem_uploads, DepthwiseConv3x3 result(definition, weights_are_buffer, local_mem_uploads,
gpu_info); gpu_info);

View File

@ -155,7 +155,7 @@ FullyConnected CreateFullyConnected(const GpuInfo& gpu_info,
result.UploadWeights(attr.weights, UseBufferForWeights(gpu_info)); result.UploadWeights(attr.weights, UseBufferForWeights(gpu_info));
TensorLinearDescriptor desc; TensorLinearDescriptor desc;
desc.storage_type = LinearStorageType::TEXTURE_2D; desc.storage_type = gpu_info.SupportsImageBuffer() ? LinearStorageType::TEXTURE_2D : LinearStorageType::BUFFER;
desc.element_type = definition.GetDataType(); desc.element_type = definition.GetDataType();
desc.UploadLinearData(attr.bias); desc.UploadLinearData(attr.bias);
result.args_.AddObject( result.args_.AddObject(