2
0

SWDEV-356549 - del Null strm in destroyAllStreams

Change-Id: Ie04172ee39e6333247d07791dffda753a8b9ef41


[ROCm/clr commit: a643c199de]
Este cometimento está contido em:
pghafari
2022-09-29 00:02:20 -04:00
cometido por Payam Ghafari
ascendente 981137d2af
cometimento b0bc6d6c7e
5 ficheiros modificados com 29 adições e 6 eliminações
+15
Ver ficheiro
@@ -105,6 +105,21 @@ void Device::RemoveStreamFromPools(Stream* stream) {
}
}
// ================================================================================================
void Device::Reset() {
auto it = mem_pools_.begin();
while (it != mem_pools_.end()) {
auto current = it++;
(*current)->ReleaseAllMemory();
delete *current;
}
mem_pools_.clear();
flags_ = hipDeviceScheduleSpin;
hip::Stream::destroyAllStreams(deviceId_);
amd::MemObjMap::Purge(devices()[0]);
Create();
}
// ================================================================================================
Device::~Device() {
if (default_mem_pool_ != nullptr) {
+1 -3
Ver ficheiro
@@ -464,9 +464,7 @@ hipError_t hipDeviceGetSharedMemConfig ( hipSharedMemConfig * pConfig ) {
hipError_t hipDeviceReset ( void ) {
HIP_INIT_API(hipDeviceReset);
hip::Device* dev = hip::getCurrentDevice();
hip::Stream::destroyAllStreams(dev->deviceId());
amd::MemObjMap::Purge(dev->devices()[0]);
hip::getCurrentDevice()->Reset();
HIP_RETURN(hipSuccess);
}
+2
Ver ficheiro
@@ -428,6 +428,8 @@ namespace hip {
}
unsigned int getFlags() const { return flags_; }
void setFlags(unsigned int flags) { flags_ = flags; }
void Reset();
amd::HostQueue* NullStream(bool skip_alloc = false);
Stream* GetNullStream();
+7
Ver ficheiro
@@ -226,6 +226,13 @@ bool MemoryPool::FreeMemory(amd::Memory* memory, hip::Stream* stream) {
return true;
}
// ================================================================================================
void MemoryPool::ReleaseAllMemory() {
constexpr bool kSafeRelease = true;
free_heap_.ReleaseAllMemory(0, kSafeRelease);
busy_heap_.ReleaseAllMemory(0, kSafeRelease);
}
// ================================================================================================
void MemoryPool::ReleaseFreedMemory(hip::Stream* stream) {
amd::ScopedLock lock(lock_pool_ops_);
+4 -3
Ver ficheiro
@@ -161,9 +161,10 @@ public:
state_.internal_dependencies_ = 1;
}
virtual ~MemoryPool() {
assert(busy_heap_.IsEmpty() && "Can't destroy pool with busy allocations!");
constexpr bool kSafeRelease = true;
free_heap_.ReleaseAllMemory(0, kSafeRelease);
if (!busy_heap_.IsEmpty()) {
LogError("Shouldn't destroy pool with busy allocations!");
}
ReleaseAllMemory();
// Remove memory pool from the list of all pool on the current device
device_->RemoveMemoryPool(this);
}