mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
OpenCL Queue Families extension 15/n
Add queue family name. This change will break backwards-compatibility. Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
22c25a231e
commit
320a404a91
@ -178,8 +178,10 @@ using cl_unified_shared_memory_capabilities_intel = cl_bitfield;
|
||||
|
||||
typedef cl_bitfield cl_command_queue_capabilities_intel;
|
||||
|
||||
#define CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL 64
|
||||
typedef struct _cl_queue_family_properties_intel {
|
||||
cl_command_queue_properties properties;
|
||||
cl_command_queue_capabilities_intel capabilities;
|
||||
cl_uint count;
|
||||
char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL];
|
||||
} cl_queue_family_properties_intel;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "shared/source/device/sub_device.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/program/sync_buffer_handler.h"
|
||||
@ -243,4 +244,31 @@ cl_command_queue_capabilities_intel ClDevice::getQueueFamilyCapabilities(EngineG
|
||||
return CL_QUEUE_DEFAULT_CAPABILITIES_INTEL;
|
||||
}
|
||||
|
||||
void ClDevice::getQueueFamilyName(char *outputName, size_t maxOutputNameLength, EngineGroupType type) {
|
||||
std::string name{};
|
||||
|
||||
const auto &clHwHelper = ClHwHelper::get(getHardwareInfo().platform.eRenderCoreFamily);
|
||||
const bool hasHwSpecificName = clHwHelper.getQueueFamilyName(name, type);
|
||||
|
||||
if (!hasHwSpecificName) {
|
||||
switch (type) {
|
||||
case EngineGroupType::RenderCompute:
|
||||
name = "rcs";
|
||||
break;
|
||||
case EngineGroupType::Compute:
|
||||
name = "ccs";
|
||||
break;
|
||||
case EngineGroupType::Copy:
|
||||
name = "bcs";
|
||||
break;
|
||||
default:
|
||||
name = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UNRECOVERABLE_IF(name.length() > maxOutputNameLength + 1);
|
||||
strncpy_s(outputName, maxOutputNameLength, name.c_str(), name.size());
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -125,6 +125,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||
|
||||
static cl_command_queue_capabilities_intel getQueueFamilyCapabilitiesAll();
|
||||
MOCKABLE_VIRTUAL cl_command_queue_capabilities_intel getQueueFamilyCapabilities(EngineGroupType type);
|
||||
void getQueueFamilyName(char *outputName, size_t maxOutputNameLength, EngineGroupType type);
|
||||
|
||||
protected:
|
||||
void initializeCaps();
|
||||
|
@ -369,6 +369,7 @@ void ClDevice::initializeCaps() {
|
||||
properties.capabilities = getQueueFamilyCapabilities(engineGroupType);
|
||||
properties.count = static_cast<cl_uint>(enginesInFamily.size());
|
||||
properties.properties = deviceInfo.queueOnHostProperties;
|
||||
getQueueFamilyName(properties.name, CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL, engineGroupType);
|
||||
deviceInfo.queueFamilyProperties.push_back(properties);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "engine_group_types.h"
|
||||
#include "igfxfmid.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class Context;
|
||||
@ -26,6 +28,7 @@ class ClHwHelper {
|
||||
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo) const = 0;
|
||||
virtual bool allowRenderCompressionForContext(const HardwareInfo &hwInfo, const Context &context) const = 0;
|
||||
virtual cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const = 0;
|
||||
virtual bool getQueueFamilyName(std::string &name, EngineGroupType type) const = 0;
|
||||
|
||||
protected:
|
||||
virtual bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const = 0;
|
||||
@ -45,6 +48,7 @@ class ClHwHelperHw : public ClHwHelper {
|
||||
bool requiresAuxResolves(const KernelInfo &kernelInfo) const override;
|
||||
bool allowRenderCompressionForContext(const HardwareInfo &hwInfo, const Context &context) const override;
|
||||
cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const override;
|
||||
bool getQueueFamilyName(std::string &name, EngineGroupType type) const override;
|
||||
|
||||
protected:
|
||||
bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const override;
|
||||
|
@ -42,4 +42,9 @@ inline bool ClHwHelperHw<GfxFamily>::allowRenderCompressionForContext(const Hard
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool ClHwHelperHw<GfxFamily>::getQueueFamilyName(std::string &name, EngineGroupType type) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "shared/test/unit_test/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/platform/extensions.h"
|
||||
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_builtins.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
@ -1492,3 +1493,19 @@ TEST_F(DeviceGetCapsTest, givenClDeviceWhenInitializingCapsThenUseGetQueueFamily
|
||||
device->initializeCaps();
|
||||
EXPECT_EQ(device->queueCaps, device->getDeviceInfo().queueFamilyProperties[0].capabilities);
|
||||
}
|
||||
|
||||
HWTEST_F(QueueFamilyNameTest, givenCcsWhenGettingQueueFamilyNameThenReturnProperValue) {
|
||||
verify(EngineGroupType::Compute, "ccs");
|
||||
}
|
||||
|
||||
HWTEST_F(QueueFamilyNameTest, givenRcsWhenGettingQueueFamilyNameThenReturnProperValue) {
|
||||
verify(EngineGroupType::RenderCompute, "rcs");
|
||||
}
|
||||
|
||||
HWTEST_F(QueueFamilyNameTest, givenBcsWhenGettingQueueFamilyNameThenReturnProperValue) {
|
||||
verify(EngineGroupType::Copy, "bcs");
|
||||
}
|
||||
|
||||
HWTEST_F(QueueFamilyNameTest, givenInvalidEngineGroupWhenGettingQueueFamilyNameThenReturnEmptyName) {
|
||||
verify(EngineGroupType::MaxEngineGroups, "");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -36,4 +36,19 @@ struct GetDeviceInfoMemCapabilitiesTest : ::testing::Test {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct QueueFamilyNameTest : ::testing::Test {
|
||||
void SetUp() override {
|
||||
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
}
|
||||
|
||||
void verify(EngineGroupType type, const char *expectedName) {
|
||||
char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL];
|
||||
device->getQueueFamilyName(name, sizeof(name), type);
|
||||
EXPECT_EQ(0, std::strcmp(name, expectedName));
|
||||
}
|
||||
|
||||
std::unique_ptr<MockClDevice> device = {};
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user