-
Notifications
You must be signed in to change notification settings - Fork 423
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
UCM/UCS: Fail to create memtype cache if cannot patch Cuda driver API #7865
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
|
||
|
||
static ucs_spinlock_t ucs_memtype_cache_global_instance_lock; | ||
static int ucs_memtype_cache_failed = 0; | ||
ucs_memtype_cache_t *ucs_memtype_cache_global_instance = NULL; | ||
|
||
|
||
|
@@ -56,16 +57,23 @@ static UCS_F_ALWAYS_INLINE ucs_memtype_cache_t *ucs_memtype_cache_get_global() | |
ucs_memtype_cache_t *memtype_cache = NULL; | ||
ucs_status_t status; | ||
|
||
if (!ucs_global_opts.enable_memtype_cache) { | ||
if (ucs_global_opts.enable_memtype_cache == UCS_NO) { | ||
return NULL; | ||
} | ||
|
||
/* Double-check lock scheme */ | ||
if (ucs_unlikely(ucs_memtype_cache_global_instance == NULL)) { | ||
if (ucs_unlikely(ucs_memtype_cache_global_instance == NULL) && | ||
!ucs_memtype_cache_failed) { | ||
/* Create the memtype cache outside the lock, to avoid a Coverity error | ||
of lock inversion with UCS_INIT_ONCE from ucm_set_event_handler() */ | ||
status = UCS_CLASS_NEW(ucs_memtype_cache_t, &memtype_cache); | ||
if (status != UCS_OK) { | ||
/* If we failed to create the memtype cache once, do not try again */ | ||
ucs_memtype_cache_failed = 1; | ||
if (ucs_global_opts.enable_memtype_cache == UCS_YES) { | ||
ucs_warn("failed to create memtype cache: %s", | ||
ucs_status_string(status)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be a hard error if the user is forced to enable memtype cache? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't think it should be a fatal error since we can still continue the program without memtype cache |
||
} | ||
return NULL; | ||
} | ||
|
||
|
@@ -386,9 +394,9 @@ static UCS_CLASS_INIT_FUNC(ucs_memtype_cache_t) | |
UCM_EVENT_FLAG_EXISTING_ALLOC, | ||
1000, ucs_memtype_cache_event_callback, | ||
self); | ||
if ((status != UCS_OK) && (status != UCS_ERR_UNSUPPORTED)) { | ||
ucs_error("failed to set UCM memtype event handler: %s", | ||
ucs_status_string(status)); | ||
if (status != UCS_OK) { | ||
ucs_diag("failed to set UCM memtype event handler: %s", | ||
ucs_status_string(status)); | ||
goto err_cleanup_pgtable; | ||
} | ||
|
||
|
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.
Do we still need to attempt installation of runtime hooks here? If we're not going to create memtype cache if driver hooks failed, can we not skip this step?
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.
if driver bistro hooks failed, we do skip the other steps:
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 mean can we not remove lines 282-285?
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.
these lines are needed in case the user would like to set UCX_MEM_CUDA_HOOK_MODE=reloc manually