Skip to content

Commit

Permalink
src/fmm.c: fallback to old userptr reg if SVM fails
Browse files Browse the repository at this point in the history
Fallback to old userptr registration in case SVM method fails.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Change-Id: I70c3ec74a8b4f762713e6a0619453642f3fca8e5
  • Loading branch information
alexsierrag committed Jul 16, 2024
1 parent a39cda7 commit c8db222
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/fmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3123,7 +3123,7 @@ static HSAKMT_STATUS _fmm_map_to_gpu_userptr(void *addr, uint64_t size,
/* Map and return the GPUVM address adjusted by the offset
* from the start of the page
*/
if (is_svm_api_supported) {
if (!object && is_svm_api_supported) {
svm_addr = (void*)((HSAuint64)addr - page_offset);
if (!nodes_to_map) {
nodes_to_map = all_gpu_id_array;
Expand Down Expand Up @@ -3518,12 +3518,15 @@ HSAKMT_STATUS fmm_register_memory(void *address, uint64_t size_in_bytes,
return HSAKMT_STATUS_SUCCESS;

/* Register a new user ptr */
if (is_svm_api_supported)
return fmm_register_mem_svm_api(address,
if (is_svm_api_supported) {
ret = fmm_register_mem_svm_api(address,
size_in_bytes,
coarse_grain,
ext_coherent);

if (ret == HSAKMT_STATUS_SUCCESS)
return ret;
pr_debug("SVM failed, falling back to old registration\n");
}
ret = fmm_register_user_memory(address,
size_in_bytes,
&object,
Expand Down

0 comments on commit c8db222

Please sign in to comment.