mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Image compression checks
Signed-off-by: Sebastian Luzynski <sebastian.jozef.luzynski@intel.com> Related-To: NEO-6102
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
174c1dfe64
commit
ce78bab177
@@ -23,6 +23,7 @@
|
||||
#include "opencl/source/cl_device/cl_device_get_cap.inl"
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/get_info_status_mapper.h"
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
@@ -196,11 +197,13 @@ Image *Image::create(Context *context,
|
||||
|
||||
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->surfaceFormat.ImageElementSizeInBytes;
|
||||
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
|
||||
auto &clHwHelper = ClHwHelper::get(context->getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
imgInfo.linearStorage = !defaultHwHelper.tilingAllowed(context->isSharedContext, Image::isImage1d(*imageDesc),
|
||||
memoryProperties.flags.forceLinearStorage);
|
||||
imgInfo.preferRenderCompression = MemObjHelper::isSuitableForRenderCompression(!imgInfo.linearStorage, memoryProperties,
|
||||
*context, true);
|
||||
imgInfo.preferRenderCompression &= !Image::isFormatRedescribable(surfaceFormat->OCLImageFormat);
|
||||
imgInfo.preferRenderCompression &= clHwHelper.allowImageCompression(surfaceFormat->OCLImageFormat);
|
||||
imgInfo.preferRenderCompression &= !clHwHelper.isFormatRedescribable(surfaceFormat->OCLImageFormat);
|
||||
|
||||
if (!context->getDevice(0)->getSharedDeviceInfo().imageSupport && !imgInfo.linearStorage) {
|
||||
errcodeRet = CL_INVALID_OPERATION;
|
||||
@@ -1001,19 +1004,6 @@ static const uint32_t redescribeTableBytes[] = {
|
||||
7 // {CL_RGBA, CL_UNSIGNED_INT32} 16 byte
|
||||
};
|
||||
|
||||
bool Image::isFormatRedescribable(cl_image_format format) {
|
||||
const ArrayRef<const ClSurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
for (auto indexInRedescribeTable = 0u; indexInRedescribeTable < sizeof(redescribeTableBytes) / sizeof(uint32_t); indexInRedescribeTable++) {
|
||||
const uint32_t formatIndex = redescribeTableBytes[indexInRedescribeTable];
|
||||
const cl_image_format nonRedescribableFormat = readWriteSurfaceFormats[formatIndex].OCLImageFormat;
|
||||
if (nonRedescribableFormat.image_channel_data_type == format.image_channel_data_type &&
|
||||
nonRedescribableFormat.image_channel_order == format.image_channel_order) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Image *Image::redescribe() {
|
||||
const uint32_t bytesPerPixel = this->surfaceFormatInfo.surfaceFormat.NumChannels * surfaceFormatInfo.surfaceFormat.PerChannelSizeInBytes;
|
||||
const uint32_t exponent = Math::log2(bytesPerPixel);
|
||||
|
||||
@@ -147,7 +147,6 @@ class Image : public MemObj {
|
||||
void transferDataToHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override;
|
||||
void transferDataFromHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override;
|
||||
|
||||
static bool isFormatRedescribable(cl_image_format format);
|
||||
Image *redescribe();
|
||||
Image *redescribeFillImage();
|
||||
ImageCreatFunc createFunction;
|
||||
|
||||
Reference in New Issue
Block a user