[FEA] Refactor native memory resources out of the JNI and add C++ tests
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Is your feature request related to a problem? Please describe.**
The [RmmJni](https://github.com/rapidsai/cudf/blob/main/java/src/main/native/src/RmmJni.cpp) contains several complete C++ memory resource classes, including
- `tracking_resource_adaptor_impl`
- `tracking_resource_adaptor`
- `java_event_handler_memory_resource_impl`
- `java_debug_event_handler_memory_resource_impl`
- `java_event_handler_memory_resource`
- `parallel_init_pinned_host_memory_resource`
- `pinned_fallback_host_memory_resource`
A better practice would be to move these C++ classes into dedicated internal header/source files to avoid JNI plumbing with general C++ resource logic. Doing so would facilitate direct C++ testing for these classes.
**Describe the solution you'd like**
Move the native memory-resource implementations currently embedded in `RmmJni.cpp` into internal C++ headers and source files. After the refactor, `RmmJni.cpp` should primarily contain JNI entry points. Resources that would benefit from C++-level testing should have native C++ tests added.
**Describe alternatives you've considered**
Leaving these classes in `RmmJni` -- drawbacks stated above.
**Additional context**
Related thread: https://github.com/rapidsai/cudf/pull/23457#discussion_r3692188334.
Contributor guide
Research direction
Start in java/src/main/native/src/RmmJni.cpp and review the listed native memory-resource classes and their JNI entry points. Move the resource implementations into dedicated internal C++ headers and source files, then add native C++ tests for the resources that benefit from direct testing. Done means RmmJni.cpp primarily contains JNI entry points and the new C++ tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100