performance: Use vector for private allocs to reuse

Related-To: HSD-18033105655, HSD-18033153203

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2023-09-04 09:42:02 +00:00
committed by Compute-Runtime-Automation
parent 91b26277a4
commit 3b3e17e738
9 changed files with 30 additions and 19 deletions

View File

@@ -571,7 +571,7 @@ ResidencyContainer &CommandStreamReceiver::getResidencyAllocations() {
ResidencyContainer &CommandStreamReceiver::getEvictionAllocations() {
return this->evictionAllocations;
}
std::unordered_map<uint32_t, GraphicsAllocation *> &CommandStreamReceiver::getOwnedPrivateAllocations() {
PrivateAllocsToReuseContainer &CommandStreamReceiver::getOwnedPrivateAllocations() {
return this->ownedPrivateAllocations;
}

View File

@@ -11,6 +11,7 @@
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/helpers/blit_properties_container.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/common_types.h"
#include "shared/source/helpers/completion_stamp.h"
#include "shared/source/helpers/options.h"
#include "shared/source/utilities/spinlock.h"
@@ -118,7 +119,7 @@ class CommandStreamReceiver {
ResidencyContainer &getResidencyAllocations();
ResidencyContainer &getEvictionAllocations();
std::unordered_map<uint32_t, GraphicsAllocation *> &getOwnedPrivateAllocations();
PrivateAllocsToReuseContainer &getOwnedPrivateAllocations();
virtual GmmPageTableMngr *createPageTableManager() { return nullptr; }
bool needsPageTableManager() const;
@@ -461,7 +462,7 @@ class CommandStreamReceiver {
ResidencyContainer residencyAllocations;
ResidencyContainer evictionAllocations;
std::unordered_map<uint32_t, GraphicsAllocation *> ownedPrivateAllocations;
PrivateAllocsToReuseContainer ownedPrivateAllocations;
MutexType ownershipMutex;
MutexType hostPtrSurfaceCreationMutex;

View File

@@ -13,11 +13,13 @@
#include <vector>
namespace NEO {
class GraphicsAllocation;
struct EngineControl;
using EngineControlContainer = std::vector<EngineControl>;
using MultiDeviceEngineControlContainer = StackVec<EngineControlContainer, 6u>;
class Device;
using DeviceVector = std::vector<std::unique_ptr<Device>>;
using PrivateAllocsToReuseContainer = StackVec<std::pair<uint32_t, GraphicsAllocation *>, 8>;
enum class DebugPauseState : uint32_t {
disabled,

View File

@@ -4491,7 +4491,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCsrWhenCleanUpResourcesThenOwnedPrivate
auto mockGA = std::make_unique<MockGraphicsAllocation>();
auto mapForReuse = &csr.getOwnedPrivateAllocations();
mapForReuse->insert({0x100, mockGA.release()});
mapForReuse->push_back({0x100, mockGA.release()});
csr.cleanupResources();
EXPECT_EQ(mapForReuse->size(), 0u);
}