Add new API properties queries
Add queries for getting properties that were used when creating an object: - CL_QUEUE_PROPERTIES_ARRAY - CL_PIPE_PROPERTIES - CL_MEM_PROPERTIES - CL_SAMPLER_PROPERTIES Related-To: NEO-4368 Change-Id: Ib761ee3dd338e9718d72ed4c9596b38843a9b802 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
6644e3990d
commit
99b0f04cc0
|
@ -77,6 +77,7 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
|
|||
}
|
||||
}
|
||||
|
||||
storeProperties(properties);
|
||||
processProperties(properties);
|
||||
}
|
||||
|
||||
|
@ -656,6 +657,16 @@ bool CommandQueue::isBlockedCommandStreamRequired(uint32_t commandType, const Ev
|
|||
return false;
|
||||
}
|
||||
|
||||
void CommandQueue::storeProperties(const cl_queue_properties *properties) {
|
||||
if (properties) {
|
||||
for (size_t i = 0; properties[i] != 0; i += 2) {
|
||||
propertiesVector.push_back(properties[i]);
|
||||
propertiesVector.push_back(properties[i + 1]);
|
||||
}
|
||||
propertiesVector.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandQueue::aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo) {
|
||||
if (DebugManager.flags.AUBDumpSubCaptureMode.get()) {
|
||||
auto status = getGpgpuCommandStreamReceiver().checkAndActivateAubSubCapture(multiDispatchInfo);
|
||||
|
|
|
@ -280,6 +280,8 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
|||
return throttle;
|
||||
}
|
||||
|
||||
const std::vector<uint64_t> &getPropertiesVector() const { return propertiesVector; }
|
||||
|
||||
void enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList,
|
||||
size_t numEventsInWaitlist,
|
||||
MapOperationType opType,
|
||||
|
@ -325,6 +327,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
|||
bool isBlockedCommandStreamRequired(uint32_t commandType, const EventsRequest &eventsRequest, bool blockedQueue) const;
|
||||
|
||||
MOCKABLE_VIRTUAL void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes, bool clearAllDependencies);
|
||||
void storeProperties(const cl_queue_properties *properties);
|
||||
void processProperties(const cl_queue_properties *properties);
|
||||
bool bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandType, cl_bool blocking, size_t size, void *ptr,
|
||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList);
|
||||
|
@ -340,6 +343,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
|||
EngineControl *bcsEngine = nullptr;
|
||||
|
||||
cl_command_queue_properties commandQueueProperties = 0;
|
||||
std::vector<uint64_t> propertiesVector;
|
||||
|
||||
QueuePriority priority = QueuePriority::MEDIUM;
|
||||
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
||||
|
|
|
@ -86,6 +86,20 @@ cl_int getQueueInfo(QueueType *queue,
|
|||
}
|
||||
retVal = CL_INVALID_VALUE;
|
||||
break;
|
||||
case CL_QUEUE_PROPERTIES_ARRAY: {
|
||||
const cl_queue_properties *source = nullptr;
|
||||
size_t sourceSize = 0;
|
||||
if (std::is_same<QueueType, class CommandQueue>::value) {
|
||||
auto cmdQ = reinterpret_cast<CommandQueue *>(queue);
|
||||
auto &propertiesVector = cmdQ->getPropertiesVector();
|
||||
source = propertiesVector.data();
|
||||
sourceSize = propertiesVector.size() * sizeof(cl_queue_properties);
|
||||
}
|
||||
auto getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, source, sourceSize);
|
||||
retVal = changeGetInfoStatusToCLResultType(getInfoStatus);
|
||||
GetInfo::setParamValueReturnSize(paramValueSizeRet, sourceSize, getInfoStatus);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (std::is_same<QueueType, class CommandQueue>::value) {
|
||||
auto cmdQ = reinterpret_cast<CommandQueue *>(queue);
|
||||
|
|
|
@ -140,7 +140,13 @@ cl_mem Buffer::validateInputAndCreateBuffer(cl_context context,
|
|||
}
|
||||
|
||||
// create the buffer
|
||||
return create(pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal);
|
||||
auto buffer = create(pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal);
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
buffer->storeProperties(properties);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
Buffer *Buffer::create(Context *context,
|
||||
|
|
|
@ -1165,7 +1165,13 @@ cl_mem Image::validateAndCreateImage(cl_context context,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return Image::create(pContext, memoryProperties, flags, flagsIntel, surfaceFormat, imageDesc, hostPtr, errcodeRet);
|
||||
auto image = Image::create(pContext, memoryProperties, flags, flagsIntel, surfaceFormat, imageDesc, hostPtr, errcodeRet);
|
||||
|
||||
if (errcodeRet == CL_SUCCESS) {
|
||||
image->storeProperties(properties);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
bool Image::isValidSingleChannelFormat(const cl_image_format *imageFormat) {
|
||||
|
|
|
@ -181,12 +181,18 @@ cl_int MemObj::getMemObjectInfo(cl_mem_info paramName,
|
|||
srcParamSize = sizeof(refCnt);
|
||||
srcParam = &refCnt;
|
||||
break;
|
||||
|
||||
case CL_MEM_ALLOCATION_HANDLE_INTEL:
|
||||
internalHandle = this->getGraphicsAllocation()->peekInternalHandle(this->memoryManager);
|
||||
srcParamSize = sizeof(internalHandle);
|
||||
srcParam = &internalHandle;
|
||||
break;
|
||||
|
||||
case CL_MEM_PROPERTIES:
|
||||
srcParamSize = propertiesVector.size() * sizeof(cl_mem_properties);
|
||||
srcParam = propertiesVector.data();
|
||||
break;
|
||||
|
||||
default:
|
||||
getOsSpecificMemObjectInfo(paramName, &srcParamSize, &srcParam);
|
||||
break;
|
||||
|
@ -364,4 +370,15 @@ bool MemObj::mappingOnCpuAllowed() const {
|
|||
!(graphicsAllocation->getDefaultGmm() && graphicsAllocation->getDefaultGmm()->isRenderCompressed) &&
|
||||
MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool());
|
||||
}
|
||||
|
||||
void MemObj::storeProperties(const cl_mem_properties *properties) {
|
||||
if (properties) {
|
||||
for (size_t i = 0; properties[i] != 0; i += 2) {
|
||||
propertiesVector.push_back(properties[i]);
|
||||
propertiesVector.push_back(properties[i + 1]);
|
||||
}
|
||||
propertiesVector.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -130,6 +130,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
|||
|
||||
protected:
|
||||
void getOsSpecificMemObjectInfo(const cl_mem_info ¶mName, size_t *srcParamSize, void **srcParam);
|
||||
void storeProperties(const cl_mem_properties *properties);
|
||||
|
||||
Context *context;
|
||||
cl_mem_object_type memObjectType;
|
||||
|
@ -155,6 +156,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
|||
GraphicsAllocation *mcsAllocation = nullptr;
|
||||
GraphicsAllocation *mapAllocation = nullptr;
|
||||
std::shared_ptr<SharingHandler> sharingHandler;
|
||||
std::vector<uint64_t> propertiesVector;
|
||||
|
||||
class DestructorCallback {
|
||||
public:
|
||||
|
|
|
@ -100,12 +100,13 @@ cl_int Pipe::getPipeInfo(cl_image_info paramName,
|
|||
srcParamSize = sizeof(cl_uint);
|
||||
srcParam = &(pipePacketSize);
|
||||
break;
|
||||
|
||||
case CL_PIPE_MAX_PACKETS:
|
||||
srcParamSize = sizeof(cl_uint);
|
||||
srcParam = &(pipeMaxPackets);
|
||||
break;
|
||||
|
||||
case CL_PIPE_PROPERTIES:
|
||||
srcParamSize = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -103,12 +103,13 @@ Sampler *Sampler::create(Context *context,
|
|||
SetOnce<float> lodMax(std::numeric_limits<float>::max(), 0.0f, std::numeric_limits<float>::max());
|
||||
|
||||
errcodeRet = CL_SUCCESS;
|
||||
if (samplerProperties) {
|
||||
auto samplerProperty = samplerProperties;
|
||||
if (samplerProperty) {
|
||||
cl_ulong samType;
|
||||
|
||||
while ((samType = *samplerProperties) != 0) {
|
||||
++samplerProperties;
|
||||
auto samValue = *samplerProperties;
|
||||
while ((samType = *samplerProperty) != 0) {
|
||||
++samplerProperty;
|
||||
auto samValue = *samplerProperty;
|
||||
switch (samType) {
|
||||
case CL_SAMPLER_NORMALIZED_COORDS:
|
||||
errcodeRet = normalizedCoords.setValue(static_cast<uint32_t>(samValue));
|
||||
|
@ -138,7 +139,7 @@ Sampler *Sampler::create(Context *context,
|
|||
errcodeRet = CL_INVALID_VALUE;
|
||||
break;
|
||||
}
|
||||
++samplerProperties;
|
||||
++samplerProperty;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +150,10 @@ Sampler *Sampler::create(Context *context,
|
|||
errcodeRet);
|
||||
}
|
||||
|
||||
if (errcodeRet == CL_SUCCESS) {
|
||||
sampler->storeProperties(samplerProperties);
|
||||
}
|
||||
|
||||
return sampler;
|
||||
}
|
||||
|
||||
|
@ -209,6 +214,11 @@ cl_int Sampler::getInfo(cl_sampler_info paramName, size_t paramValueSize,
|
|||
pValue = &refCount;
|
||||
break;
|
||||
|
||||
case CL_SAMPLER_PROPERTIES:
|
||||
valueSize = propertiesVector.size() * sizeof(cl_sampler_properties);
|
||||
pValue = propertiesVector.data();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -226,4 +236,14 @@ bool Sampler::isTransformable() const {
|
|||
normalizedCoordinates == CL_FALSE;
|
||||
}
|
||||
|
||||
void Sampler::storeProperties(const cl_sampler_properties *properties) {
|
||||
if (properties) {
|
||||
for (size_t i = 0; properties[i] != 0; i += 2) {
|
||||
propertiesVector.push_back(properties[i]);
|
||||
propertiesVector.push_back(properties[i + 1]);
|
||||
}
|
||||
propertiesVector.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "opencl/source/api/cl_types.h"
|
||||
#include "opencl/source/helpers/base_object.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class Context;
|
||||
struct HardwareInfo;
|
||||
|
@ -75,6 +77,11 @@ class Sampler : public BaseObject<_cl_sampler> {
|
|||
cl_filter_mode mipFilterMode;
|
||||
float lodMin;
|
||||
float lodMax;
|
||||
|
||||
protected:
|
||||
void storeProperties(const cl_sampler_properties *properties);
|
||||
|
||||
std::vector<uint64_t> propertiesVector;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -353,6 +353,49 @@ TEST_F(clCreateBufferTests, WhenCreatingBufferWithPropertiesThenErrorCodeIsCorre
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(clCreateBufferTests, GivenBufferCreatedWithNullPropertiesWhenQueryingPropertiesThenNothingIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
size_t size = 10;
|
||||
auto buffer = clCreateBufferWithPropertiesINTEL(pContext, nullptr, size, nullptr, &retVal);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_NE(nullptr, buffer);
|
||||
|
||||
size_t propertiesSize;
|
||||
retVal = clGetMemObjectInfo(buffer, CL_MEM_PROPERTIES, 0, nullptr, &propertiesSize);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(0u, propertiesSize);
|
||||
|
||||
clReleaseMemObject(buffer);
|
||||
}
|
||||
|
||||
TEST_F(clCreateBufferTests, WhenCreatingBufferWithPropertiesThenPropertiesAreCorrectlyStored) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
size_t size = 10;
|
||||
cl_mem_properties properties[5];
|
||||
size_t propertiesSize;
|
||||
|
||||
std::vector<std::vector<uint64_t>> propertiesToTest{
|
||||
{0},
|
||||
{CL_MEM_FLAGS, CL_MEM_WRITE_ONLY, 0},
|
||||
{CL_MEM_FLAGS_INTEL, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0},
|
||||
{CL_MEM_FLAGS, CL_MEM_WRITE_ONLY, CL_MEM_FLAGS_INTEL, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0}};
|
||||
|
||||
for (auto testProperties : propertiesToTest) {
|
||||
auto buffer = clCreateBufferWithPropertiesINTEL(pContext, testProperties.data(), size, nullptr, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, buffer);
|
||||
|
||||
retVal = clGetMemObjectInfo(buffer, CL_MEM_PROPERTIES, sizeof(properties), properties, &propertiesSize);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(testProperties.size() * sizeof(cl_mem_properties), propertiesSize);
|
||||
for (size_t i = 0; i < testProperties.size(); i++) {
|
||||
EXPECT_EQ(testProperties[i], properties[i]);
|
||||
}
|
||||
|
||||
retVal = clReleaseMemObject(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
using clCreateBufferTestsWithRestrictions = api_test_using_aligned_memory_manager;
|
||||
|
||||
TEST_F(clCreateBufferTestsWithRestrictions, GivenMemoryManagerRestrictionsWhenMinIsLessThanHostPtrThenUseZeroCopy) {
|
||||
|
|
|
@ -208,7 +208,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullContextWhenCreatingComman
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenOoqPropertiesWhenQueueIsCreatedThenSuccessIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
|
||||
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
|
||||
EXPECT_NE(nullptr, cmdq);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
|
@ -218,7 +218,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenOoqPropertiesWhenQueueIsCreat
|
|||
}
|
||||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOoqPropertiesWhenQueueIsCreatedThenErrorIsReturned) {
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0, 0};
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0};
|
||||
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdqd);
|
||||
EXPECT_EQ(retVal, CL_INVALID_VALUE);
|
||||
|
@ -226,7 +226,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOoqProper
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullContextAndOoqPropertiesWhenCreatingCommandQueueWithPropertiesThenInvalidContextErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0};
|
||||
auto cmdq = clCreateCommandQueueWithProperties(nullptr, testedClDevice, ooq, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdq);
|
||||
EXPECT_EQ(retVal, CL_INVALID_CONTEXT);
|
||||
|
@ -234,7 +234,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullContextAndOoqPropertiesWh
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullDeviceWhenCreatingCommandQueueWithPropertiesThenInvalidDeviceErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0};
|
||||
auto cmdq = clCreateCommandQueueWithProperties(pContext, nullptr, ooq, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdq);
|
||||
EXPECT_EQ(retVal, CL_INVALID_DEVICE);
|
||||
|
@ -259,7 +259,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenSizeWhichExceedsMaxDeviceQueu
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOutOfOrderExecModePropertyWhenCreatingCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0, 0};
|
||||
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0};
|
||||
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdq);
|
||||
EXPECT_EQ(retVal, CL_INVALID_VALUE);
|
||||
|
@ -267,7 +267,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOutOfOrde
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDefaultDeviceQueueWithoutQueueOnDevicePropertyWhenCreatingCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ddq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
|
||||
cl_queue_properties ddq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE_DEFAULT, 0};
|
||||
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ddq, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdq);
|
||||
EXPECT_EQ(retVal, CL_INVALID_VALUE);
|
||||
|
@ -277,7 +277,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
|
|||
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto pDevice = castToObject<ClDevice>(testedClDevice);
|
||||
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0};
|
||||
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0};
|
||||
|
||||
auto cmdq1 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
|
||||
EXPECT_NE(nullptr, cmdq1);
|
||||
|
@ -301,7 +301,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
|
|||
HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAllocationWhenCreatingCommandQueueWithPropertiesThenOutOfHostMemoryErrorIsReturned) {
|
||||
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
|
||||
InjectedFunction method = [this](size_t failureIndex) {
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
|
||||
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0};
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
|
||||
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
|
||||
|
@ -320,7 +320,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAl
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenHighPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_HIGH_KHR, 0, 0};
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_HIGH_KHR, 0};
|
||||
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdqd);
|
||||
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
|
||||
|
@ -328,14 +328,14 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenHighPriorityWhenCreatingOoqCo
|
|||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0, 0};
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0};
|
||||
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdqd);
|
||||
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
|
||||
}
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenMedPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_MED_KHR, 0, 0};
|
||||
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_MED_KHR, 0};
|
||||
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
|
||||
EXPECT_EQ(nullptr, cmdqd);
|
||||
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
|
||||
|
@ -349,7 +349,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCrea
|
|||
MockContext context{pClDevice.get()};
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
|
||||
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
|
||||
auto pCmdQ = clCreateCommandQueueWithProperties(&context, pClDevice.get(), queueProperties, &retVal);
|
||||
EXPECT_EQ(nullptr, pCmdQ);
|
||||
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
|
||||
|
@ -363,7 +363,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCrea
|
|||
MockContext context{pClDevice.get()};
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
|
||||
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
|
||||
auto pCmdQ = clCreateCommandQueueWithProperties(&context, pClDevice.get(), queueProperties, &retVal);
|
||||
EXPECT_EQ(nullptr, pCmdQ);
|
||||
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
|
||||
|
@ -415,6 +415,46 @@ HWTEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingComm
|
|||
clReleaseCommandQueue(cmdQ);
|
||||
}
|
||||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenCommandQueueCreatedWithNullPropertiesWhenQueryingPropertiesArrayThenNothingIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, nullptr, &retVal);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_NE(nullptr, commandQueue);
|
||||
|
||||
size_t propertiesArraySize;
|
||||
retVal = clGetCommandQueueInfo(commandQueue, CL_QUEUE_PROPERTIES_ARRAY, 0, nullptr, &propertiesArraySize);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(0u, propertiesArraySize);
|
||||
|
||||
clReleaseCommandQueue(commandQueue);
|
||||
}
|
||||
|
||||
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenCommandQueueCreatedWithVariousPropertiesWhenQueryingPropertiesArrayThenCorrectValuesAreReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_queue_properties propertiesArray[3];
|
||||
size_t propertiesArraySize;
|
||||
|
||||
std::vector<std::vector<uint64_t>> propertiesToTest{
|
||||
{0},
|
||||
{CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0},
|
||||
{CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0}};
|
||||
|
||||
for (auto properties : propertiesToTest) {
|
||||
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties.data(), &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
retVal = clGetCommandQueueInfo(commandQueue, CL_QUEUE_PROPERTIES_ARRAY,
|
||||
sizeof(propertiesArray), propertiesArray, &propertiesArraySize);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(properties.size() * sizeof(cl_queue_properties), propertiesArraySize);
|
||||
for (size_t i = 0; i < properties.size(); i++) {
|
||||
EXPECT_EQ(properties[i], propertiesArray[i]);
|
||||
}
|
||||
|
||||
clReleaseCommandQueue(commandQueue);
|
||||
}
|
||||
}
|
||||
|
||||
using LowPriorityCommandQueueTest = ::testing::Test;
|
||||
HWTEST_F(LowPriorityCommandQueueTest, GivenDeviceWithSubdevicesWhenCreatingLowPriorityCommandQueueThenEngineFromFirstSubdeviceIsTaken) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
|
|
@ -465,6 +465,47 @@ TEST_F(clCreateImageTest, WhenCreatingImageWithPropertiesThenErrorCodeIsCorrectl
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(clCreateImageTest, GivenImageCreatedWithNullPropertiesWhenQueryingPropertiesThenNothingIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto image = clCreateImageWithProperties(pContext, nullptr, 0, &imageFormat, &imageDesc, nullptr, &retVal);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_NE(nullptr, image);
|
||||
|
||||
size_t propertiesSize;
|
||||
retVal = clGetMemObjectInfo(image, CL_MEM_PROPERTIES, 0, nullptr, &propertiesSize);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(0u, propertiesSize);
|
||||
|
||||
clReleaseMemObject(image);
|
||||
}
|
||||
|
||||
TEST_F(clCreateImageTest, WhenCreatingImageWithPropertiesThenPropertiesAreCorrectlyStored) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_mem_properties properties[5];
|
||||
size_t propertiesSize;
|
||||
|
||||
std::vector<std::vector<uint64_t>> propertiesToTest{
|
||||
{0},
|
||||
{CL_MEM_FLAGS, CL_MEM_WRITE_ONLY, 0},
|
||||
{CL_MEM_FLAGS_INTEL, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0},
|
||||
{CL_MEM_FLAGS, CL_MEM_WRITE_ONLY, CL_MEM_FLAGS_INTEL, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0}};
|
||||
|
||||
for (auto testProperties : propertiesToTest) {
|
||||
auto image = clCreateImageWithProperties(pContext, testProperties.data(), 0, &imageFormat, &imageDesc, nullptr, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, image);
|
||||
|
||||
retVal = clGetMemObjectInfo(image, CL_MEM_PROPERTIES, sizeof(properties), properties, &propertiesSize);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(testProperties.size() * sizeof(cl_mem_properties), propertiesSize);
|
||||
for (size_t i = 0; i < testProperties.size(); i++) {
|
||||
EXPECT_EQ(testProperties[i], properties[i]);
|
||||
}
|
||||
|
||||
clReleaseMemObject(image);
|
||||
}
|
||||
}
|
||||
|
||||
typedef clCreateImageTests<::testing::Test> clCreateImageTestYUV;
|
||||
TEST_F(clCreateImageTestYUV, GivenInvalidGlagWhenCreatingYuvImageThenInvalidValueErrorIsReturned) {
|
||||
imageFormat.image_channel_order = CL_YUYV_INTEL;
|
||||
|
|
|
@ -74,6 +74,46 @@ TEST_F(clCreateSamplerWithPropertiesTests, GivenNullContextWhenCreatingSamplerWi
|
|||
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clCreateSamplerWithPropertiesTests, GivenSamplerCreatedWithNullPropertiesWhenQueryingPropertiesThenNothingIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto sampler = clCreateSamplerWithProperties(pContext, nullptr, &retVal);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_NE(nullptr, sampler);
|
||||
|
||||
size_t propertiesSize;
|
||||
retVal = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, 0, nullptr, &propertiesSize);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(0u, propertiesSize);
|
||||
|
||||
clReleaseSampler(sampler);
|
||||
}
|
||||
|
||||
TEST_F(clCreateSamplerWithPropertiesTests, WhenCreatingSamplerWithPropertiesThenPropertiesAreCorrectlyStored) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_sampler_properties properties[7];
|
||||
size_t propertiesSize;
|
||||
|
||||
std::vector<std::vector<uint64_t>> propertiesToTest{
|
||||
{0},
|
||||
{CL_SAMPLER_FILTER_MODE, CL_FILTER_LINEAR, 0},
|
||||
{CL_SAMPLER_NORMALIZED_COORDS, 0, CL_SAMPLER_ADDRESSING_MODE, CL_ADDRESS_NONE, CL_SAMPLER_FILTER_MODE, CL_FILTER_LINEAR, 0}};
|
||||
|
||||
for (auto testProperties : propertiesToTest) {
|
||||
auto sampler = clCreateSamplerWithProperties(pContext, testProperties.data(), &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, sampler);
|
||||
|
||||
retVal = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, sizeof(properties), properties, &propertiesSize);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(testProperties.size() * sizeof(cl_sampler_properties), propertiesSize);
|
||||
for (size_t i = 0; i < testProperties.size(); i++) {
|
||||
EXPECT_EQ(testProperties[i], properties[i]);
|
||||
}
|
||||
|
||||
clReleaseSampler(sampler);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(clCreateSamplerWithProperties_, GivenCorrectParametersWhenCreatingSamplerWithPropertiesThenSamplerIsCreatedAndSuccessIsReturned) {
|
||||
cl_sampler sampler = nullptr;
|
||||
cl_queue_properties properties[] =
|
||||
|
|
|
@ -152,4 +152,20 @@ TEST_F(clGetPipeInfoTests, GivenBufferInsteadOfPipeWhenGettingPipeInfoThenClInva
|
|||
|
||||
clReleaseMemObject(buffer);
|
||||
}
|
||||
|
||||
TEST_F(clGetPipeInfoTests, WhenQueryingPipePropertiesThenNothingIsCopied) {
|
||||
auto pipe = clCreatePipe(pContext, CL_MEM_READ_WRITE, 1, 20, nullptr, &retVal);
|
||||
|
||||
EXPECT_NE(nullptr, pipe);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
size_t paramSize = 1u;
|
||||
|
||||
retVal = clGetPipeInfo(pipe, CL_PIPE_PROPERTIES, 0, nullptr, ¶mSize);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(0u, paramSize);
|
||||
|
||||
clReleaseMemObject(pipe);
|
||||
}
|
||||
|
||||
} // namespace ULT
|
||||
|
|
Loading…
Reference in New Issue