Capability to exclude Engine on SubDevice

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-03-03 14:26:16 +00:00
committed by Compute-Runtime-Automation
parent 047a93fde6
commit 8b89fb8541
5 changed files with 85 additions and 2 deletions

View File

@ -70,11 +70,16 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
if (device) {
auto hwInfo = device->getHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
gpgpuEngine = &device->getDefaultEngine();
if (hwInfo.capabilityTable.blitterOperationsSupported || gpgpuEngine->commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
bool bcsAllowed = hwInfo.capabilityTable.blitterOperationsSupported &&
hwHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
if (bcsAllowed || gpgpuEngine->commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
}
if (hwInfo.capabilityTable.blitterOperationsSupported) {
if (bcsAllowed) {
auto &selectorCopyEngine = device->getDeviceById(0)->getSelectorCopyEngine();
bcsEngine = &device->getDeviceById(0)->getEngine(EngineHelpers::getBcsEngineType(hwInfo, selectorCopyEngine), false, false);
}

View File

@ -12,6 +12,8 @@
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_os_context.h"
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
#include "test.h"
@ -707,9 +709,20 @@ class MockHwHelper : public HwHelperHw<GfxFamily> {
}
}
bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override {
if ((deviceBitfield.to_ulong() == disableEngineSupportOnSubDevice) && (disabledSubDeviceEngineType == engineType)) {
return false;
}
return true;
}
static auto overrideHwHelper() {
return RAIIHwHelperFactory<MockHwHelper<GfxFamily, ccsCount, bcsCount>>{::defaultHwInfo->platform.eRenderCoreFamily};
}
uint64_t disableEngineSupportOnSubDevice = -1; // disabled by default
aub_stream::EngineType disabledSubDeviceEngineType = aub_stream::EngineType::ENGINE_BCS;
};
using GetDeviceInfoQueueFamilyTest = ::testing::Test;
@ -756,6 +769,59 @@ HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSubDeviceWhenInitializingCapsThenRet
EXPECT_EQ(clDevice.getDeviceInfo().queueOnHostProperties, families[1].properties);
}
HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSubDeviceWithoutSupportedEngineWhenInitializingCapsThenReturnCorrectFamilies) {
constexpr int bcsCount = 1;
using MockHwHelperT = MockHwHelper<FamilyType, 3, bcsCount>;
auto raiiHwHelper = MockHwHelperT::overrideHwHelper();
MockHwHelperT &mockHwHelper = static_cast<MockHwHelperT &>(raiiHwHelper.mockHwHelper);
mockHwHelper.disableEngineSupportOnSubDevice = 0b10; // subdevice 1
mockHwHelper.disabledSubDeviceEngineType = aub_stream::EngineType::ENGINE_BCS;
UltClDeviceFactory deviceFactory{1, 2};
ClDevice &clDevice0 = *deviceFactory.subDevices[0];
ClDevice &clDevice1 = *deviceFactory.subDevices[1];
size_t paramRetSize{};
cl_int retVal{};
// subdevice 0
{
cl_queue_family_properties_intel families[static_cast<int>(EngineGroupType::MaxEngineGroups)];
retVal = clDevice0.getDeviceInfo(CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL, sizeof(families), families, &paramRetSize);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(2u, paramRetSize / sizeof(cl_queue_family_properties_intel));
EXPECT_EQ(CL_QUEUE_DEFAULT_CAPABILITIES_INTEL, families[0].capabilities);
EXPECT_EQ(3u, families[0].count);
EXPECT_EQ(clDevice0.getDeviceInfo().queueOnHostProperties, families[0].properties);
EXPECT_EQ(clDevice0.getQueueFamilyCapabilities(EngineGroupType::Copy), families[1].capabilities);
EXPECT_EQ(1u, families[1].count);
EXPECT_EQ(clDevice0.getDeviceInfo().queueOnHostProperties, families[1].properties);
}
// subdevice 1
{
cl_queue_family_properties_intel families[static_cast<int>(EngineGroupType::MaxEngineGroups)];
retVal = clDevice1.getDeviceInfo(CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL, sizeof(families), families, &paramRetSize);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, paramRetSize / sizeof(cl_queue_family_properties_intel));
EXPECT_EQ(CL_QUEUE_DEFAULT_CAPABILITIES_INTEL, families[0].capabilities);
EXPECT_EQ(3u, families[0].count);
EXPECT_EQ(clDevice1.getDeviceInfo().queueOnHostProperties, families[0].properties);
clDevice1.getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
MockContext context(&clDevice1);
MockCommandQueue cmdQ(&context, &clDevice1, nullptr);
EXPECT_EQ(nullptr, cmdQ.getBcsCommandStreamReceiver());
}
}
HWTEST_F(GetDeviceInfoQueueFamilyTest, givenDeviceRootDeviceWhenInitializingCapsThenReturnDefaultFamily) {
UltClDeviceFactory deviceFactory{1, 2};
ClDevice &clDevice = *deviceFactory.rootDevices[0];

View File

@ -120,6 +120,10 @@ void Device::addEngineToEngineGroup(EngineControl &engine) {
const HwHelper &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
const EngineGroupType engineGroupType = hwHelper.getEngineGroupType(engine.getEngineType(), hardwareInfo);
if (!hwHelper.isSubDeviceEngineSupported(hardwareInfo, getDeviceBitfield(), engine.getEngineType())) {
return;
}
if (hwHelper.isCopyOnlyEngineType(engineGroupType) && DebugManager.flags.EnableBlitterOperationsSupport.get() == 0) {
return;
}

View File

@ -135,6 +135,7 @@ class HwHelper {
virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0;
virtual uint32_t getDefaultRevisionId(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getNumCacheRegions(const HardwareInfo &hwInfo) const = 0;
virtual bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@ -344,6 +345,8 @@ class HwHelperHw : public HwHelper {
uint32_t getNumCacheRegions(const HardwareInfo &hwInfo) const override;
bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override;
protected:
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

View File

@ -575,4 +575,9 @@ uint32_t HwHelperHw<GfxFamily>::getNumCacheRegions(const HardwareInfo &hwInfo) c
return 0;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const {
return true;
}
} // namespace NEO