mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Improve aub tests
skip tests in fixture's setup instead of early returning from test body Related-To: NEO-3919 Change-Id: Ic61d8857114121bfa6153852fa1046b0ddbf5925 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
ab8d73f243
commit
a988607cc6
@@ -26,11 +26,11 @@ struct AUBCopyImage
|
||||
typedef AUBCommandStreamFixture CommandStreamFixture;
|
||||
|
||||
void SetUp() override {
|
||||
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
|
||||
CommandStreamFixture::SetUp(pCmdQ);
|
||||
if (!pDevice->getDeviceInfo().imageSupport) {
|
||||
if (!platformDevices[0]->capabilityTable.supportsImages) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
|
||||
CommandStreamFixture::SetUp(pCmdQ);
|
||||
context = std::make_unique<MockContext>(pDevice);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,12 @@ struct AubFillImage
|
||||
if (!(platformDevices[0]->capabilityTable.supportsImages)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto dataType = std::get<0>(GetParam()).type;
|
||||
auto channelOrder = std::get<1>(GetParam());
|
||||
if (dataType != CL_UNORM_INT8 && (channelOrder == CL_sRGBA || channelOrder == CL_sBGRA)) {
|
||||
//sRGBA and sBGRA support only unorm int8 type
|
||||
GTEST_SKIP();
|
||||
}
|
||||
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
|
||||
CommandStreamFixture::SetUp(pCmdQ);
|
||||
|
||||
@@ -170,8 +176,6 @@ HWTEST_P(AubFillImage, simple) {
|
||||
size_t elementSize = perChannelDataSize * numChannels;
|
||||
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
if (imageFormat.image_channel_data_type != CL_UNORM_INT8 && (imageFormat.image_channel_order == CL_sRGBA || imageFormat.image_channel_order == CL_sBGRA))
|
||||
return; //sRGBA and sBGRA support only unorm int8 type, so other cases will return from the test with a success
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
image.reset(Image::create(
|
||||
|
||||
@@ -20,21 +20,18 @@ class AUBParentKernelFixture : public CommandEnqueueAUBFixture,
|
||||
using HelloWorldKernelFixture::SetUp;
|
||||
|
||||
void SetUp() {
|
||||
if (platformDevices[0]->capabilityTable.clVersionSupport < 20) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
CommandEnqueueAUBFixture::SetUp();
|
||||
ASSERT_NE(nullptr, pDevice);
|
||||
|
||||
std::string options("");
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
options = "-cl-std=CL2.0";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
HelloWorldKernelFixture::SetUp(pDevice, programFile, kernelName, options.c_str());
|
||||
HelloWorldKernelFixture::SetUp(pDevice, programFile, kernelName, "-cl-std=CL2.0");
|
||||
}
|
||||
void TearDown() {
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
HelloWorldKernelFixture::TearDown();
|
||||
if (IsSkipped()) {
|
||||
return;
|
||||
}
|
||||
HelloWorldKernelFixture::TearDown();
|
||||
CommandEnqueueAUBFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,29 +17,28 @@ using namespace NEO;
|
||||
typedef AUBParentKernelFixture GEN11AUBParentKernelFixture;
|
||||
|
||||
GEN11TEST_F(GEN11AUBParentKernelFixture, EnqueueParentKernel) {
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
cl_image_format imageFormat;
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
@@ -52,65 +51,64 @@ GEN11TEST_F(GEN11AUBParentKernelFixture, EnqueueParentKernel) {
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
desc.image_row_pitch = 0;
|
||||
desc.image_slice_pitch = 0;
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
|
||||
pCmdQ->finish();
|
||||
pCmdQ->finish();
|
||||
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
|
||||
@@ -17,29 +17,28 @@ using namespace NEO;
|
||||
typedef AUBParentKernelFixture GEN12LPAUBParentKernelFixture;
|
||||
|
||||
GEN12LPTEST_F(GEN12LPAUBParentKernelFixture, EnqueueParentKernel) {
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
cl_image_format imageFormat;
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
@@ -52,65 +51,64 @@ GEN12LPTEST_F(GEN12LPAUBParentKernelFixture, EnqueueParentKernel) {
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
desc.image_row_pitch = 0;
|
||||
desc.image_slice_pitch = 0;
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
|
||||
pCmdQ->finish();
|
||||
pCmdQ->finish();
|
||||
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
|
||||
@@ -19,93 +19,91 @@ using namespace NEO;
|
||||
typedef AUBParentKernelFixture GEN8AUBParentKernelFixture;
|
||||
|
||||
GEN8TEST_F(GEN8AUBParentKernelFixture, EnqueueParentKernel) {
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
|
||||
std::unique_ptr<DeviceQueue> devQueue(DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal));
|
||||
std::unique_ptr<DeviceQueue> devQueue(DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal));
|
||||
|
||||
auto &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
auto &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
|
||||
cl_image_format imageFormat;
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
cl_image_format imageFormat;
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
|
||||
cl_image_desc desc = {0};
|
||||
desc.image_array_size = 0;
|
||||
desc.image_depth = 1;
|
||||
desc.image_height = 4;
|
||||
desc.image_width = 4;
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
desc.image_row_pitch = 0;
|
||||
desc.image_slice_pitch = 0;
|
||||
cl_image_desc desc = {0};
|
||||
desc.image_array_size = 0;
|
||||
desc.image_depth = 1;
|
||||
desc.image_height = 4;
|
||||
desc.image_width = 4;
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
desc.image_row_pitch = 0;
|
||||
desc.image_slice_pitch = 0;
|
||||
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
std::unique_ptr<Image> image(Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal));
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
std::unique_ptr<Image> image(Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal));
|
||||
|
||||
std::unique_ptr<Buffer> buffer(BufferHelper<BufferUseHostPtr<>>::create(pContext));
|
||||
std::unique_ptr<Buffer> buffer(BufferHelper<BufferUseHostPtr<>>::create(pContext));
|
||||
|
||||
cl_mem bufferMem = buffer.get();
|
||||
cl_mem imageMem = image.get();
|
||||
cl_mem bufferMem = buffer.get();
|
||||
cl_mem imageMem = image.get();
|
||||
|
||||
std::unique_ptr<Sampler> sampler(Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal));
|
||||
std::unique_ptr<Sampler> sampler(Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal));
|
||||
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
|
||||
pCmdQ->finish();
|
||||
pCmdQ->finish();
|
||||
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
}
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
}
|
||||
|
||||
@@ -15,29 +15,28 @@
|
||||
using namespace NEO;
|
||||
|
||||
GEN9TEST_F(AUBParentKernelFixture, EnqueueParentKernel) {
|
||||
if (pDevice->getSupportedClVersion() >= 20) {
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
ASSERT_TRUE(pKernel->isParentKernel);
|
||||
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
|
||||
0, 0};
|
||||
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
DeviceQueue *devQueue = DeviceQueue::create(
|
||||
&pCmdQ->getContext(),
|
||||
pDevice,
|
||||
properties[0],
|
||||
retVal);
|
||||
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
BuiltIns &builtIns = *pDevice->getExecutionEnvironment()->getBuiltIns();
|
||||
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
|
||||
// Aub execution takes huge time for bigger GWS
|
||||
scheduler.setGws(24);
|
||||
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
size_t offset[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
size_t lws[3] = {1, 1, 1};
|
||||
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
cl_image_format imageFormat;
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
@@ -50,65 +49,64 @@ GEN9TEST_F(AUBParentKernelFixture, EnqueueParentKernel) {
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
desc.image_row_pitch = 0;
|
||||
desc.image_slice_pitch = 0;
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
|
||||
Image *image = Image::create(
|
||||
pContext,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&desc,
|
||||
nullptr,
|
||||
retVal);
|
||||
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
|
||||
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
cl_mem bufferMem = buffer;
|
||||
cl_mem imageMem = image;
|
||||
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
auto sampler = Sampler::create(
|
||||
pContext,
|
||||
CL_TRUE,
|
||||
CL_ADDRESS_NONE,
|
||||
CL_FILTER_LINEAR,
|
||||
retVal);
|
||||
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
uint64_t argScalar = 2;
|
||||
pKernel->setArg(
|
||||
3,
|
||||
sizeof(uint64_t),
|
||||
&argScalar);
|
||||
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
pKernel->setArg(
|
||||
2,
|
||||
sizeof(cl_mem),
|
||||
&bufferMem);
|
||||
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
pKernel->setArg(
|
||||
1,
|
||||
sizeof(cl_mem),
|
||||
&imageMem);
|
||||
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
pKernel->setArg(
|
||||
0,
|
||||
sizeof(cl_sampler),
|
||||
&sampler);
|
||||
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
|
||||
|
||||
pCmdQ->finish();
|
||||
pCmdQ->finish();
|
||||
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
uint32_t expectedNumberOfEnqueues = 1;
|
||||
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
|
||||
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
|
||||
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
delete devQueue;
|
||||
delete image;
|
||||
delete buffer;
|
||||
delete sampler;
|
||||
}
|
||||
|
||||
@@ -178,21 +178,26 @@ struct AUBCreateImageHostPtr : public AUBCreateImage,
|
||||
if (!(platformDevices[0]->capabilityTable.supportsImages)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
flags = GetParam();
|
||||
AUBCreateImage::SetUp();
|
||||
}
|
||||
void TearDown() override {
|
||||
AUBCreateImage::TearDown();
|
||||
}
|
||||
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
static cl_mem_flags hostPtrFlags[] = {
|
||||
static cl_mem_flags useHostPtrFlags[] = {
|
||||
0 | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_HOST_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_HOST_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_HOST_NO_ACCESS | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_HOST_NO_ACCESS | CL_MEM_USE_HOST_PTR};
|
||||
|
||||
static cl_mem_flags copyHostPtrFlags[] = {
|
||||
0 | CL_MEM_COPY_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
|
||||
CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
@@ -201,177 +206,179 @@ static cl_mem_flags hostPtrFlags[] = {
|
||||
CL_MEM_HOST_WRITE_ONLY | CL_MEM_COPY_HOST_PTR,
|
||||
CL_MEM_HOST_NO_ACCESS | CL_MEM_COPY_HOST_PTR};
|
||||
|
||||
using UseHostPtrTest = AUBCreateImageHostPtr;
|
||||
using CopyHostPtrTest = AUBCreateImageHostPtr;
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
CreateImgTest_HostPtr,
|
||||
AUBCreateImageHostPtr,
|
||||
testing::ValuesIn(hostPtrFlags));
|
||||
CreateImgTest_UseHostPtr,
|
||||
UseHostPtrTest,
|
||||
testing::ValuesIn(useHostPtrFlags));
|
||||
|
||||
HWTEST_P(AUBCreateImageHostPtr, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFlagHasProperRowPitchSet) {
|
||||
auto flags = GetParam();
|
||||
if (flags & CL_MEM_COPY_HOST_PTR) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
CreateImgTest_CopyHostPtr,
|
||||
CopyHostPtrTest,
|
||||
testing::ValuesIn(copyHostPtrFlags));
|
||||
|
||||
MockGmm::queryImgParams(imgInfo);
|
||||
auto lineWidth = imageDesc.image_width * elementSize;
|
||||
auto passedRowPitch = imgInfo.rowPitch * 2;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
HWTEST_P(CopyHostPtrTest, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFlagHasProperRowPitchSet) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
|
||||
char counter = 0;
|
||||
MockGmm::queryImgParams(imgInfo);
|
||||
auto lineWidth = imageDesc.image_width * elementSize;
|
||||
auto passedRowPitch = imgInfo.rowPitch * 2;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
|
||||
char *data = (char *)pHostPtr;
|
||||
auto heightToCopy = imageDesc.image_height;
|
||||
char counter = 0;
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
data[i] = counter++;
|
||||
}
|
||||
char *data = (char *)pHostPtr;
|
||||
auto heightToCopy = imageDesc.image_height;
|
||||
|
||||
data += passedRowPitch;
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
data[i] = counter++;
|
||||
}
|
||||
|
||||
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal));
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
|
||||
EXPECT_EQ(image->getHostPtrRowPitch(), (size_t)passedRowPitch);
|
||||
EXPECT_EQ(image->getSize(), imgInfo.size);
|
||||
EXPECT_EQ(image->getImageDesc().image_slice_pitch, imgInfo.slicePitch);
|
||||
EXPECT_GE(image->getImageDesc().image_slice_pitch, image->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(image->getQPitch(), imgInfo.qPitch);
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
|
||||
//now check if data is properly propagated to image
|
||||
|
||||
heightToCopy = imageDesc.image_height;
|
||||
auto imageStorage = static_cast<uint8_t *>(image->getCpuAddress());
|
||||
data = (char *)pHostPtr;
|
||||
|
||||
uint8_t *readMemory = nullptr;
|
||||
bool isGpuCopy = image->isTiledAllocation() || !MemoryPool::isSystemMemoryPool(image->getGraphicsAllocation()->getMemoryPool());
|
||||
if (isGpuCopy) {
|
||||
readMemory = new uint8_t[testImageDimensions * testImageDimensions * elementSize * 4];
|
||||
size_t imgOrigin[] = {0, 0, 0};
|
||||
size_t imgRegion[] = {imageDesc.image_width, imageDesc.image_height, imageDesc.image_depth ? imageDesc.image_depth : 1};
|
||||
retVal = pCmdQ->enqueueReadImage(image.get(), CL_FALSE, imgOrigin, imgRegion, 0, 0, readMemory, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
retVal = pCmdQ->flush();
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
imageStorage = readMemory;
|
||||
}
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
if (isGpuCopy) {
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>(&imageStorage[i], &data[i], 1);
|
||||
} else {
|
||||
EXPECT_EQ(imageStorage[i], data[i]);
|
||||
}
|
||||
}
|
||||
data += passedRowPitch;
|
||||
imageStorage += lineWidth;
|
||||
}
|
||||
|
||||
if (readMemory)
|
||||
delete readMemory;
|
||||
data += passedRowPitch;
|
||||
}
|
||||
|
||||
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal));
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
|
||||
EXPECT_EQ(image->getHostPtrRowPitch(), (size_t)passedRowPitch);
|
||||
EXPECT_EQ(image->getSize(), imgInfo.size);
|
||||
EXPECT_EQ(image->getImageDesc().image_slice_pitch, imgInfo.slicePitch);
|
||||
EXPECT_GE(image->getImageDesc().image_slice_pitch, image->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(image->getQPitch(), imgInfo.qPitch);
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
|
||||
//now check if data is properly propagated to image
|
||||
|
||||
heightToCopy = imageDesc.image_height;
|
||||
auto imageStorage = static_cast<uint8_t *>(image->getCpuAddress());
|
||||
data = (char *)pHostPtr;
|
||||
|
||||
uint8_t *readMemory = nullptr;
|
||||
bool isGpuCopy = image->isTiledAllocation() || !MemoryPool::isSystemMemoryPool(image->getGraphicsAllocation()->getMemoryPool());
|
||||
if (isGpuCopy) {
|
||||
readMemory = new uint8_t[testImageDimensions * testImageDimensions * elementSize * 4];
|
||||
size_t imgOrigin[] = {0, 0, 0};
|
||||
size_t imgRegion[] = {imageDesc.image_width, imageDesc.image_height, imageDesc.image_depth ? imageDesc.image_depth : 1};
|
||||
retVal = pCmdQ->enqueueReadImage(image.get(), CL_FALSE, imgOrigin, imgRegion, 0, 0, readMemory, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
retVal = pCmdQ->flush();
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
imageStorage = readMemory;
|
||||
}
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
if (isGpuCopy) {
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>(&imageStorage[i], &data[i], 1);
|
||||
} else {
|
||||
EXPECT_EQ(imageStorage[i], data[i]);
|
||||
}
|
||||
}
|
||||
data += passedRowPitch;
|
||||
imageStorage += lineWidth;
|
||||
}
|
||||
|
||||
if (readMemory)
|
||||
delete readMemory;
|
||||
}
|
||||
|
||||
HWTEST_P(AUBCreateImageHostPtr, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuallyVerifyMapImageData) {
|
||||
auto flags = GetParam();
|
||||
if (flags & CL_MEM_USE_HOST_PTR) {
|
||||
imageDesc.image_width = 546;
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
MockGmm::queryImgParams(imgInfo);
|
||||
auto passedRowPitch = imgInfo.rowPitch + 32;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
unsigned char *pUseHostPtr = new unsigned char[passedRowPitch * imageDesc.image_height * elementSize];
|
||||
HWTEST_P(UseHostPtrTest, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuallyVerifyMapImageData) {
|
||||
imageDesc.image_width = 546;
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
MockGmm::queryImgParams(imgInfo);
|
||||
auto passedRowPitch = imgInfo.rowPitch + 32;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
unsigned char *pUseHostPtr = new unsigned char[passedRowPitch * imageDesc.image_height * elementSize];
|
||||
|
||||
char counter = 0;
|
||||
char counter = 0;
|
||||
|
||||
char *data = (char *)pUseHostPtr;
|
||||
auto heightToCopy = imageDesc.image_height;
|
||||
char *data = (char *)pUseHostPtr;
|
||||
auto heightToCopy = imageDesc.image_height;
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
data[i] = counter++;
|
||||
}
|
||||
|
||||
data += passedRowPitch;
|
||||
}
|
||||
image.reset(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&imageDesc,
|
||||
pUseHostPtr,
|
||||
retVal));
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
//now check if data is properly propagated to image
|
||||
auto mapFlags = CL_MAP_READ;
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {imageDesc.image_width, imageDesc.image_height, 1};
|
||||
size_t imageRowPitch = 0;
|
||||
size_t imageSlicePitch = 0;
|
||||
auto ptr = pCmdQ->enqueueMapImage(
|
||||
image.get(),
|
||||
true,
|
||||
mapFlags,
|
||||
origin,
|
||||
region,
|
||||
&imageRowPitch,
|
||||
&imageSlicePitch,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr,
|
||||
retVal);
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(image->getCpuAddress(), ptr);
|
||||
} else {
|
||||
EXPECT_NE(image->getCpuAddress(), ptr);
|
||||
}
|
||||
size_t imageRowPitchRef = 0;
|
||||
image->getImageInfo(CL_IMAGE_ROW_PITCH, sizeof(imageRowPitchRef), &imageRowPitchRef, nullptr);
|
||||
|
||||
// Only ZeroCopy HOST_PTR image has the same row_pitch as the one from map, otherwise mapped ptr may have different row_pitch
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(imageRowPitch, imageRowPitchRef);
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
data[i] = counter++;
|
||||
}
|
||||
|
||||
size_t imageSlicePitchRef = 0;
|
||||
image->getImageInfo(CL_IMAGE_SLICE_PITCH, sizeof(imageSlicePitchRef), &imageSlicePitchRef, nullptr);
|
||||
|
||||
// Only ZeroCopy HOST_PTR image has the same slice_pitch as the one from map, otherwise mapped ptr may have different slice_pitch
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(imageSlicePitch, imageSlicePitchRef);
|
||||
}
|
||||
|
||||
heightToCopy = imageDesc.image_height;
|
||||
char *imageStorage = (char *)ptr;
|
||||
data = (char *)pUseHostPtr;
|
||||
bool isGpuCopy = image->isTiledAllocation() || !MemoryPool::isSystemMemoryPool(image->getGraphicsAllocation()->getMemoryPool());
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
if (isGpuCopy) {
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>(&imageStorage[i], &data[i], 1);
|
||||
} else {
|
||||
EXPECT_EQ(imageStorage[i], data[i]);
|
||||
}
|
||||
}
|
||||
data += passedRowPitch;
|
||||
imageStorage += imageRowPitch;
|
||||
}
|
||||
|
||||
retVal = clEnqueueUnmapMemObject(pCmdQ, image.get(), ptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
delete[] pUseHostPtr;
|
||||
data += passedRowPitch;
|
||||
}
|
||||
image.reset(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
&imageDesc,
|
||||
pUseHostPtr,
|
||||
retVal));
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
//now check if data is properly propagated to image
|
||||
auto mapFlags = CL_MAP_READ;
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {imageDesc.image_width, imageDesc.image_height, 1};
|
||||
size_t imageRowPitch = 0;
|
||||
size_t imageSlicePitch = 0;
|
||||
auto ptr = pCmdQ->enqueueMapImage(
|
||||
image.get(),
|
||||
true,
|
||||
mapFlags,
|
||||
origin,
|
||||
region,
|
||||
&imageRowPitch,
|
||||
&imageSlicePitch,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr,
|
||||
retVal);
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(image->getCpuAddress(), ptr);
|
||||
} else {
|
||||
EXPECT_NE(image->getCpuAddress(), ptr);
|
||||
}
|
||||
size_t imageRowPitchRef = 0;
|
||||
image->getImageInfo(CL_IMAGE_ROW_PITCH, sizeof(imageRowPitchRef), &imageRowPitchRef, nullptr);
|
||||
|
||||
// Only ZeroCopy HOST_PTR image has the same row_pitch as the one from map, otherwise mapped ptr may have different row_pitch
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(imageRowPitch, imageRowPitchRef);
|
||||
}
|
||||
|
||||
size_t imageSlicePitchRef = 0;
|
||||
image->getImageInfo(CL_IMAGE_SLICE_PITCH, sizeof(imageSlicePitchRef), &imageSlicePitchRef, nullptr);
|
||||
|
||||
// Only ZeroCopy HOST_PTR image has the same slice_pitch as the one from map, otherwise mapped ptr may have different slice_pitch
|
||||
if (image->isMemObjZeroCopy()) {
|
||||
EXPECT_EQ(imageSlicePitch, imageSlicePitchRef);
|
||||
}
|
||||
|
||||
heightToCopy = imageDesc.image_height;
|
||||
char *imageStorage = (char *)ptr;
|
||||
data = (char *)pUseHostPtr;
|
||||
bool isGpuCopy = image->isTiledAllocation() || !MemoryPool::isSystemMemoryPool(image->getGraphicsAllocation()->getMemoryPool());
|
||||
|
||||
while (heightToCopy--) {
|
||||
for (unsigned int i = 0; i < imageDesc.image_width * elementSize; i++) {
|
||||
if (isGpuCopy) {
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>(&imageStorage[i], &data[i], 1);
|
||||
} else {
|
||||
EXPECT_EQ(imageStorage[i], data[i]);
|
||||
}
|
||||
}
|
||||
data += passedRowPitch;
|
||||
imageStorage += imageRowPitch;
|
||||
}
|
||||
|
||||
retVal = clEnqueueUnmapMemObject(pCmdQ, image.get(), ptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
delete[] pUseHostPtr;
|
||||
}
|
||||
|
||||
HWTEST_F(AUBCreateImage, image3DCreatedWithDoubledSlicePitchWhenQueriedForDataReturnsProperData) {
|
||||
|
||||
Reference in New Issue
Block a user