-
Notifications
You must be signed in to change notification settings - Fork 124
Add experimental USM Import/Release APIs. #614
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
|
|
||
| <% | ||
| OneApi=tags['$OneApi'] | ||
| x=tags['$x'] | ||
| X=x.upper() | ||
| %> | ||
| .. _experimental-usm-import-release: | ||
|
|
||
| ================== | ||
| USM Import/Release | ||
| ================== | ||
|
|
||
| .. warning:: | ||
|
|
||
| Experimental features: | ||
|
|
||
| * May be replaced, updated, or removed at any time. | ||
| * Do not require maintaining API/ABI stability of their own additions over | ||
| time. | ||
| * Do not require conformance testing of their own additions. | ||
|
|
||
|
|
||
| Data transfer between Host and Device is most efficient when source and | ||
| destination are both allocated in USM memory. | ||
| In situations where host data will participate in host/device transfers | ||
| and the host data allocation is under user control, USM functions | ||
| such as malloc_host could be used to allocate USM memory instead of | ||
| system memory. | ||
| However, this is not always possible if the source code where the allocation | ||
| is made is not available, or source code changes are prohibited for portability | ||
| reasons. | ||
| In these situations a mechanism to temporarily promote system memory to USM | ||
| for the duration of the host/device data transfers is useful for maximizing | ||
| data transfer rate. | ||
|
|
||
|
|
||
| Import Host Memory into USM | ||
| =========================== | ||
|
|
||
| Import a range of host memory into USM. | ||
|
|
||
| .. parsed-literal:: | ||
|
|
||
| // Import into USM | ||
| ${x}USMImportExp(hContext, hostPtr, size); | ||
|
|
||
| Release Host Memory Previously Imported into USM | ||
| ================================================ | ||
|
|
||
| Release from USM a range of memory that had been previously imported | ||
| into USM. | ||
|
|
||
|
|
||
| .. parsed-literal:: | ||
|
|
||
| // Release from USM | ||
| ${x}USMReleaseExp(hContext, hostPtr); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- #-------------------------------------------------------------------------- | ||
| type: header | ||
| desc: "Intel $OneApi USM Import/Release Extension APIs" | ||
| ordinal: "99" | ||
| --- #-------------------------------------------------------------------------- | ||
| type: function | ||
| desc: "Import memory into USM" | ||
| class: $xUSM | ||
| name: ImportExp | ||
| details: | ||
| - "Import memory into USM" | ||
| params: | ||
| - type: $x_context_handle_t | ||
| name: hContext | ||
| desc: "[in] handle of the context object" | ||
| - type: "void*" | ||
| name: pMem | ||
| desc: "[in] pointer to host memory object" | ||
| - type: "size_t" | ||
| name: size | ||
| desc: "[in] size in bytes of the host memory object to be imported" | ||
| returns: | ||
| - $X_RESULT_ERROR_INVALID_CONTEXT | ||
| - $X_RESULT_ERROR_INVALID_SIZE | ||
| --- #-------------------------------------------------------------------------- | ||
| type: function | ||
| desc: "Release memory from USM" | ||
| class: $xUSM | ||
| name: ReleaseExp | ||
| details: | ||
| - "Release memory from USM" | ||
| params: | ||
| - type: $x_context_handle_t | ||
| name: hContext | ||
| desc: "[in] handle of the context object" | ||
| - type: "void*" | ||
| name: pMem | ||
| desc: "[in] pointer to host memory object" | ||
| returns: | ||
| - $X_RESULT_ERROR_INVALID_CONTEXT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to block this PR, but could you refactor this to match the experimental features template in a follow up PR- see here