P4 to Git Change 2055228 by jujiang@JJ-HIP on 2020/01/10 16:36:01
SWDEV-205925 - Update HIP texture APIs for issue in hipTexRefSetAddress in HIP/PAL on Windows
-Update HIP texture function parameter to use hipChannelFormatDesc& desc
http://ocltc.amd.com/reviews/r/18456/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#33 edit
[ROCm/clr commit: ec3fbfd60c]
Этот коммит содержится в:
@@ -431,7 +431,7 @@ hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc,
|
||||
|
||||
hipError_t ihipBindTexture(cl_mem_object_type type,
|
||||
size_t* offset, textureReference* tex, const void* devPtr,
|
||||
const hipChannelFormatDesc* desc, size_t width, size_t height,
|
||||
const hipChannelFormatDesc& desc, size_t width, size_t height,
|
||||
size_t pitch) {
|
||||
if (tex == nullptr) {
|
||||
return hipErrorInvalidImage;
|
||||
@@ -443,9 +443,9 @@ hipError_t ihipBindTexture(cl_mem_object_type type,
|
||||
size_t depth = 0;
|
||||
size_t slicePitch = 0;
|
||||
|
||||
getChannelOrderAndType(*desc, hipReadModeElementType,
|
||||
getChannelOrderAndType(desc, hipReadModeElementType,
|
||||
&image_format.image_channel_order, &image_format.image_channel_data_type);
|
||||
getByteSizeFromChannelFormatKind(desc->f, &byteSize);
|
||||
getByteSizeFromChannelFormatKind(desc.f, &byteSize);
|
||||
const amd::Image::Format imageFormat(image_format);
|
||||
amd::Memory* memory = getMemoryObject(devPtr, *offset);
|
||||
|
||||
@@ -482,13 +482,13 @@ hipError_t ihipBindTexture(cl_mem_object_type type,
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
resDesc.resType = hipResourceTypeLinear;
|
||||
resDesc.res.linear.devPtr = const_cast<void*>(devPtr);
|
||||
resDesc.res.linear.desc = *desc;
|
||||
resDesc.res.linear.desc = desc;
|
||||
resDesc.res.linear.sizeInBytes = image->getSize();
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
resDesc.resType = hipResourceTypePitch2D;
|
||||
resDesc.res.pitch2D.devPtr = const_cast<void*>(devPtr);
|
||||
resDesc.res.pitch2D.desc = *desc;
|
||||
resDesc.res.pitch2D.desc = desc;
|
||||
resDesc.res.pitch2D.width = width;
|
||||
resDesc.res.pitch2D.height = height;
|
||||
resDesc.res.pitch2D.pitchInBytes = pitch;
|
||||
@@ -496,7 +496,7 @@ hipError_t ihipBindTexture(cl_mem_object_type type,
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
resDesc.resType = hipResourceTypeArray;
|
||||
resDesc.res.array.array = (hipArray*)malloc(sizeof(hipArray));
|
||||
resDesc.res.array.array->desc = *desc;
|
||||
resDesc.res.array.array->desc = desc;
|
||||
resDesc.res.array.array->width = width;
|
||||
resDesc.res.array.array->height = height;
|
||||
resDesc.res.array.array->depth = depth;
|
||||
@@ -534,7 +534,7 @@ hipError_t hipBindTexture(size_t* offset, textureReference* tex, const void* dev
|
||||
&image_format.image_channel_order, &image_format.image_channel_data_type);
|
||||
const amd::Image::Format imageFormat(image_format);
|
||||
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, desc, size / imageFormat.getElementSize(), 1, size));
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, *desc, size / imageFormat.getElementSize(), 1, size));
|
||||
}
|
||||
|
||||
hipError_t hipBindTexture2D(size_t* offset, textureReference* tex, const void* devPtr,
|
||||
@@ -542,7 +542,7 @@ hipError_t hipBindTexture2D(size_t* offset, textureReference* tex, const void* d
|
||||
size_t pitch) {
|
||||
HIP_INIT_API(NONE, offset, tex, devPtr, desc, width, height, pitch);
|
||||
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, offset, tex, devPtr, desc, width, height, pitch));
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, offset, tex, devPtr, *desc, width, height, pitch));
|
||||
}
|
||||
|
||||
hipError_t hipBindTextureToArray(textureReference* tex, hipArray_const_t array,
|
||||
@@ -561,7 +561,7 @@ hipError_t ihipBindTextureImpl(TlsData* tls, int dim, enum hipTextureReadMode re
|
||||
|
||||
assert(1 == dim);
|
||||
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, desc, size, 1, 0));
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, *desc, size, 1, 0));
|
||||
}
|
||||
|
||||
hipError_t ihipBindTextureToArrayImpl(TlsData* tls, int dim, enum hipTextureReadMode readMode,
|
||||
@@ -588,7 +588,7 @@ hipError_t ihipBindTextureToArrayImpl(TlsData* tls, int dim, enum hipTextureRead
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
HIP_RETURN(ihipBindTexture(clType, &offset, tex, array->data, &desc, array->width,
|
||||
HIP_RETURN(ihipBindTexture(clType, &offset, tex, array->data, desc, array->width,
|
||||
array->height, array->depth));
|
||||
}
|
||||
|
||||
@@ -754,7 +754,7 @@ hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsi
|
||||
default:
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
HIP_RETURN(ihipBindTexture(clType, &offset, tex, array->data, &array->desc, array->width,
|
||||
HIP_RETURN(ihipBindTexture(clType, &offset, tex, array->data, array->desc, array->width,
|
||||
array->height, array->depth));
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDevicep
|
||||
&image_format.image_channel_order, &image_format.image_channel_data_type);
|
||||
const amd::Image::Format imageFormat(image_format);
|
||||
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, &tex->channelDesc, size / imageFormat.getElementSize(), 1, size));
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE1D, offset, tex, devPtr, tex->channelDesc, size / imageFormat.getElementSize(), 1, size));
|
||||
}
|
||||
|
||||
hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc,
|
||||
@@ -804,5 +804,5 @@ hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPT
|
||||
}
|
||||
|
||||
size_t offset;
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, &offset, tex, devPtr, &tex->channelDesc, desc->Width, desc->Height, pitch));
|
||||
HIP_RETURN(ihipBindTexture(CL_MEM_OBJECT_IMAGE2D, &offset, tex, devPtr, tex->channelDesc, desc->Width, desc->Height, pitch));
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user