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

support RMM aligned resource adapter in JNI [skip ci] #8266

Merged
merged 5 commits into from
May 20, 2021

Conversation

rongou
Copy link
Contributor

@rongou rongou commented May 18, 2021

Depends on rapidsai/rmm#768.

@rongou rongou added 3 - Ready for Review Ready for review by team RMM Performance Performance related issue Java Affects Java cuDF API. Spark Functionality that helps Spark RAPIDS improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 18, 2021
@rongou rongou requested review from jlowe and revans2 May 18, 2021 01:34
@rongou rongou self-assigned this May 18, 2021
@rongou rongou requested a review from a team as a code owner May 18, 2021 01:34
java/src/main/java/ai/rapids/cudf/Rmm.java Show resolved Hide resolved
java/src/main/java/ai/rapids/cudf/RmmAllocationMode.java Outdated Show resolved Hide resolved
java/src/main/java/ai/rapids/cudf/RmmAllocationMode.java Outdated Show resolved Hide resolved
java/src/main/java/ai/rapids/cudf/Rmm.java Show resolved Hide resolved
java/src/main/native/src/RmmJni.cpp Show resolved Hide resolved
Initialized_resource, allocation_alignment, alignment_threshold);
}

auto wrapped = make_tracking_adaptor(Initialized_resource.get(), RMM_ALLOC_SIZE_ALIGNMENT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RMM_ALLOC_SIZE_ALIGNMENT seems wrong if we know we're using the aligned adapter and a different alignment. I think there needs to be a max(RMM_ALLOC_SIZE_ALIGNMENT, allocation_alignment) or something similar here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the actual allocation size for aligned adapter is a bit complicated. Just curious, why are we tracking the total allocation size ourselves and not using the get_mem_info() method from the device memory resource?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because many device memory resource implementations do not implement get_mem_info(), the ARENA allocator apparently being one of them:

$ git grep supports_get_mem_info | grep false
benchmarks/utilities/simulated_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }
include/rmm/mr/device/arena_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }
include/rmm/mr/device/binning_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }
include/rmm/mr/device/cuda_async_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }
include/rmm/mr/device/fixed_size_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }
include/rmm/mr/device/pool_memory_resource.hpp:  bool supports_get_mem_info() const noexcept override { return false; }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess that api is really only for cuda. Added the max of two alignment sizes.

@jlowe jlowe changed the title support rmm aligned resource adapter in jni [skip ci] support RMM aligned resource adapter in JNI [skip ci] May 18, 2021
@rongou
Copy link
Contributor Author

rongou commented May 20, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 0ebf7e6 into rapidsai:branch-21.06 May 20, 2021
@rongou rongou deleted the aligned-adapter-jni branch November 23, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. non-breaking Non-breaking change Performance Performance related issue Spark Functionality that helps Spark RAPIDS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants