mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 02:18:05 +08:00
Reduce the size of masks to 4.
32 is not required. Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
afc5596a0a
commit
3d5e34f727
@@ -1548,10 +1548,10 @@ HWTEST_F(EnqueueKernelTest, givenContextWithSeveralDevicesWhenEnqueueKernelThenD
|
|||||||
clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockMultiDeviceKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockMultiDeviceKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
||||||
EXPECT_FALSE(mockCsr->passedDispatchFlags.areMultipleSubDevicesInContext);
|
EXPECT_FALSE(mockCsr->passedDispatchFlags.areMultipleSubDevicesInContext);
|
||||||
|
|
||||||
context->deviceBitfields[rootDeviceIndex].set(7, true);
|
context->deviceBitfields[rootDeviceIndex].set(3, true);
|
||||||
clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockMultiDeviceKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockMultiDeviceKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
||||||
EXPECT_TRUE(mockCsr->passedDispatchFlags.areMultipleSubDevicesInContext);
|
EXPECT_TRUE(mockCsr->passedDispatchFlags.areMultipleSubDevicesInContext);
|
||||||
context->deviceBitfields[rootDeviceIndex].set(7, false);
|
context->deviceBitfields[rootDeviceIndex].set(3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(EnqueueKernelTest, givenNonVMEKernelWhenEnqueueKernelThenDispatchFlagsDoesntHaveMediaSamplerRequired) {
|
HWTEST_F(EnqueueKernelTest, givenNonVMEKernelWhenEnqueueKernelThenDispatchFlagsDoesntHaveMediaSamplerRequired) {
|
||||||
|
|||||||
@@ -158,11 +158,11 @@ TEST(SubDevicesTest, givenClDeviceWithSubDevicesWhenSubDeviceInternalRefCountsAr
|
|||||||
|
|
||||||
TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceCreationFailThenWholeDeviceIsDestroyed) {
|
TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceCreationFailThenWholeDeviceIsDestroyed) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
DebugManager.flags.CreateMultipleSubDevices.set(10);
|
DebugManager.flags.CreateMultipleSubDevices.set(4);
|
||||||
MockExecutionEnvironment executionEnvironment;
|
MockExecutionEnvironment executionEnvironment;
|
||||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
executionEnvironment.incRefInternal();
|
executionEnvironment.incRefInternal();
|
||||||
executionEnvironment.memoryManager.reset(new FailMemoryManager(10, executionEnvironment));
|
executionEnvironment.memoryManager.reset(new FailMemoryManager(4, executionEnvironment));
|
||||||
auto device = Device::create<RootDevice>(&executionEnvironment, 0u);
|
auto device = Device::create<RootDevice>(&executionEnvironment, 0u);
|
||||||
EXPECT_EQ(nullptr, device);
|
EXPECT_EQ(nullptr, device);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace NEO {
|
|||||||
|
|
||||||
class AffinityMaskHelper {
|
class AffinityMaskHelper {
|
||||||
public:
|
public:
|
||||||
using AffinityMaskContainer = std::vector<std::bitset<32>>;
|
using AffinityMaskContainer = std::vector<std::bitset<4>>;
|
||||||
|
|
||||||
AffinityMaskHelper(bool allSubdevicesActive) {
|
AffinityMaskHelper(bool allSubdevicesActive) {
|
||||||
if (!allSubdevicesActive) {
|
if (!allSubdevicesActive) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
namespace NEO {
|
namespace NEO {
|
||||||
struct EngineControl;
|
struct EngineControl;
|
||||||
using EngineControlContainer = std::vector<EngineControl>;
|
using EngineControlContainer = std::vector<EngineControl>;
|
||||||
using DeviceBitfield = std::bitset<32>;
|
using DeviceBitfield = std::bitset<4>;
|
||||||
class Device;
|
class Device;
|
||||||
using DeviceVector = std::vector<std::unique_ptr<Device>>;
|
using DeviceVector = std::vector<std::unique_ptr<Device>>;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void LocalMemoryUsageBankSelector::reserveOnBank(uint32_t bankIndex, uint64_t al
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LocalMemoryUsageBankSelector::updateUsageInfo(uint32_t memoryBanks, uint64_t allocationSize, bool reserve) {
|
void LocalMemoryUsageBankSelector::updateUsageInfo(uint32_t memoryBanks, uint64_t allocationSize, bool reserve) {
|
||||||
auto banks = std::bitset<32>(memoryBanks);
|
auto banks = std::bitset<4>(memoryBanks);
|
||||||
for (uint32_t bankIndex = 0; bankIndex < banks.size() && bankIndex < banksCount; bankIndex++) {
|
for (uint32_t bankIndex = 0; bankIndex < banks.size() && bankIndex < banksCount; bankIndex++) {
|
||||||
if (banks.test(bankIndex)) {
|
if (banks.test(bankIndex)) {
|
||||||
if (reserve) {
|
if (reserve) {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ bool HwInfoConfigHw<gfxProduct>::getConcurrentAccessMemCapabilitiesSupported(Usm
|
|||||||
auto supported = false;
|
auto supported = false;
|
||||||
|
|
||||||
if (DebugManager.flags.EnableUsmConcurrentAccessSupport.get() > 0) {
|
if (DebugManager.flags.EnableUsmConcurrentAccessSupport.get() > 0) {
|
||||||
auto capabilityBitset = std::bitset<32>(DebugManager.flags.EnableUsmConcurrentAccessSupport.get());
|
auto capabilityBitset = std::bitset<4>(DebugManager.flags.EnableUsmConcurrentAccessSupport.get());
|
||||||
supported = capabilityBitset.test(static_cast<uint32_t>(capability));
|
supported = capabilityBitset.test(static_cast<uint32_t>(capability));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1495,7 +1495,7 @@ BufferObject *DrmMemoryManager::createBufferObjectInMemoryRegion(Drm *drm, Gmm *
|
|||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
uint32_t ret = 0;
|
uint32_t ret = 0;
|
||||||
|
|
||||||
auto banks = std::bitset<32>(memoryBanks);
|
auto banks = std::bitset<4>(memoryBanks);
|
||||||
if (banks.count() > 1) {
|
if (banks.count() > 1) {
|
||||||
ret = memoryInfo->createGemExtWithMultipleRegions(memoryBanks, size, handle);
|
ret = memoryInfo->createGemExtWithMultipleRegions(memoryBanks, size, handle);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ uint32_t MemoryInfo::createGemExtWithSingleRegion(uint32_t memoryBanks, size_t a
|
|||||||
|
|
||||||
uint32_t MemoryInfo::createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) {
|
uint32_t MemoryInfo::createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) {
|
||||||
auto pHwInfo = this->drm.getRootDeviceEnvironment().getHardwareInfo();
|
auto pHwInfo = this->drm.getRootDeviceEnvironment().getHardwareInfo();
|
||||||
auto banks = std::bitset<32>(memoryBanks);
|
auto banks = std::bitset<4>(memoryBanks);
|
||||||
MemRegionsVec memRegions{};
|
MemRegionsVec memRegions{};
|
||||||
size_t currentBank = 0;
|
size_t currentBank = 0;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2021 Intel Corporation
|
* Copyright (C) 2018-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -15,7 +15,7 @@ namespace NEO {
|
|||||||
class CommandStreamReceiver;
|
class CommandStreamReceiver;
|
||||||
class ExecutionEnvironment;
|
class ExecutionEnvironment;
|
||||||
|
|
||||||
using DeviceBitfield = std::bitset<32>;
|
using DeviceBitfield = std::bitset<4>;
|
||||||
|
|
||||||
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment,
|
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment,
|
||||||
uint32_t rootDeviceIndex,
|
uint32_t rootDeviceIndex,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2021 Intel Corporation
|
* Copyright (C) 2019-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -76,7 +76,7 @@ TEST(localMemoryUsageTest, givenOverrideLeastOccupiedBankDebugFlagWhenGetLeastOc
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(localMemoryUsageTest, givenLocalMemoryUsageBankSelectorWhenMemoryAllocatedSeveralTimesThenItIsStoredOnDifferentBanks) {
|
TEST(localMemoryUsageTest, givenLocalMemoryUsageBankSelectorWhenMemoryAllocatedSeveralTimesThenItIsStoredOnDifferentBanks) {
|
||||||
MockLocalMemoryUsageBankSelector selector(5u);
|
MockLocalMemoryUsageBankSelector selector(4u);
|
||||||
|
|
||||||
uint64_t allocationSize = 1024u;
|
uint64_t allocationSize = 1024u;
|
||||||
|
|
||||||
@@ -88,8 +88,6 @@ TEST(localMemoryUsageTest, givenLocalMemoryUsageBankSelectorWhenMemoryAllocatedS
|
|||||||
selector.reserveOnBank(bankIndex, allocationSize);
|
selector.reserveOnBank(bankIndex, allocationSize);
|
||||||
bankIndex = selector.getLeastOccupiedBank(selector.bitfield);
|
bankIndex = selector.getLeastOccupiedBank(selector.bitfield);
|
||||||
selector.reserveOnBank(bankIndex, allocationSize);
|
selector.reserveOnBank(bankIndex, allocationSize);
|
||||||
bankIndex = selector.getLeastOccupiedBank(selector.bitfield);
|
|
||||||
selector.reserveOnBank(bankIndex, allocationSize);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < selector.banksCount; i++) {
|
for (uint32_t i = 0; i < selector.banksCount; i++) {
|
||||||
EXPECT_EQ(allocationSize, selector.getOccupiedMemorySizeForBank(i));
|
EXPECT_EQ(allocationSize, selector.getOccupiedMemorySizeForBank(i));
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenGettingMemoryCapabilitiesThenCor
|
|||||||
|
|
||||||
auto hwInfoConfig = HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
|
auto hwInfoConfig = HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
|
||||||
|
|
||||||
for (auto capabilityBitmask : {0, 0b0001, 0b0010, 0b0100, 0b1000, 0b1111, 0b10000}) {
|
for (auto capabilityBitmask : {0, 0b0001, 0b0010, 0b0100, 0b1000, 0b1111}) {
|
||||||
DebugManager.flags.EnableUsmConcurrentAccessSupport.set(capabilityBitmask);
|
DebugManager.flags.EnableUsmConcurrentAccessSupport.set(capabilityBitmask);
|
||||||
std::bitset<32> capabilityBitset(capabilityBitmask);
|
std::bitset<4> capabilityBitset(capabilityBitmask);
|
||||||
|
|
||||||
auto hostMemCapabilities = hwInfoConfig->getHostMemCapabilities(&pInHwInfo);
|
auto hostMemCapabilities = hwInfoConfig->getHostMemCapabilities(&pInHwInfo);
|
||||||
if (hostMemCapabilities > 0) {
|
if (hostMemCapabilities > 0) {
|
||||||
|
|||||||
@@ -705,7 +705,7 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsThenImplicitVmIdPer
|
|||||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||||
|
|
||||||
auto &drmVmIds = osContext.getDrmVmIds();
|
auto &drmVmIds = osContext.getDrmVmIds();
|
||||||
EXPECT_EQ(32u, drmVmIds.size());
|
EXPECT_EQ(4u, drmVmIds.size());
|
||||||
|
|
||||||
EXPECT_EQ(20u, drmVmIds[0]);
|
EXPECT_EQ(20u, drmVmIds[0]);
|
||||||
}
|
}
|
||||||
@@ -718,7 +718,7 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextForSubDeviceThenImpl
|
|||||||
DrmMock drmMock(rootEnv);
|
DrmMock drmMock(rootEnv);
|
||||||
EXPECT_TRUE(drmMock.requirePerContextVM);
|
EXPECT_TRUE(drmMock.requirePerContextVM);
|
||||||
|
|
||||||
drmMock.storedRetValForVmId = 20;
|
drmMock.storedRetValForVmId = 4;
|
||||||
DeviceBitfield deviceBitfield(1 << 3);
|
DeviceBitfield deviceBitfield(1 << 3);
|
||||||
|
|
||||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
||||||
@@ -726,9 +726,9 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextForSubDeviceThenImpl
|
|||||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||||
|
|
||||||
auto &drmVmIds = osContext.getDrmVmIds();
|
auto &drmVmIds = osContext.getDrmVmIds();
|
||||||
EXPECT_EQ(32u, drmVmIds.size());
|
EXPECT_EQ(4u, drmVmIds.size());
|
||||||
|
|
||||||
EXPECT_EQ(20u, drmVmIds[3]);
|
EXPECT_EQ(4u, drmVmIds[3]);
|
||||||
|
|
||||||
EXPECT_EQ(0u, drmVmIds[0]);
|
EXPECT_EQ(0u, drmVmIds[0]);
|
||||||
EXPECT_EQ(0u, drmVmIds[2]);
|
EXPECT_EQ(0u, drmVmIds[2]);
|
||||||
@@ -742,7 +742,7 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsForRootDeviceThenIm
|
|||||||
DrmMock drmMock(rootEnv);
|
DrmMock drmMock(rootEnv);
|
||||||
EXPECT_TRUE(drmMock.requirePerContextVM);
|
EXPECT_TRUE(drmMock.requirePerContextVM);
|
||||||
|
|
||||||
drmMock.storedRetValForVmId = 20;
|
drmMock.storedRetValForVmId = 4;
|
||||||
DeviceBitfield deviceBitfield(1 | 1 << 1);
|
DeviceBitfield deviceBitfield(1 | 1 << 1);
|
||||||
|
|
||||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
||||||
@@ -750,13 +750,12 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsForRootDeviceThenIm
|
|||||||
EXPECT_EQ(2 * 2u, drmMock.receivedContextParamRequestCount);
|
EXPECT_EQ(2 * 2u, drmMock.receivedContextParamRequestCount);
|
||||||
|
|
||||||
auto &drmVmIds = osContext.getDrmVmIds();
|
auto &drmVmIds = osContext.getDrmVmIds();
|
||||||
EXPECT_EQ(32u, drmVmIds.size());
|
EXPECT_EQ(4u, drmVmIds.size());
|
||||||
|
|
||||||
EXPECT_EQ(20u, drmVmIds[0]);
|
EXPECT_EQ(4u, drmVmIds[0]);
|
||||||
EXPECT_EQ(20u, drmVmIds[1]);
|
EXPECT_EQ(4u, drmVmIds[1]);
|
||||||
|
|
||||||
EXPECT_EQ(0u, drmVmIds[2]);
|
EXPECT_EQ(0u, drmVmIds[2]);
|
||||||
EXPECT_EQ(0u, drmVmIds[31]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedAndStored) {
|
TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedAndStored) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2020 Intel Corporation
|
* Copyright (C) 2019-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
TEST(UnifiedMemoryTests, givenInternalMemoryTypesThenAllHaveOnlyOneBitSet) {
|
TEST(UnifiedMemoryTests, givenInternalMemoryTypesThenAllHaveOnlyOneBitSet) {
|
||||||
EXPECT_EQ(1u, std::bitset<32>(InternalMemoryType::DEVICE_UNIFIED_MEMORY).count());
|
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::DEVICE_UNIFIED_MEMORY).count());
|
||||||
EXPECT_EQ(1u, std::bitset<32>(InternalMemoryType::HOST_UNIFIED_MEMORY).count());
|
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::HOST_UNIFIED_MEMORY).count());
|
||||||
EXPECT_EQ(1u, std::bitset<32>(InternalMemoryType::SHARED_UNIFIED_MEMORY).count());
|
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SHARED_UNIFIED_MEMORY).count());
|
||||||
EXPECT_EQ(1u, std::bitset<32>(InternalMemoryType::SVM).count());
|
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SVM).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UnifiedMemoryTests, givenUnifiedMemoryControlsWhenDedicatedFieldsAreSetThenMaskIsProperlyGenerated) {
|
TEST(UnifiedMemoryTests, givenUnifiedMemoryControlsWhenDedicatedFieldsAreSetThenMaskIsProperlyGenerated) {
|
||||||
|
|||||||
Reference in New Issue
Block a user