SWDEV-268552 - HIP sample segfaults during hipModuleLoad, fix mmap bug
Change-Id: I51c6061e7ac6b2524586d96fdd69b9f084b1906a
[ROCm/hip commit: aac12d1bd9]
This commit is contained in:
committed by
Anusha Godavarthy Surya
parent
7b8be62de8
commit
637cefb59f
@@ -30,13 +30,12 @@ FatBinaryInfo::~FatBinaryInfo() {
|
||||
}
|
||||
|
||||
if (fdesc_ > 0) {
|
||||
if (!amd::Os::CloseFileHandle(fdesc_)) {
|
||||
guarantee(false, "Cannot close file");
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -68,14 +67,9 @@ hipError_t FatBinaryInfo::ExtractFatBinary(const std::vector<hip::Device*>& devi
|
||||
}
|
||||
|
||||
// Extract the code object from file
|
||||
hip_error = CodeObject::ExtractCodeObjectFromFile(fdesc_, fsize_,
|
||||
hip_error = CodeObject::ExtractCodeObjectFromFile(fdesc_, fsize_, &image_,
|
||||
device_names, code_objs);
|
||||
|
||||
// Map the file memory, Later: only map offset, throws error in ElfMagic now.
|
||||
if (!amd::Os::MemoryMapFileDesc(fdesc_, fsize_, 0, &image_)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
} else if (image_ != nullptr) {
|
||||
// We are directly given image pointer directly, try to extract file desc & file Size
|
||||
hip_error = CodeObject::ExtractCodeObjectFromMemory(image_,
|
||||
|
||||
Reference in New Issue
Block a user