Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/hsa-runtime/core/runtime/amd_blit_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ int GetKernelSourceParam(const char* paramName) {
std::string::size_type paramValLoc = paramDefLoc + paramDef.str().size();
std::string::size_type paramEndLoc =
kBlitKernelSource().find('\n', paramDefLoc);
assert(paramDefLoc != std::string::npos);
assert(paramEndLoc != std::string::npos);

std::string paramVal(&kBlitKernelSource()[paramValLoc],
&kBlitKernelSource()[paramEndLoc]);
Expand Down
6 changes: 4 additions & 2 deletions runtime/hsa-runtime/core/runtime/svm_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,16 @@ SvmProfileControl::SvmProfileControl() : event(-1), exit(false) {
}

SvmProfileControl::~SvmProfileControl() {
if (event != -1) eventfd_write(event, 1);
if (event != -1){
eventfd_write(event, 1);
close(event);
}
if (poll_smi_thread_ != NULL) {
exit = true;
os::WaitForThread(poll_smi_thread_);
os::CloseThread(poll_smi_thread_);
poll_smi_thread_ = NULL;
}
close(event);
}

template <typename... Args>
Expand Down
2 changes: 1 addition & 1 deletion runtime/hsa-runtime/core/util/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class ScopeGuard {

ScopeGuard(ScopeGuard& rhs) { *this = rhs; }

__forceinline ~ScopeGuard() {
__forceinline ~ScopeGuard() noexcept(false) {
if (!dismiss_) release_();
}
__forceinline ScopeGuard& operator=(ScopeGuard& rhs) {
Expand Down
10 changes: 8 additions & 2 deletions runtime/hsa-runtime/libamdhsacode/amd_elf_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ namespace elf {
{
size_t size1 = getSize();
void* buffer1 = malloc(size1);
if (_read(d, buffer1, size1) < 0) { free(buffer1); return perror("read failed"); }
ssize_t bytes_read = _read(d, buffer1, size1);
if (bytes_read < 0) { free(buffer1); return perror("read failed"); }
if (static_cast<size_t>(bytes_read) != size1) { free(buffer1); return perror("Incomplete read"); }

*buffer = buffer1;
if (size) { *size = size1; }
return true;
Expand All @@ -284,7 +287,10 @@ namespace elf {
{
size_t size1 = getSize();
if (size < size1) { return error("Buffer size is not enough"); }
if (_read(d, buffer, size1) < 0) { return perror("read failed"); }
ssize_t bytes_read = _read(d, buffer, size1);
if (bytes_read < 0) { return perror("read failed"); }
if (static_cast<size_t>(bytes_read) != size1) { return perror("Incomplete read"); }

return true;
}

Expand Down
Loading