-
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
validate rma lane if rkey is not needed for mem type #2995
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bed7435
UCP/MEM_TYPE: Pack memtype RKEY. validate rma lane with mem type if rkey
bureddy 5a6dd09
JENKINS: test cuda txs when bw lane which not require RKEY(ex. CMA)
bureddy 163f107
UCP/RKEY: static assert to check mem type can pack in uint8_t
bureddy 417895a
UCP/RKEY: add mem_type to ucp_mem_dummy_buffer
bureddy 8276428
UCP/RKEY: Fix review comments
bureddy 085303e
UCP/RKEY: Fix review comments(2)
bureddy 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 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 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 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 |
---|---|---|
|
@@ -22,6 +22,7 @@ size_t ucp_rkey_packed_size(ucp_context_h context, ucp_md_map_t md_map) | |
unsigned md_index; | ||
|
||
size = sizeof(ucp_md_map_t); | ||
size += sizeof(uint8_t); | ||
ucs_for_each_bit (md_index, md_map) { | ||
md_size = context->tl_mds[md_index].attr.rkey_packed_size; | ||
ucs_assert_always(md_size <= UINT8_MAX); | ||
|
@@ -31,7 +32,8 @@ size_t ucp_rkey_packed_size(ucp_context_h context, ucp_md_map_t md_map) | |
} | ||
|
||
void ucp_rkey_packed_copy(ucp_context_h context, ucp_md_map_t md_map, | ||
void *rkey_buffer, const void* uct_rkeys[]) | ||
uct_memory_type_t mem_type, void *rkey_buffer, | ||
const void* uct_rkeys[]) | ||
{ | ||
void *p = rkey_buffer; | ||
unsigned md_index; | ||
|
@@ -40,6 +42,8 @@ void ucp_rkey_packed_copy(ucp_context_h context, ucp_md_map_t md_map, | |
*(ucp_md_map_t*)p = md_map; | ||
p += sizeof(ucp_md_map_t); | ||
|
||
*((uint8_t *)p++) = mem_type; | ||
|
||
ucs_for_each_bit(md_index, md_map) { | ||
md_size = context->tl_mds[md_index].attr.rkey_packed_size; | ||
ucs_assert_always(md_size <= UINT8_MAX); | ||
|
@@ -51,7 +55,8 @@ void ucp_rkey_packed_copy(ucp_context_h context, ucp_md_map_t md_map, | |
} | ||
|
||
ssize_t ucp_rkey_pack_uct(ucp_context_h context, ucp_md_map_t md_map, | ||
const uct_mem_h *memh, void *rkey_buffer) | ||
const uct_mem_h *memh, uct_memory_type_t mem_type, | ||
void *rkey_buffer) | ||
{ | ||
void *p = rkey_buffer; | ||
ucs_status_t status = UCS_OK; | ||
|
@@ -66,6 +71,9 @@ ssize_t ucp_rkey_pack_uct(ucp_context_h context, ucp_md_map_t md_map, | |
*(ucp_md_map_t*)p = md_map; | ||
p += sizeof(ucp_md_map_t); | ||
|
||
/* Write memory type */ | ||
*((uint8_t*)p++) = mem_type; | ||
|
||
/* Write both size and rkey_buffer for each UCT rkey */ | ||
uct_memh_index = 0; | ||
ucs_for_each_bit (md_index, md_map) { | ||
|
@@ -122,7 +130,8 @@ ucs_status_t ucp_rkey_pack(ucp_context_h context, ucp_mem_h memh, | |
|
||
p = rkey_buffer; | ||
|
||
packed_size = ucp_rkey_pack_uct(context, memh->md_map, memh->uct, p); | ||
packed_size = ucp_rkey_pack_uct(context, memh->md_map, memh->uct, | ||
memh->mem_type, p); | ||
if (packed_size < 0) { | ||
status = (ucs_status_t)packed_size; | ||
goto err_destroy; | ||
|
@@ -161,6 +170,7 @@ ucs_status_t ucp_ep_rkey_unpack(ucp_ep_h ep, const void *rkey_buffer, | |
unsigned md_count; | ||
ucs_status_t status; | ||
ucp_rkey_h rkey; | ||
uct_memory_type_t mem_type; | ||
uint8_t md_size; | ||
const void *p; | ||
|
||
|
@@ -193,7 +203,11 @@ ucs_status_t ucp_ep_rkey_unpack(ucp_ep_h ep, const void *rkey_buffer, | |
goto err; | ||
} | ||
|
||
/* Read memory type */ | ||
mem_type = *((uint8_t*)p++); | ||
|
||
rkey->md_map = md_map; | ||
rkey->mem_type = mem_type; | ||
|
||
/* Unpack rkey of each UCT MD */ | ||
remote_md_index = 0; /* Index of remote MD */ | ||
|
@@ -259,6 +273,8 @@ void ucp_rkey_dump_packed(const void *rkey_buffer, char *buffer, size_t max) | |
md_map = *(ucp_md_map_t*)(rkey_buffer); | ||
rkey_buffer += sizeof(ucp_md_map_t); | ||
|
||
rkey_buffer += sizeof(uint8_t); | ||
|
||
first = 1; | ||
ucs_for_each_bit(md_index, md_map) { | ||
md_size = *((uint8_t*)rkey_buffer); | ||
|
@@ -337,6 +353,7 @@ static ucp_lane_index_t ucp_config_find_rma_lane(ucp_context_h context, | |
ucp_lane_index_t lane; | ||
ucp_md_map_t dst_md_mask; | ||
ucp_md_index_t md_index; | ||
uct_md_attr_t *md_attr; | ||
uint8_t rkey_index; | ||
int prio; | ||
|
||
|
@@ -349,16 +366,20 @@ static ucp_lane_index_t ucp_config_find_rma_lane(ucp_context_h context, | |
} | ||
|
||
md_index = config->md_index[lane]; | ||
md_attr = &context->tl_mds[md_index].attr; | ||
|
||
if ((md_index != UCP_NULL_RESOURCE) && | ||
(!(context->tl_mds[md_index].attr.cap.flags & UCT_MD_FLAG_NEED_RKEY))) | ||
(!(md_attr->cap.flags & UCT_MD_FLAG_NEED_RKEY)) && | ||
(!rkey || (md_attr->cap.mem_type == mem_type && | ||
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. ( ) around internal conditions |
||
md_attr->cap.mem_type == rkey->mem_type))) | ||
{ | ||
/* Lane does not need rkey, can use the lane with invalid rkey */ | ||
*uct_rkey_p = UCT_INVALID_RKEY; | ||
return lane; | ||
} | ||
|
||
if ((md_index != UCP_NULL_RESOURCE) && | ||
(!(context->tl_mds[md_index].attr.cap.reg_mem_types & UCS_BIT(mem_type)))) { | ||
(!(md_attr->cap.reg_mem_types & UCS_BIT(mem_type)))) { | ||
continue; | ||
} | ||
|
||
|
This file contains 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 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
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.
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.
pls use
uct_memory_type_t
instead ofuint8_t
for casting andsizeof
where relevantThere 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.
@evgeny-leksikov uct_memory_type_t is defined as enum. wanted to save on rkey packed size with typecasting to uint8_t.
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.
Ok, then pls check if we have static assert for UCT_MD_MEM_TYPE_LAST <= 255 or similar
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.
added assert while packing rkey