Add supportsPipes HW capability
supportsPipes set to false will disable support of Pipes on a device. Related-To: NEO-4368 Change-Id: I2b03984d7618e85f482f8f8fa0fe3ef45ece7c19 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
70c39ec57b
commit
85a5dcfe62
|
@ -4668,6 +4668,11 @@ cl_mem CL_API_CALL clCreatePipe(cl_context context,
|
|||
}
|
||||
auto pDevice = pContext->getDevice(0);
|
||||
|
||||
if (pDevice->arePipesSupported() == false) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pipePacketSize > pDevice->getDeviceInfo().pipeMaxPacketSize) {
|
||||
retVal = CL_INVALID_PIPE_SIZE;
|
||||
break;
|
||||
|
|
|
@ -187,4 +187,8 @@ bool ClDevice::isDeviceEnqueueSupported() const {
|
|||
return device.getHardwareInfo().capabilityTable.supportsDeviceEnqueue;
|
||||
}
|
||||
|
||||
bool ClDevice::arePipesSupported() const {
|
||||
return device.getHardwareInfo().capabilityTable.supportsPipes;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -119,6 +119,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
|||
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
|
||||
DeviceBitfield getDeviceBitfield() const;
|
||||
bool isDeviceEnqueueSupported() const;
|
||||
bool arePipesSupported() const;
|
||||
|
||||
protected:
|
||||
void initializeCaps();
|
||||
|
|
|
@ -294,11 +294,18 @@ void ClDevice::initializeCaps() {
|
|||
// cl_khr_image2d_from_buffer
|
||||
deviceInfo.imagePitchAlignment = hwHelper.getPitchAlignmentForImage(&hwInfo);
|
||||
deviceInfo.imageBaseAddressAlignment = 4;
|
||||
deviceInfo.maxPipeArgs = 16;
|
||||
deviceInfo.pipeMaxPacketSize = 1024;
|
||||
deviceInfo.pipeMaxActiveReservations = 1;
|
||||
deviceInfo.queueOnHostProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
|
||||
|
||||
if (arePipesSupported()) {
|
||||
deviceInfo.maxPipeArgs = 16;
|
||||
deviceInfo.pipeMaxPacketSize = 1024;
|
||||
deviceInfo.pipeMaxActiveReservations = 1;
|
||||
} else {
|
||||
deviceInfo.maxPipeArgs = 0;
|
||||
deviceInfo.pipeMaxPacketSize = 0;
|
||||
deviceInfo.pipeMaxActiveReservations = 0;
|
||||
}
|
||||
|
||||
deviceInfo.linkerAvailable = true;
|
||||
deviceInfo.svmCapabilities = hwInfo.capabilityTable.ftrSvm * CL_DEVICE_SVM_COARSE_GRAIN_BUFFER;
|
||||
if (hwInfo.capabilityTable.ftrSvm) {
|
||||
|
|
|
@ -70,6 +70,7 @@ const RuntimeCapabilityTable EHL::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
false, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
true, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ const RuntimeCapabilityTable LKF::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
false, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
false, // supportsPipes
|
||||
false // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ const RuntimeCapabilityTable BDW::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
true, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ const RuntimeCapabilityTable BXT::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
false, // supportsDeviceEnqueue
|
||||
false, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ const RuntimeCapabilityTable CFL::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
true, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ const RuntimeCapabilityTable GLK::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
false, // supportsDeviceEnqueue
|
||||
false, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ const RuntimeCapabilityTable KBL::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
true, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
|||
false, // supportCacheFlushAfterWalker
|
||||
true, // supportsImages
|
||||
true, // supportsDeviceEnqueue
|
||||
true, // supportsPipes
|
||||
true // hostPtrTrackingEnabled
|
||||
};
|
||||
WorkaroundTable SKL::workaroundTable = {};
|
||||
|
|
|
@ -11,12 +11,15 @@
|
|||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/base_object.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
|
||||
#include "cl_api_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef api_tests clCreatePipeTests;
|
||||
struct clCreatePipeTests : api_tests {
|
||||
VariableBackup<bool> supportsPipesBackup{&defaultHwInfo->capabilityTable.supportsPipes, true};
|
||||
};
|
||||
|
||||
namespace ClCreatePipeTests {
|
||||
|
||||
|
@ -27,6 +30,7 @@ class clCreatePipeWithParamTests : public ApiFixture<>, public testing::TestWith
|
|||
void TearDown() override {
|
||||
ApiFixture::TearDown();
|
||||
}
|
||||
VariableBackup<bool> supportsPipesBackup{&defaultHwInfo->capabilityTable.supportsPipes, true};
|
||||
};
|
||||
|
||||
class clCreatePipeWithParamNegativeTests : public ApiFixture<>, public testing::TestWithParam<uint64_t> {
|
||||
|
@ -36,6 +40,7 @@ class clCreatePipeWithParamNegativeTests : public ApiFixture<>, public testing::
|
|||
void TearDown() override {
|
||||
ApiFixture::TearDown();
|
||||
}
|
||||
VariableBackup<bool> supportsPipesBackup{&defaultHwInfo->capabilityTable.supportsPipes, true};
|
||||
};
|
||||
|
||||
TEST_P(clCreatePipeWithParamTests, GivenValidFlagsWhenCreatingPipeThenPipeIsCreatedAndSuccessIsReturned) {
|
||||
|
@ -136,6 +141,18 @@ TEST_F(clCreatePipeTests, GivenPipePropertiesNotNullWhenCreatingPipeThenInvalidV
|
|||
clReleaseMemObject(pipe);
|
||||
}
|
||||
|
||||
TEST_F(clCreatePipeTests, GivenDeviceNotSupportingPipesWhenCreatingPipeThenInvalidOperationErrorIsReturned) {
|
||||
auto hardwareInfo = *defaultHwInfo;
|
||||
hardwareInfo.capabilityTable.supportsPipes = false;
|
||||
|
||||
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, 0));
|
||||
MockContext mockContext{pClDevice.get(), false};
|
||||
|
||||
auto pipe = clCreatePipe(&mockContext, 0, 1, 20, nullptr, &retVal);
|
||||
EXPECT_EQ(nullptr, pipe);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clCreatePipeTests, GivenPipePacketSizeGreaterThanAllowedWhenCreatingPipeThenInvalidPipeSizeErrorIsReturned) {
|
||||
cl_uint packetSize = pContext->getDevice(0)->getDeviceInfo().pipeMaxPacketSize;
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
|
@ -171,7 +188,7 @@ TEST(clCreatePipeTest, givenPlatformWithoutDevicesWhenClCreatePipeIsCalledThenDe
|
|||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto device = std::make_unique<ClDevice>(*Device::create<RootDevice>(executionEnvironment, 0u), platform());
|
||||
const ClDeviceInfo &devInfo = device->getDeviceInfo();
|
||||
if (devInfo.svmCapabilities == 0) {
|
||||
if (devInfo.svmCapabilities == 0 || device->getHardwareInfo().capabilityTable.supportsPipes == false) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
cl_device_id clDevice = device.get();
|
||||
|
|
|
@ -7,12 +7,15 @@
|
|||
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/mem_obj/pipe.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
|
||||
#include "cl_api_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef api_tests clGetPipeInfoTests;
|
||||
struct clGetPipeInfoTests : api_tests {
|
||||
VariableBackup<bool> supportsPipesBackup{&defaultHwInfo->capabilityTable.supportsPipes, true};
|
||||
};
|
||||
|
||||
namespace ULT {
|
||||
|
||||
|
|
|
@ -161,6 +161,16 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
|
|||
EXPECT_EQ(static_cast<cl_command_queue_properties>(0), caps.queueOnDeviceProperties);
|
||||
}
|
||||
|
||||
if (defaultHwInfo->capabilityTable.supportsPipes) {
|
||||
EXPECT_EQ(16u, caps.maxPipeArgs);
|
||||
EXPECT_EQ(1024u, caps.pipeMaxPacketSize);
|
||||
EXPECT_EQ(1u, caps.pipeMaxActiveReservations);
|
||||
} else {
|
||||
EXPECT_EQ(0u, caps.maxPipeArgs);
|
||||
EXPECT_EQ(0u, caps.pipeMaxPacketSize);
|
||||
EXPECT_EQ(0u, caps.pipeMaxActiveReservations);
|
||||
}
|
||||
|
||||
EXPECT_EQ(64u, caps.preferredGlobalAtomicAlignment);
|
||||
EXPECT_EQ(64u, caps.preferredLocalAtomicAlignment);
|
||||
EXPECT_EQ(64u, caps.preferredPlatformAtomicAlignment);
|
||||
|
|
|
@ -21,6 +21,7 @@ bool supportsOcl21(const Context *pContext);
|
|||
bool supportsDeviceEnqueue(const ClDevice *pClDevice);
|
||||
bool supportsDeviceEnqueue(const Context *pContext);
|
||||
bool supportsDeviceEnqueue(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
||||
bool supportsPipes(const ClDevice *pClDevice);
|
||||
} // namespace TestChecks
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -54,6 +54,7 @@ struct RuntimeCapabilityTable {
|
|||
bool supportCacheFlushAfterWalker;
|
||||
bool supportsImages;
|
||||
bool supportsDeviceEnqueue;
|
||||
bool supportsPipes;
|
||||
bool hostPtrTrackingEnabled;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue