In level zero create single tag allocation for csr

Multi tag allocation is useful only in openCL to ensure cross root
device synchronization based on tag address.
It is not required in level zero.
Futher multi tag allocation is causing instability in sysman
device reset. So, for level zero instead of multi tag allocation
create single tag allocation.

Related-To: LOCI-2651

Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma 2021-12-03 17:48:12 +00:00 committed by Compute-Runtime-Automation
parent 0ad8afc0b3
commit 8b51358054
3 changed files with 47 additions and 5 deletions

View File

@ -16,6 +16,7 @@
#include "shared/source/direct_submission/direct_submission_controller.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/page_table_mngr.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/array_count.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/flush_stamp.h"
@ -330,10 +331,14 @@ void CommandStreamReceiver::setTagAllocation(GraphicsAllocation *allocation) {
MultiGraphicsAllocation &CommandStreamReceiver::createTagsMultiAllocation() {
std::vector<uint32_t> rootDeviceIndices;
for (auto index = 0u; index < this->executionEnvironment.rootDeviceEnvironments.size(); index++) {
if (this->executionEnvironment.rootDeviceEnvironments[index].get()->getHardwareInfo()->platform.eProductFamily ==
this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex].get()->getHardwareInfo()->platform.eProductFamily) {
rootDeviceIndices.push_back(index);
if (ApiSpecificConfig::getApiType() == ApiSpecificConfig::L0) {
rootDeviceIndices.push_back(rootDeviceIndex);
} else {
for (auto index = 0u; index < this->executionEnvironment.rootDeviceEnvironments.size(); index++) {
if (this->executionEnvironment.rootDeviceEnvironments[index].get()->getHardwareInfo()->platform.eProductFamily ==
this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex].get()->getHardwareInfo()->platform.eProductFamily) {
rootDeviceIndices.push_back(index);
}
}
}

View File

@ -9,6 +9,7 @@
#include "shared/source/helpers/api_specific_config.h"
namespace NEO {
ApiSpecificConfig::ApiType apiTypeForUlts = ApiSpecificConfig::OCL;
bool ApiSpecificConfig::isStatelessCompressionSupported() {
return ApiSpecificConfig::ApiType::OCL == ApiSpecificConfig::getApiType();
}
@ -22,8 +23,9 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
return false;
}
}
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return ApiSpecificConfig::OCL;
return apiTypeForUlts;
}
uint64_t ApiSpecificConfig::getReducedMaxAllocSize(uint64_t maxAllocSize) {

View File

@ -8,6 +8,7 @@
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/command_stream/command_stream_receiver_simulated_hw.h"
#include "shared/source/gmm_helper/page_table_mngr.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/surface.h"
#include "shared/source/os_interface/device_factory.h"
@ -30,6 +31,9 @@
#include "gmock/gmock.h"
namespace NEO {
extern ApiSpecificConfig::ApiType apiTypeForUlts;
} // namespace NEO
using namespace NEO;
struct CommandStreamReceiverTest : public DeviceFixture,
@ -796,6 +800,37 @@ HWTEST_F(CommandStreamReceiverTest, givenUltCommandStreamReceiverWhenAddAubComme
EXPECT_TRUE(csr.addAubCommentCalled);
}
TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTagAllocationForOpenCLThenMultiTagAllocationIsBeingAllocated) {
VariableBackup<ApiSpecificConfig::ApiType> backup(&apiTypeForUlts, ApiSpecificConfig::OCL);
uint32_t numRootDevices = 10u;
UltDeviceFactory deviceFactory{numRootDevices, 0};
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_TRUE(deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress() != nullptr);
EXPECT_EQ(*deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress(), initialHardwareTag);
auto tagsMultiAllocation = deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagsMultiAllocation();
auto graphicsAllocation0 = tagsMultiAllocation->getGraphicsAllocation(0);
EXPECT_EQ(tagsMultiAllocation->getGraphicsAllocations().size(), numRootDevices);
for (auto graphicsAllocation : tagsMultiAllocation->getGraphicsAllocations()) {
if (graphicsAllocation != graphicsAllocation0) {
EXPECT_EQ(graphicsAllocation->getUnderlyingBuffer(), graphicsAllocation0->getUnderlyingBuffer());
}
}
}
TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenInitializeTagAllocationForLevelZeroThenSingleTagAllocationIsBeingAllocated) {
VariableBackup<ApiSpecificConfig::ApiType> backup(&apiTypeForUlts, ApiSpecificConfig::L0);
uint32_t numRootDevices = 10u;
UltDeviceFactory deviceFactory{numRootDevices, 0};
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation());
EXPECT_EQ(GraphicsAllocation::AllocationType::TAG_BUFFER, deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAllocation()->getAllocationType());
EXPECT_TRUE(deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress() != nullptr);
EXPECT_EQ(*deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagAddress(), initialHardwareTag);
auto tagsMultiAllocation = deviceFactory.rootDevices[0]->commandStreamReceivers[0]->getTagsMultiAllocation();
EXPECT_EQ(tagsMultiAllocation->getGraphicsAllocations().size(), 1u);
}
TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroyedThenItDestroysTagAllocation) {
struct MockGraphicsAllocationWithDestructorTracing : public MockGraphicsAllocation {
using MockGraphicsAllocation::MockGraphicsAllocation;