mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
Remove programCount from device
Change-Id: I4edfabadd73166a27db73a120fc1380de52a33a5
This commit is contained in:
committed by
sys_ocldev
parent
78f505f4f4
commit
8598168355
@@ -112,8 +112,6 @@ class Device : public BaseObject<_cl_device_id> {
|
|||||||
unique_ptr_if_unused<Device> release() override;
|
unique_ptr_if_unused<Device> release() override;
|
||||||
OSTime *getOSTime() const { return osTime.get(); };
|
OSTime *getOSTime() const { return osTime.get(); };
|
||||||
double getProfilingTimerResolution();
|
double getProfilingTimerResolution();
|
||||||
void increaseProgramCount() { programCount++; }
|
|
||||||
uint64_t getProgramCount() { return programCount; }
|
|
||||||
unsigned int getEnabledClVersion() const { return enabledClVersion; };
|
unsigned int getEnabledClVersion() const { return enabledClVersion; };
|
||||||
unsigned int getSupportedClVersion() const;
|
unsigned int getSupportedClVersion() const;
|
||||||
double getPlatformHostTimerResolution() const;
|
double getPlatformHostTimerResolution() const;
|
||||||
@@ -162,7 +160,6 @@ class Device : public BaseObject<_cl_device_id> {
|
|||||||
std::unique_ptr<OSTime> osTime;
|
std::unique_ptr<OSTime> osTime;
|
||||||
std::unique_ptr<DriverInfo> driverInfo;
|
std::unique_ptr<DriverInfo> driverInfo;
|
||||||
std::unique_ptr<PerformanceCounters> performanceCounters;
|
std::unique_ptr<PerformanceCounters> performanceCounters;
|
||||||
uint64_t programCount = 0u;
|
|
||||||
|
|
||||||
void *slmWindowStartAddress;
|
void *slmWindowStartAddress;
|
||||||
|
|
||||||
|
|||||||
@@ -282,12 +282,6 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemory(size_t size, const
|
|||||||
auto res = allocatorToUse->allocate(allocationSize);
|
auto res = allocatorToUse->allocate(allocationSize);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION && device && device->getProgramCount() == 0) {
|
|
||||||
this->force32bitAllocations = false;
|
|
||||||
device->setForce32BitAddressing(false);
|
|
||||||
return (DrmAllocation *)allocateGraphicsMemoryInPreferredPool(ptr == nullptr, ptr, static_cast<size_t>(size), GraphicsAllocation::AllocationType::BUFFER);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ Program::Program(Context *context, bool isBuiltIn) : context(context), isBuiltIn
|
|||||||
if (force32BitAddressess) {
|
if (force32BitAddressess) {
|
||||||
internalOptions += "-m32 ";
|
internalOptions += "-m32 ";
|
||||||
}
|
}
|
||||||
pDevice->increaseProgramCount();
|
|
||||||
|
|
||||||
if (DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
|
if (DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
|
||||||
internalOptions += "-cl-intel-greater-than-4GB-buffer-required ";
|
internalOptions += "-cl-intel-greater-than-4GB-buffer-required ";
|
||||||
|
|||||||
@@ -1050,58 +1050,6 @@ TEST_F(DrmMemoryManagerTest, GivenSizeAbove2GBWhenAllocHostPtrAndUseHostPtrAreCr
|
|||||||
|
|
||||||
delete buffer;
|
delete buffer;
|
||||||
}
|
}
|
||||||
TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExhaustedThenOptimizationIsTurningOfIfNoProgramsAreCreated) {
|
|
||||||
mock->ioctl_expected.gemUserptr = 1;
|
|
||||||
mock->ioctl_expected.gemWait = 1;
|
|
||||||
mock->ioctl_expected.gemClose = 1;
|
|
||||||
|
|
||||||
DebugManagerStateRestore dbgRestorer;
|
|
||||||
DebugManager.flags.Force32bitAddressing.set(true);
|
|
||||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
|
||||||
memoryManager->device = pDevice.get();
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
|
||||||
|
|
||||||
mockAllocator32Bit::resetState();
|
|
||||||
fail32BitMmap = true;
|
|
||||||
failLowerRanger = true;
|
|
||||||
failUpperRange = true;
|
|
||||||
failMmap = true;
|
|
||||||
mockAllocator32Bit::OsInternalsPublic *osInternals = mockAllocator32Bit::createOsInternals();
|
|
||||||
osInternals->mmapFunction = MockMmap;
|
|
||||||
osInternals->munmapFunction = MockMunmap;
|
|
||||||
std::unique_ptr<mockAllocator32Bit> mock32BitAllocator(new mockAllocator32Bit(osInternals));
|
|
||||||
|
|
||||||
memoryManager->allocator32Bit.reset(mock32BitAllocator.release());
|
|
||||||
|
|
||||||
//ask for 4GB
|
|
||||||
auto allocationSize = 4096u;
|
|
||||||
bool force32Bit = memoryManager->peekForce32BitAllocations();
|
|
||||||
EXPECT_TRUE(force32Bit);
|
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(true, nullptr, static_cast<size_t>(allocationSize), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
|
||||||
EXPECT_NE(nullptr, graphicsAllocation);
|
|
||||||
EXPECT_FALSE(pDevice->getDeviceInfo().force32BitAddressess);
|
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExhaustedAndThereAreProgramsThenOptimizationIsStillOnAndFailureIsReturned) {
|
|
||||||
mock->ioctl_expected.reset();
|
|
||||||
|
|
||||||
DebugManagerStateRestore dbgRestorer;
|
|
||||||
DebugManager.flags.Force32bitAddressing.set(true);
|
|
||||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
|
||||||
pDevice->increaseProgramCount();
|
|
||||||
memoryManager->device = pDevice.get();
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
|
||||||
|
|
||||||
//ask for 4GB - 1
|
|
||||||
size_t allocationSize = (4 * 1023 * 1024 * (size_t)1024u - 1) + 4 * 1024 * (size_t)1024u;
|
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(true, nullptr, static_cast<size_t>(allocationSize), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
|
||||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
|
||||||
EXPECT_TRUE(pDevice->getDeviceInfo().force32BitAddressess);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIsExhaustedAndNewAllocationsIsMadeThenNullIsReturned) {
|
TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIsExhaustedAndNewAllocationsIsMadeThenNullIsReturned) {
|
||||||
DebugManagerStateRestore dbgStateRestore;
|
DebugManagerStateRestore dbgStateRestore;
|
||||||
|
|||||||
@@ -2569,13 +2569,6 @@ TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCrea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Program32BitTests, givenDeviceWhenProgramIsCreatedThenProgramCountInDeviceIncreases) {
|
|
||||||
auto device = pContext->getDevice(0);
|
|
||||||
EXPECT_EQ(0u, device->getProgramCount());
|
|
||||||
MockProgram pProgram(pContext, false);
|
|
||||||
EXPECT_EQ(1u, device->getProgramCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizationIsMatchingThePlatformEnablingStatus) {
|
TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizationIsMatchingThePlatformEnablingStatus) {
|
||||||
MockProgram prog(pContext, false);
|
MockProgram prog(pContext, false);
|
||||||
auto &internalOpts = prog.getInternalOptions();
|
auto &internalOpts = prog.getInternalOptions();
|
||||||
|
|||||||
Reference in New Issue
Block a user