mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Fixes for AUBs
- pass aub usage in MockDevice to memory manager - disallow mapping on cpu for cpu inaccessible memory Change-Id: I5437a06efd4dd32940b603a15ff98a40091e2b04
This commit is contained in:

committed by
sys_ocldev

parent
90b21644ae
commit
4ea9f496d5
@ -335,6 +335,7 @@ bool MemObj::addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags,
|
||||
|
||||
bool MemObj::mappingOnCpuAllowed() const {
|
||||
return !allowTiling() && !peekSharingHandler() && !isMipMapped(this) && !DebugManager.flags.DisableZeroCopyForBuffers.get() &&
|
||||
!(graphicsAllocation->gmm && graphicsAllocation->gmm->isRenderCompressed);
|
||||
!(graphicsAllocation->gmm && graphicsAllocation->gmm->isRenderCompressed) &&
|
||||
MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool());
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
@ -344,6 +344,23 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
||||
}
|
||||
|
||||
TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
||||
MockMemoryManager memoryManager;
|
||||
MockContext context;
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(1);
|
||||
allocation->gmm = new Gmm(nullptr, 1, false);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
||||
reinterpret_cast<MemoryAllocation *>(allocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
|
||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||
}
|
||||
|
||||
TEST(MemObj, givenMultipleMemObjectsWithReusedGraphicsAllocationWhenDestroyedThenFreeAllocationOnce) {
|
||||
|
||||
MockMemoryManager memoryManager;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "runtime/os_interface/os_time.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "unit_tests/mocks/mock_ostime.h"
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
@ -26,7 +27,8 @@ MockDevice::MockDevice(const HardwareInfo &hwInfo)
|
||||
}
|
||||
OCLRT::MockDevice::MockDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex)
|
||||
: Device(hwInfo, executionEnvironment, deviceIndex) {
|
||||
this->mockMemoryManager.reset(new OsAgnosticMemoryManager(false, this->getHardwareCapabilities().localMemorySupported));
|
||||
bool aubUsage = (testMode == TestMode::AubTests) || (testMode == TestMode::AubTestsWithTbx);
|
||||
this->mockMemoryManager.reset(new OsAgnosticMemoryManager(false, this->getHardwareCapabilities().localMemorySupported, aubUsage));
|
||||
this->osTime = MockOSTime::create();
|
||||
mockWaTable = *hwInfo.pWaTable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user