-
Notifications
You must be signed in to change notification settings - Fork 434
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
UCT/API: introduce sys_dev field for mem_alloc #10448
base: master
Are you sure you want to change the base?
Changes from 3 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 |
---|---|---|
|
@@ -71,6 +71,7 @@ ucs_status_t uct_mem_alloc(size_t length, const uct_alloc_method_t *methods, | |
const uct_alloc_method_t *method; | ||
ucs_log_level_t log_level; | ||
ucs_memory_type_t mem_type; | ||
ucs_sys_device_t sys_dev; | ||
uct_md_attr_t md_attr; | ||
ucs_status_t status; | ||
unsigned flags; | ||
|
@@ -101,12 +102,15 @@ ucs_status_t uct_mem_alloc(size_t length, const uct_alloc_method_t *methods, | |
params->name : "anonymous-uct_mem_alloc"; | ||
mem_type = (params->field_mask & UCT_MEM_ALLOC_PARAM_FIELD_MEM_TYPE) ? | ||
params->mem_type : UCS_MEMORY_TYPE_HOST; | ||
sys_dev = (params->field_mask & UCT_MEM_ALLOC_PARAM_FIELD_SYS_DEV) ? | ||
params->sys_dev : UCS_SYS_DEVICE_ID_UNKNOWN; | ||
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. whould we return 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. @brminich This assumes that GPU MDs cannot allocate host memory which is true today but maybe it is better for UCT MDs to return that error than catch it here? 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. if you think it can be a valid case in the future, then ok |
||
alloc_length = length; | ||
log_level = (flags & UCT_MD_MEM_FLAG_HIDE_ERRORS) ? UCS_LOG_LEVEL_DEBUG : | ||
UCS_LOG_LEVEL_ERROR; | ||
|
||
ucs_trace("allocating %s: %s memory length %zu flags 0x%x", alloc_name, | ||
ucs_memory_type_names[mem_type], alloc_length, flags); | ||
ucs_trace("allocating %s: %s memory length %zu sys_dev %s flags 0x%x", | ||
alloc_name, ucs_memory_type_names[mem_type], alloc_length, | ||
ucs_topo_sys_device_get_name(sys_dev), flags); | ||
ucs_log_indent(1); | ||
|
||
for (method = methods; method < methods + num_methods; ++method) { | ||
|
@@ -151,9 +155,8 @@ ucs_status_t uct_mem_alloc(size_t length, const uct_alloc_method_t *methods, | |
* fall-back, because this MD already exposed support for memory | ||
* allocation. | ||
*/ | ||
status = uct_md_mem_alloc(md, &alloc_length, &address, | ||
mem_type, flags, alloc_name, | ||
&memh); | ||
status = uct_md_mem_alloc(md, &alloc_length, &address, mem_type, | ||
flags, alloc_name, sys_dev, &memh); | ||
if (status != UCS_OK) { | ||
ucs_log(log_level, | ||
"failed to allocate %zu bytes using md %s for %s: %s", | ||
|
@@ -165,6 +168,7 @@ ucs_status_t uct_mem_alloc(size_t length, const uct_alloc_method_t *methods, | |
ucs_assert(memh != UCT_MEM_HANDLE_NULL); | ||
mem->md = md; | ||
mem->mem_type = mem_type; | ||
mem->sys_dev = sys_dev; | ||
rakhmets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mem->memh = memh; | ||
goto allocated; | ||
} | ||
|
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.
it is called
sys_dev
inuct_mem_alloc_params_t
. Pls align one of them with the other.also
UCT_MEM_ALLOC_PARAM_FIELD_SYS_DEVICE
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.
UCT_MEM_ALLOC_PARAM_FIELD_SYS_DEV