SWDEV-229731 - [Lnx][Rocm][Navi]Support images in full Opencl Conformance tests

1. Enable pitch workaround
2. When we use copy image, we don't need to create the custom pitch image
3. wrtBackImageBuffer_ stores device memory object, not amd image object.

Tests:
conformance kernel read / write test pass with this code change.

Change-Id: I7dca3127adde6ac83e78dd270a2256ebed55c60d


[ROCm/clr commit: 43b9863e17]
Este commit está contenido en:
Alex Xie
2020-04-01 18:20:21 -04:00
cometido por AlexBin Xie
padre cd4472490d
commit 8d5b686e8b
Se han modificado 3 ficheros con 18 adiciones y 13 borrados
+15 -11
Ver fichero
@@ -1138,22 +1138,26 @@ bool Image::createView(const Memory& parent) {
hsa_status_t status;
if (linearLayout) {
size_t rowPitch;
amd::Image& ownerImage = *owner()->asImage();
size_t elementSize = ownerImage.getImageFormat().getElementSize();
// First get the row pitch in pixels
if (ownerImage.getRowPitch() != 0) {
rowPitch = ownerImage.getRowPitch() / elementSize;
if (nullptr != copyImageBuffer_ ) {
status = HSA_STATUS_SUCCESS;
} else {
rowPitch = ownerImage.getWidth();
}
size_t rowPitch;
amd::Image& ownerImage = *owner()->asImage();
size_t elementSize = ownerImage.getImageFormat().getElementSize();
// First get the row pitch in pixels
if (ownerImage.getRowPitch() != 0) {
rowPitch = ownerImage.getRowPitch() / elementSize;
} else {
rowPitch = ownerImage.getWidth();
}
// Make sure the row pitch is aligned to pixels
rowPitch = elementSize * amd::alignUp(rowPitch, (dev().info().imagePitchAlignment_ / elementSize));
// Make sure the row pitch is aligned to pixels
rowPitch = elementSize * amd::alignUp(rowPitch, (dev().info().imagePitchAlignment_ / elementSize));
status = hsa_ext_image_create_with_layout(
status = hsa_ext_image_create_with_layout(
dev().getBackendDevice(), &imageDescriptor_, deviceMemory_, permission_,
HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR, rowPitch, 0, &hsaImageObject_);
}
} else if (kind_ == MEMORY_KIND_INTEROP) {
amdImageDesc_ = static_cast<Image*>(parent.owner()->getDeviceMemory(dev()))->amdImageDesc_;
status = hsa_amd_image_create(dev().getBackendDevice(), &imageDescriptor_, amdImageDesc_,
+2 -1
Ver fichero
@@ -145,8 +145,9 @@ bool Settings::create(bool fullProfile, int gfxipVersion, bool coop_groups) {
if (gfxipVersion >= 1000) {
enableWave32Mode_ = true;
enableWgpMode_ = GPU_ENABLE_WGP_MODE;
if (gfxipVersion == 1001) {
if (gfxipVersion >= 1010) {
// GFX10.1 HW doesn't support custom pitch. Enable double copy workaround
// TODO: This should be updated when ROCr support custom pitch
imageBufferWar_ = GPU_IMAGE_BUFFER_WAR;
}
}
+1 -1
Ver fichero
@@ -366,7 +366,7 @@ bool VirtualGPU::processMemObjects(const amd::Kernel& kernel, const_address para
// If it's not a read only resource, then runtime has to write back
if (!desc.info_.readOnly_) {
wrtBackImageBuffer_.push_back(devCpImg);
wrtBackImageBuffer_.push_back(mem->getDeviceMemory(dev()));
imageBufferWrtBack_ = true;
}
}