Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle rmm::out_of_memory instead of std::bad_alloc for retry #1477

Merged
merged 1 commit into from
Oct 6, 2023
Merged
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
7 changes: 5 additions & 2 deletions src/main/cpp/src/SparkResourceAdaptorJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,15 +1352,18 @@ class spark_resource_adaptor final : public rmm::mr::device_memory_resource {
void* ret = resource->allocate(num_bytes, stream);
post_alloc_success(tid, likely_spill);
return ret;
} catch (const std::bad_alloc& e) {
} catch (const rmm::out_of_memory& e) {
// rmm::out_of_memory is what is thrown when an allocation failed
// but there are other rmm::bad_alloc exceptions that could be
// thrown as well, which are handled by the std::exception case.
abellina marked this conversation as resolved.
Show resolved Hide resolved
if (!post_alloc_failed(tid, true, likely_spill)) { throw; }
} catch (const std::exception& e) {
post_alloc_failed(tid, false, likely_spill);
throw;
}
}
// we should never reach this point, but just in case
throw std::bad_alloc();
throw rmm::bad_alloc("Internal Error");
}

void do_deallocate(void* p, std::size_t size, rmm::cuda_stream_view stream) override
Expand Down