mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Use HEAP_STANDARD64Kb when cpu access is required
Change-Id: I3a451b618f1b72836cd640ed510e874cf2d60624 Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
aa587b3bc5
commit
ed6381a66a
@ -164,6 +164,13 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
|
||||
virtual std::string getAllocationInfoString() const;
|
||||
|
||||
static bool isCpuAccessRequired(AllocationType allocationType) {
|
||||
return allocationType == AllocationType::LINEAR_STREAM ||
|
||||
allocationType == AllocationType::KERNEL_ISA ||
|
||||
allocationType == AllocationType::INTERNAL_HEAP ||
|
||||
allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
|
||||
}
|
||||
|
||||
protected:
|
||||
constexpr static uint32_t objectNotResident = (uint32_t)-1;
|
||||
constexpr static uint32_t objectNotUsed = (uint32_t)-1;
|
||||
|
@ -274,17 +274,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
case GraphicsAllocation::AllocationType::KERNEL_ISA:
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
allocationData.flags.requiresCpuAccess = GraphicsAllocation::isCpuAccessRequired(properties.allocationType);
|
||||
allocationData.flags.mustBeZeroCopy = mustBeZeroCopy;
|
||||
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
|
||||
allocationData.flags.allow32Bit = allow32Bit;
|
||||
|
@ -1006,6 +1006,9 @@ HeapIndex Wddm::selectHeap(const WddmAllocation *allocation, const void *ptr) co
|
||||
if (ptr) {
|
||||
return HeapIndex::HEAP_SVM;
|
||||
}
|
||||
if (allocation && GraphicsAllocation::isCpuAccessRequired(allocation->getAllocationType())) {
|
||||
return HeapIndex::HEAP_STANDARD64Kb;
|
||||
}
|
||||
return HeapIndex::HEAP_STANDARD;
|
||||
}
|
||||
return HeapIndex::HEAP_LIMITED;
|
||||
|
@ -112,3 +112,19 @@ TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenCheckIfResidency
|
||||
EXPECT_TRUE(graphicsAllocation.isResident(0u));
|
||||
EXPECT_TRUE(graphicsAllocation.isResidencyTaskCountBelow(currentResidencyTaskCount + 1u, 0u));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsLinearStreamThenCpuAccessIsRequired) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::LINEAR_STREAM));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsKernelIsaThenCpuAccessIsRequired) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::KERNEL_ISA));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsInternalHeapThenCpuAccessIsRequired) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::INTERNAL_HEAP));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsTimestampPacketThenCpuAccessIsRequired) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -27,6 +27,8 @@ BOOLEAN WINAPI DllMain(IN HINSTANCE hDllHandle,
|
||||
case DLL_PROCESS_ATTACH:
|
||||
gAdapterInfo.GfxPartition.Standard.Base = 0x0000800400000000;
|
||||
gAdapterInfo.GfxPartition.Standard.Limit = 0x0000eeffffffffff;
|
||||
gAdapterInfo.GfxPartition.Standard64KB.Base = 0x0000b80200000000;
|
||||
gAdapterInfo.GfxPartition.Standard64KB.Limit = 0x0000efffffffffff;
|
||||
gAdapterInfo.GfxPartition.SVM.Base = 0;
|
||||
gAdapterInfo.GfxPartition.SVM.Limit = 0x00007fffffffffff;
|
||||
gAdapterInfo.GfxPartition.Heap32[0].Base = 0x0000800000000000;
|
||||
@ -287,6 +289,8 @@ NTSTATUS __stdcall D3DKMTQueryAdapterInfo(IN CONST D3DKMT_QUERYADAPTERINFO *quer
|
||||
|
||||
adapterInfo->GfxPartition.Standard.Base = gAdapterInfo.GfxPartition.Standard.Base;
|
||||
adapterInfo->GfxPartition.Standard.Limit = gAdapterInfo.GfxPartition.Standard.Limit;
|
||||
adapterInfo->GfxPartition.Standard64KB.Base = gAdapterInfo.GfxPartition.Standard64KB.Base;
|
||||
adapterInfo->GfxPartition.Standard64KB.Limit = gAdapterInfo.GfxPartition.Standard64KB.Limit;
|
||||
|
||||
adapterInfo->GfxPartition.SVM.Base = gAdapterInfo.GfxPartition.SVM.Base;
|
||||
adapterInfo->GfxPartition.SVM.Limit = gAdapterInfo.GfxPartition.SVM.Limit;
|
||||
|
@ -1030,9 +1030,24 @@ TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAl
|
||||
}
|
||||
EXPECT_EQ(HeapIndex::HEAP_SVM, wddm->selectHeap(&allocation, &allocation));
|
||||
}
|
||||
TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrThenStandardHeapIsUsed) {
|
||||
TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndCpuAccessIsRequiredThenStandard64kHeapIsUsed) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(AllocationOrigin::EXTERNAL_ALLOCATION, allocation.origin);
|
||||
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
|
||||
allocation.setAllocationType(allocationType);
|
||||
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(allocationType));
|
||||
if (hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily]->capabilityTable.gpuAddressSpace != MemoryConstants::max48BitAddress) {
|
||||
return;
|
||||
}
|
||||
EXPECT_EQ(HeapIndex::HEAP_STANDARD64Kb, wddm->selectHeap(&allocation, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(WddmHeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndCpuAccessIsNotRequiredThenStandardHeapIsUsed) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(AllocationOrigin::EXTERNAL_ALLOCATION, allocation.origin);
|
||||
auto allocationType = GraphicsAllocation::AllocationType::UNDECIDED;
|
||||
allocation.setAllocationType(allocationType);
|
||||
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(allocationType));
|
||||
if (hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily]->capabilityTable.gpuAddressSpace != MemoryConstants::max48BitAddress) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user