2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/command_queue/command_queue_hw.h"
|
|
|
|
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
|
|
|
#include "runtime/helpers/aligned_memory.h"
|
|
|
|
#include "runtime/kernel/kernel.h"
|
|
|
|
#include "runtime/mem_obj/buffer.h"
|
|
|
|
#include "runtime/mem_obj/image.h"
|
|
|
|
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
2018-07-13 20:11:04 +08:00
|
|
|
#include "test.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "unit_tests/fixtures/device_fixture.h"
|
2018-07-13 20:11:04 +08:00
|
|
|
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "unit_tests/mocks/mock_context.h"
|
|
|
|
|
|
|
|
using namespace OCLRT;
|
|
|
|
|
|
|
|
namespace ULT {
|
|
|
|
|
|
|
|
template <typename FamilyType>
|
|
|
|
class CommandStreamReceiverMock : public UltCommandStreamReceiver<FamilyType> {
|
|
|
|
private:
|
|
|
|
std::vector<GraphicsAllocation *> toFree; // pointers to be freed on destruction
|
|
|
|
Device *pDevice;
|
|
|
|
|
|
|
|
public:
|
|
|
|
size_t expectedToFreeCount = (size_t)-1;
|
2018-08-08 19:49:09 +08:00
|
|
|
CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver<FamilyType>(*platformDevices[0], *pDevice->getExecutionEnvironment()) {
|
2017-12-21 07:45:38 +08:00
|
|
|
this->pDevice = pDevice;
|
|
|
|
}
|
|
|
|
|
2018-09-25 18:38:00 +08:00
|
|
|
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer &allocationsForResidency, OsContext &osContext) override {
|
2017-12-21 07:45:38 +08:00
|
|
|
EXPECT_NE(nullptr, batchBuffer.commandBufferAllocation->getUnderlyingBuffer());
|
|
|
|
|
|
|
|
toFree.push_back(batchBuffer.commandBufferAllocation);
|
|
|
|
batchBuffer.stream->replaceBuffer(nullptr, 0);
|
|
|
|
batchBuffer.stream->replaceGraphicsAllocation(nullptr);
|
|
|
|
|
2018-08-06 20:55:04 +08:00
|
|
|
EXPECT_TRUE(this->ownershipMutex.try_lock());
|
|
|
|
this->ownershipMutex.unlock();
|
2017-12-21 07:45:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
~CommandStreamReceiverMock() override {
|
|
|
|
EXPECT_FALSE(pDevice->hasOwnership());
|
|
|
|
if (expectedToFreeCount == (size_t)-1) {
|
|
|
|
EXPECT_GT(toFree.size(), 0u); //make sure flush was called
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(toFree.size(), expectedToFreeCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto memoryManager = this->getMemoryManager();
|
|
|
|
//Now free memory. if CQ/CSR did the same, we will hit double-free
|
|
|
|
for (auto p : toFree)
|
|
|
|
memoryManager->freeGraphicsMemory(p);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-04-17 03:54:19 +08:00
|
|
|
struct EnqueueThreadingFixture : public DeviceFixture {
|
2018-03-30 01:44:20 +08:00
|
|
|
void SetUp() {
|
2017-12-21 07:45:38 +08:00
|
|
|
DeviceFixture::SetUp();
|
|
|
|
context = new MockContext(pDevice);
|
|
|
|
pCmdQ = nullptr;
|
|
|
|
}
|
|
|
|
|
2018-03-30 01:44:20 +08:00
|
|
|
void TearDown() {
|
2017-12-21 07:45:38 +08:00
|
|
|
delete pCmdQ;
|
|
|
|
context->release();
|
|
|
|
DeviceFixture::TearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename FamilyType>
|
|
|
|
class MyCommandQueue : public CommandQueueHw<FamilyType> {
|
|
|
|
public:
|
|
|
|
MyCommandQueue(Context *context,
|
|
|
|
Device *device,
|
|
|
|
const cl_queue_properties *props) : CommandQueueHw<FamilyType>(context, device, props), kernel(nullptr) {
|
|
|
|
}
|
|
|
|
|
|
|
|
static CommandQueue *create(Context *context,
|
|
|
|
Device *device,
|
|
|
|
cl_command_queue_properties props) {
|
|
|
|
const cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, props, 0};
|
|
|
|
return new MyCommandQueue<FamilyType>(context, device, properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~MyCommandQueue() override {
|
|
|
|
if (kernel) {
|
|
|
|
EXPECT_FALSE(kernel->hasOwnership());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &multiDispatchInfo) override {
|
|
|
|
for (auto &dispatchInfo : multiDispatchInfo) {
|
|
|
|
auto &kernel = *dispatchInfo.getKernel();
|
|
|
|
EXPECT_TRUE(kernel.hasOwnership());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Kernel *kernel;
|
|
|
|
};
|
|
|
|
|
|
|
|
CommandQueue *pCmdQ;
|
|
|
|
MockContext *context;
|
|
|
|
|
|
|
|
template <typename FamilyType>
|
|
|
|
void createCQ() {
|
|
|
|
pCmdQ = MyCommandQueue<FamilyType>::create(context, pDevice, 0);
|
|
|
|
ASSERT_NE(nullptr, pCmdQ);
|
|
|
|
|
|
|
|
auto pCommandStreamReceiver = new CommandStreamReceiverMock<FamilyType>(pDevice);
|
|
|
|
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Test<EnqueueThreadingFixture> EnqueueThreading;
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueReadBuffer) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
|
|
|
|
cl_int retVal;
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, buffer.get());
|
|
|
|
|
|
|
|
void *ptr = ::alignedMalloc(1024u, 4096);
|
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
buffer->forceDisallowCPUCopy = true;
|
|
|
|
pCmdQ->enqueueReadBuffer(buffer.get(),
|
|
|
|
true,
|
|
|
|
0,
|
|
|
|
1024u,
|
|
|
|
ptr,
|
|
|
|
0,
|
|
|
|
nullptr,
|
|
|
|
nullptr);
|
|
|
|
|
|
|
|
alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueWriteBuffer) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
|
|
|
|
cl_int retVal;
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, buffer.get());
|
|
|
|
|
|
|
|
void *ptr = ::alignedMalloc(1024u, 4096);
|
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
buffer->forceDisallowCPUCopy = true;
|
|
|
|
pCmdQ->enqueueWriteBuffer(buffer.get(),
|
|
|
|
true,
|
|
|
|
0,
|
|
|
|
1024u,
|
|
|
|
ptr,
|
|
|
|
0,
|
|
|
|
nullptr,
|
|
|
|
nullptr);
|
|
|
|
|
|
|
|
alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueCopyBuffer) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
|
|
|
|
cl_int retVal;
|
|
|
|
std::unique_ptr<Buffer> srcBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcBuffer.get());
|
|
|
|
std::unique_ptr<Buffer> dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, dstBuffer.get());
|
|
|
|
|
|
|
|
pCmdQ->enqueueCopyBuffer(srcBuffer.get(), dstBuffer.get(), 0, 0, 1024u, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueCopyBufferRect) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
|
|
|
|
cl_int retVal;
|
|
|
|
std::unique_ptr<Buffer> srcBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcBuffer.get());
|
|
|
|
std::unique_ptr<Buffer> dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, dstBuffer.get());
|
|
|
|
|
|
|
|
size_t srcOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t dstOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueCopyBufferRect(srcBuffer.get(), dstBuffer.get(), srcOrigin, dstOrigin, region, 0, 0, 0, 0, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueCopyBufferToImage) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> srcBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcBuffer.get());
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
|
|
|
|
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> dstImage(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, dstImage.get());
|
|
|
|
|
|
|
|
size_t dstOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueCopyBufferToImage(srcBuffer.get(), dstImage.get(), 0, dstOrigin, region, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueCopyImage) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> srcImage(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcImage.get());
|
|
|
|
std::unique_ptr<Image> dstImage(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcImage.get());
|
|
|
|
|
|
|
|
size_t srcOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t dstOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueCopyImage(srcImage.get(), dstImage.get(), srcOrigin, dstOrigin, region, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueCopyImageToBuffer) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
|
|
|
|
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> srcImage(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, srcImage.get());
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, dstBuffer.get());
|
|
|
|
|
|
|
|
size_t srcOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueCopyImageToBuffer(srcImage.get(), dstBuffer.get(), srcOrigin, region, 0, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueFillBuffer) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, buffer.get());
|
|
|
|
|
|
|
|
cl_int pattern = 0xDEADBEEF;
|
|
|
|
pCmdQ->enqueueFillBuffer(buffer.get(), &pattern, sizeof(pattern), 0, 1024u, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueFillImage) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
|
|
|
|
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> image(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, image.get());
|
|
|
|
|
|
|
|
size_t origin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
int32_t fillColor[4] = {0xCC, 0xCC, 0xCC, 0xCC};
|
|
|
|
|
|
|
|
pCmdQ->enqueueFillImage(image.get(), &fillColor, origin, region, 0, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueReadBufferRect) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, buffer.get());
|
|
|
|
|
|
|
|
void *ptr = ::alignedMalloc(1024u, 4096);
|
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
size_t bufferOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t hostOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueReadBufferRect(buffer.get(), CL_TRUE, bufferOrigin, hostOrigin, region, 0, 0, 0, 0, ptr, 0, nullptr, nullptr);
|
|
|
|
|
|
|
|
::alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueReadImage) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
|
|
|
|
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> image(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, image.get());
|
|
|
|
|
|
|
|
void *ptr = ::alignedMalloc(1024u, 4096);
|
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
size_t origin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueReadImage(image.get(), CL_TRUE, origin, region, 0, 0, ptr, 0, nullptr, nullptr);
|
|
|
|
|
|
|
|
::alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueWriteBufferRect) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, buffer.get());
|
|
|
|
|
|
|
|
size_t bufferOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t hostOrigin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
2018-08-24 21:23:45 +08:00
|
|
|
auto hostPtrSize = Buffer::calculateHostPtrSize(hostOrigin, region, 0, 0);
|
|
|
|
void *ptr = ::alignedMalloc(hostPtrSize, MemoryConstants::pageSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
pCmdQ->enqueueWriteBufferRect(buffer.get(), CL_TRUE, bufferOrigin, hostOrigin, region, 0, 0, 0, 0, ptr, 0, nullptr, nullptr);
|
|
|
|
|
|
|
|
::alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, enqueueWriteImage) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
cl_int retVal;
|
|
|
|
|
|
|
|
cl_image_format imageFormat;
|
|
|
|
imageFormat.image_channel_data_type = CL_UNORM_INT8;
|
|
|
|
imageFormat.image_channel_order = CL_R;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc;
|
|
|
|
memset(&imageDesc, 0, sizeof(imageDesc));
|
|
|
|
|
|
|
|
imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
|
|
|
imageDesc.image_width = 1024u;
|
|
|
|
|
|
|
|
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
|
|
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
|
|
|
std::unique_ptr<Image> image(Image::create(context, flags, surfaceFormat, &imageDesc, nullptr, retVal));
|
|
|
|
ASSERT_NE(nullptr, image.get());
|
|
|
|
|
|
|
|
void *ptr = ::alignedMalloc(1024u, 4096);
|
|
|
|
ASSERT_NE(nullptr, ptr);
|
|
|
|
|
|
|
|
size_t origin[3] = {1024u, 1, 0};
|
|
|
|
size_t region[3] = {1024u, 1, 1};
|
|
|
|
|
|
|
|
pCmdQ->enqueueWriteImage(image.get(), CL_TRUE, origin, region, 0, 0, ptr, 0, nullptr, nullptr);
|
|
|
|
|
|
|
|
::alignedFree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(EnqueueThreading, finish) {
|
|
|
|
createCQ<FamilyType>();
|
|
|
|
|
|
|
|
// set something to finish
|
|
|
|
pCmdQ->taskCount = 1;
|
|
|
|
pCmdQ->taskLevel = 1;
|
|
|
|
auto csr = (CommandStreamReceiverMock<FamilyType> *)&this->pDevice->getCommandStreamReceiver();
|
|
|
|
csr->expectedToFreeCount = 0u;
|
|
|
|
|
|
|
|
pCmdQ->finish(false);
|
|
|
|
}
|
|
|
|
} // namespace ULT
|