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

[CUDA] Add support for multiple active mappings #1220

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

fabiomestre
Copy link
Contributor

@fabiomestre fabiomestre commented Jan 3, 2024

The CUDA adapter currently does not support multiple active mappings on the same buffer when using urEnqueueMemBufferMap. This change aims to add support for that feature.

However, the unsupported scenario of overlapping maps that were both created with the UR_MAP_FLAG_WRITE is not currently being checked. That's better done using validation layers for which I have created an issue: #1221

intel/llvm: intel/llvm#12285

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9b97a5f) 15.46% compared to head (43325e6) 15.46%.
Report is 2 commits behind head on main.

Files Patch % Lines
test/conformance/enqueue/urEnqueueMemBufferMap.cpp 0.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1220      +/-   ##
==========================================
- Coverage   15.46%   15.46%   -0.01%     
==========================================
  Files         238      238              
  Lines       33883    33883              
  Branches     3747     3747              
==========================================
- Hits         5240     5239       -1     
  Misses      28593    28593              
- Partials       50       51       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fabiomestre fabiomestre marked this pull request as ready for review January 3, 2024 18:40
@fabiomestre fabiomestre requested review from a team as code owners January 3, 2024 18:40
@fabiomestre fabiomestre requested a review from jchlanda January 3, 2024 18:40
Copy link
Contributor

@jchlanda jchlanda left a comment

Choose a reason for hiding this comment

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

As a general comment, a wee explanation of what the PR does wouldn't go amiss.

@fabiomestre
Copy link
Contributor Author

@oneapi-src/unified-runtime-maintain would be great if someone could review these changes

@fabiomestre fabiomestre added the ready to merge Added to PR's which are ready to merge label Jan 25, 2024
@kbenzie kbenzie self-assigned this Mar 15, 2024
@kbenzie kbenzie added conformance Conformance test suite issues. cuda CUDA adapter specific issues labels Apr 3, 2024
@kbenzie kbenzie force-pushed the fabio/cuda_multimap branch from 43325e6 to 834e643 Compare April 10, 2024 12:59
@kbenzie kbenzie merged commit 6e76c98 into oneapi-src:main Apr 10, 2024
53 checks passed
kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Apr 11, 2024
Issue was introduced in oneapi-src#1220 where a new allocation is created in a
`std::unique_ptr` to enable buffer mapping. The `.get()` member function
is called before the `std::unique_ptr` is passed into the `BufferMem`
constructor. However, move semantics were not being explicitly followed.
The `BufferMem` constructor was taking the `std::unique_ptr` by l-value
refernece, then calling `std::move()` on it. This triggered a
wrapper-escape, use-after-free defect in Coverity. This fix is to
explicitly `std::move()` the `std::unique_ptr` into the `BufferMem`
constructor, and also update the `BufferMem` constructor to take an
r-value reference instead of an l-value reference.
frasercrmck added a commit to frasercrmck/unified-runtime that referenced this pull request May 22, 2024
This patch adds support for mapping the same buffer multiple times with
urEnqueueMemBufferMap.

This is mostly a straight port of oneapi-src#1220.
frasercrmck added a commit to frasercrmck/unified-runtime that referenced this pull request May 22, 2024
This patch adds support for mapping the same buffer multiple times with
urEnqueueMemBufferMap.

This is mostly a straight port of oneapi-src#1220. It brings the HIP adapter's
functionality in line with that of the CUDA adapter.
frasercrmck added a commit to frasercrmck/unified-runtime that referenced this pull request May 22, 2024
This patch adds support for mapping the same buffer multiple times with
urEnqueueMemBufferMap.

This is mostly a straight port of oneapi-src#1220. It brings the HIP adapter's
functionality in line with that of the CUDA adapter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conformance Conformance test suite issues. cuda CUDA adapter specific issues ready to merge Added to PR's which are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants