Add stub for zeDeviceGetCommandQueueGroupProperties

Change-Id: Ib86d0ae331aef01c4e26c414bf1e1dfaca51aeeb
Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2020-07-15 02:47:57 -07:00
committed by sys_ocldev
parent 4ed3c73e57
commit e7958be0bf
7 changed files with 99 additions and 2 deletions

View File

@@ -102,4 +102,12 @@ zeDeviceSetLastLevelCacheConfig(
return L0::Device::fromHandle(hDevice)->setLastLevelCacheConfig(cacheConfig);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zeDeviceGetCommandQueueGroupProperties(
ze_device_handle_t hDevice,
uint32_t *pCount,
ze_command_queue_group_properties_t *pCommandQueueGroupProperties) {
return L0::Device::fromHandle(hDevice)->getCommandQueueGroupProperties(pCount, pCommandQueueGroupProperties);
}
} // extern "C"

View File

@@ -19,6 +19,8 @@
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
#include "third_party/level_zero/ze_api_ext.h"
struct _ze_device_handle_t {};
namespace NEO {
class Device;
@@ -54,8 +56,7 @@ struct Device : _ze_device_handle_t {
ze_sampler_handle_t *phSampler) = 0;
virtual ze_result_t evictImage(ze_image_handle_t hImage) = 0;
virtual ze_result_t evictMemory(void *ptr, size_t size) = 0;
virtual ze_result_t
getComputeProperties(ze_device_compute_properties_t *pComputeProperties) = 0;
virtual ze_result_t getComputeProperties(ze_device_compute_properties_t *pComputeProperties) = 0;
virtual ze_result_t getP2PProperties(ze_device_handle_t hPeerDevice,
ze_device_p2p_properties_t *pP2PProperties) = 0;
virtual ze_result_t getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) = 0;
@@ -71,6 +72,8 @@ struct Device : _ze_device_handle_t {
virtual ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) = 0;
virtual ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) = 0;
virtual ze_result_t getCommandQueueGroupProperties(uint32_t *pCount,
ze_command_queue_group_properties_t *pCommandQueueGroupProperties) = 0;
virtual ze_result_t systemBarrier() = 0;
virtual ze_result_t registerCLMemory(cl_context context, cl_mem mem, void **ptr) = 0;

View File

@@ -146,6 +146,11 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
return ZE_RESULT_SUCCESS;
}
ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount,
ze_command_queue_group_properties_t *pCommandQueueGroupProperties) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DeviceImp::createImage(const ze_image_desc_t *desc, ze_image_handle_t *phImage) {
auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily;
*phImage = Image::create(productFamily, this, desc);

View File

@@ -46,6 +46,8 @@ struct DeviceImp : public Device {
ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) override;
ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) override;
ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) override;
ze_result_t getCommandQueueGroupProperties(uint32_t *pCount,
ze_command_queue_group_properties_t *pCommandQueueGroupProperties) override;
ze_result_t systemBarrier() override;
void *getExecEnvironment() override;
BuiltinFunctionsLib *getBuiltinFunctionsLib() override;

View File

@@ -75,6 +75,11 @@ struct Mock<Device> : public Device {
MOCK_METHOD2(imageGetProperties,
ze_result_t(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties));
MOCK_METHOD(ze_result_t,
getCommandQueueGroupProperties,
(uint32_t * pCount,
ze_command_queue_group_properties_t *pCommandQueueGroupProperties),
(override));
MOCK_METHOD1(getDeviceImageProperties,
ze_result_t(ze_device_image_properties_t *pDeviceImageProperties));
MOCK_METHOD0(systemBarrier, ze_result_t());

View File

@@ -156,6 +156,14 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA
EXPECT_NE(0, memcmp(&deviceProperties.name, &devicePropertiesBefore.name, sizeof(devicePropertiesBefore.name)));
}
TEST_F(DeviceTest, givenCommandQueuePropertiesCallThenUnsupportedIsReturned) {
uint32_t count;
ze_command_queue_group_properties_t queueProperties = {};
ze_result_t res = device->getCommandQueueGroupProperties(&count, &queueProperties);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, res);
}
struct DeviceHasNoDoubleFp64Test : public ::testing::Test {
void SetUp() override {
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);

View File

@@ -175,6 +175,72 @@ zeModuleDynamicLinkExt(
ze_module_build_log_handle_t *phLinkLog ///< [out][optional] pointer to handle of dynamic link log.
);
///////////////////////////////////////////////////////////////////////////////
/// @brief Supported command queue group property flags
typedef uint32_t ze_command_queue_group_property_flags_t;
typedef enum _ze_command_queue_group_property_flag_t {
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE = ZE_BIT(0), ///< Command queue group supports enqueing compute commands.
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY = ZE_BIT(1), ///< Command queue group supports enqueing copy commands.
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS = ZE_BIT(2), ///< Command queue group supports cooperative kernels.
///< See ::zeCommandListAppendLaunchCooperativeKernel for more details.
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS = ZE_BIT(3), ///< Command queue groups supports metric streamers and queries.
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff
} ze_command_queue_group_property_flag_t;
///////////////////////////////////////////////////////////////////////////////
/// @brief Command queue group properties queried using
/// ::zeDeviceGetCommandQueueGroupProperties
typedef struct _ze_command_queue_group_properties_t {
void *pNext; ///< [in,out][optional] pointer to extension-specific structure
ze_command_queue_group_property_flags_t flags; ///< [out] 0 (none) or a valid combination of
///< ::ze_command_queue_group_property_flag_t
size_t maxMemoryFillPatternSize; ///< [out] maximum `pattern_size` supported by command queue group.
///< See ::zeCommandListAppendMemoryFill for more details.
uint32_t numQueues; ///< [out] the number of physical command queues within the group.
} ze_command_queue_group_properties_t;
///////////////////////////////////////////////////////////////////////////////
/// @brief Retrieves command queue group properties of the device.
///
/// @details
/// - Properties are reported for each physical command queue type supported
/// by the device.
/// - Multiple calls to this function will return properties in the same
/// order.
/// - The order in which the properties are returned defines the command
/// queue group's ordinal.
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function should be lock-free.
///
/// @remarks
/// _Analogues_
/// - **vkGetPhysicalDeviceQueueFamilyProperties**
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
ZE_APIEXPORT ze_result_t ZE_APICALL
zeDeviceGetCommandQueueGroupProperties(
ze_device_handle_t hDevice, ///< [in] handle of the device
uint32_t *pCount, ///< [in,out] pointer to the number of command queue group properties.
///< if count is zero, then the driver will update the value with the total
///< number of command queue group properties available.
///< if count is non-zero, then driver will only retrieve that number of
///< command queue group properties.
///< if count is larger than the number of command queue group properties
///< available, then the driver will update the value with the correct
///< number of command queue group properties available.
ze_command_queue_group_properties_t *pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for
///< command queue group properties
);
} //extern C
#endif // _ZE_API_EXT_H