SWDEV-304151 - Reset file descriptor after Module Load

File descriptors opened during hipModuleLoad are not closed
until hipModuleUnLoad. In large models, this exceeds the ulimit
for no. of open file descriptors causing out of resource issues.
Hence, close the file descriptors once the required data is read
from the file, and not wait until unload.

Change-Id: Ic50d424e5ca388715b1e6309a0de72a480321582


[ROCm/clr commit: 3b157b3d5f]
This commit is contained in:
Satyanvesh Dittakavi committed 2021-11-19 12:25:59 -05:00
1 parent 239cc6b437
commit 6ef56f09f1
3 files changed
+22 -14

No files matched your search

+1 -14
View File
@@ -29,20 +29,7 @@ FatBinaryInfo::~FatBinaryInfo() {
delete fbd;
}
if (fdesc_ > 0) {
if (fsize_ && !amd::Os::MemoryUnmapFile(image_, fsize_)) {
guarantee(false, "Cannot unmap file");
}
if (!amd::Os::CloseFileHandle(fdesc_)) {
guarantee(false, "Cannot close file");
}
}
fname_ = std::string();
fdesc_ = amd::Os::FDescInit();
fsize_ = 0;
image_ = nullptr;
uri_ = std::string();
ResetFileInfo();
}
hipError_t FatBinaryInfo::ExtractFatBinary(const std::vector<hip::Device*>& devices) {