Repository navigation
UCP/CORE: Add shared topology assignment policy #11980
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
Changes from all commits
3f1fa07
8514fbe
e66bc85
8d616a0
e651c57
abc8ac4
9413b2a
fe3025b
173d40f
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 |
|---|---|---|
|
|
@@ -110,6 +110,15 @@ static const char *ucp_fence_modes[] = { | |
| [UCP_FENCE_MODE_LAST] = NULL | ||
| }; | ||
|
|
||
| static const char *ucp_gpu_nic_assignment_modes[] = { | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_AUTO] = "auto", | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_OFF] = "off", | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_FLIP] = "flip", | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_ROUND_ROBIN] = "round_robin", | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_SHARED] = "shared", | ||
| [UCP_GPU_NIC_ASSIGNMENT_MODE_LAST] = NULL | ||
| }; | ||
|
|
||
| static const char *ucp_rndv_modes[] = { | ||
| [UCP_RNDV_MODE_AUTO] = "auto", | ||
| [UCP_RNDV_MODE_GET_ZCOPY] = "get_zcopy", | ||
|
|
@@ -617,6 +626,26 @@ static ucs_config_field_t ucp_context_config_table[] = { | |
| ucs_offsetof(ucp_context_config_t, connect_all_to_all), | ||
| UCS_CONFIG_TYPE_BOOL}, | ||
|
|
||
| {"GPU_NIC_ASSIGNMENT_MODE", "auto", | ||
|
tvegas1 marked this conversation as resolved.
Resolved
|
||
| "Assign NICs to GPUs within each topology group, and restrict the lanes\n" | ||
| "for a GPU's memory to the NICs assigned to that GPU.\n" | ||
| "All ports of a NIC are assigned together.\n" | ||
|
Contributor
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. also we can mention that All GPUs with same BDF (MLOParts etc.) share same NIC mapping, or equivalent
Contributor
Author
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. Deferred to another PR |
||
| "The 'flip', 'round_robin' and 'shared' modes apply on any hardware.\n" | ||
|
Contributor
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. we now add forced modes on non-vera hardware ending up with no nics at all due to cx9 filter. we need to add like below and we can later always add other filters if needed. --- a/src/ucs/sys/topo/base/topo_groups.c
+++ b/src/ucs/sys/topo/base/topo_groups.c
@@
#include <ucs/algorithm/qsort_r.h>
+#include <ucs/arch/cpu.h>
#include <ucs/datastruct/array.h>
@@ ucs_topo_build_groups_inner(const ucs_topo_sys_device_info_t *devices,
{
ucs_topo_group_t inventory;
ucs_topo_groups_t groups;
ucs_status_t status;
+ int is_vera_rubin;
ucs_topo_init_groups(&groups);
- status = ucs_topo_groups_inventory_build(devices, num_devices, 1,
- &inventory);
+ /* The cx9 filter only applies to hardware with a known GPU-NIC topology. */
+ is_vera_rubin = (ucs_arch_get_cpu_model() == UCS_CPU_MODEL_NVIDIA_VERA);
+
+ status = ucs_topo_groups_inventory_build(devices, num_devices,
+ is_vera_rubin, &inventory);
Contributor
Author
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. Deferred to another PR
Contributor
Author
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. solved by #11990 |
||
| "With 'flip' and 'round_robin', a group with fewer NICs than GPUs leaves\n" | ||
|
Contributor
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. mention somewhere that flip intends to leverage the fact that some hca have immediate access to an SSD hard driver under same pcie switch (or smaller/better framing)
Contributor
Author
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. Deferred to another PR |
||
| "some GPUs without any NICs.\n" | ||
| " - auto : use 'flip' on hardware with a known GPU-NIC topology,\n" | ||
| " otherwise 'off'.\n" | ||
| " - off : do not assign; select lanes from all NICs.\n" | ||
| " - flip : assign each NIC to a single GPU, walking the N GPUs of\n" | ||
| " the group forward then backward:\n" | ||
| " 0, 1, .., N-1, N-1, .., 1, 0, 0, 1, ..\n" | ||
| " - round_robin : assign each NIC to a single GPU, walking the N GPUs of\n" | ||
| " the group in ascending order:\n" | ||
| " 0, 1, .., N-1, 0, 1, .., N-1, 0, ..\n" | ||
| " - shared : assign all NICs of a group to every GPU of that group.", | ||
| ucs_offsetof(ucp_context_config_t, gpu_nic_assignment_mode), | ||
| UCS_CONFIG_TYPE_ENUM(ucp_gpu_nic_assignment_modes)}, | ||
|
|
||
| {"SINGLE_NET_DEVICE", "n", | ||
| "Restrict each protocol's lanes to one network device.\n" | ||
| "The device is picked among the closest eligible network devices using \n" | ||
|
|
@@ -2755,22 +2784,32 @@ ucp_version_check(unsigned api_major_version, unsigned api_minor_version) | |
| } | ||
|
|
||
| static ucs_status_t | ||
| ucp_context_gpu_nic_assignment_init(ucp_gpu_nic_assignment_t **assignment_p) | ||
| ucp_context_gpu_nic_assignment_init(ucp_gpu_nic_assignment_mode_t mode, | ||
| ucp_gpu_nic_assignment_t **assignment_p) | ||
| { | ||
| ucp_gpu_nic_assignment_t *assignment; | ||
| ucs_topo_groups_t groups; | ||
| ucs_status_t status; | ||
|
|
||
| *assignment_p = NULL; | ||
|
|
||
| /* TODO: Improve Vera Rubin detection by checking NICs/GPUs models. */ | ||
| if (ucs_arch_get_cpu_model() != UCS_CPU_MODEL_NVIDIA_VERA) { | ||
| ucs_debug("gpu-nic assignment is not supported on %s architecture, " | ||
| "skipping", | ||
| ucs_cpu_model_name()); | ||
| if (mode == UCP_GPU_NIC_ASSIGNMENT_MODE_AUTO) { | ||
| /* TODO: Improve Vera Rubin detection by checking NICs/GPUs models. */ | ||
| if (ucs_arch_get_cpu_model() != UCS_CPU_MODEL_NVIDIA_VERA) { | ||
| ucs_debug("gpu-nic assignment is not supported on %s " | ||
| "architecture, skipping", | ||
| ucs_cpu_model_name()); | ||
| return UCS_OK; | ||
| } | ||
|
|
||
| mode = UCP_GPU_NIC_ASSIGNMENT_MODE_FLIP; | ||
| } else if (mode == UCP_GPU_NIC_ASSIGNMENT_MODE_OFF) { | ||
| ucs_debug("gpu-nic assignment is disabled by configuration"); | ||
| return UCS_OK; | ||
| } | ||
|
|
||
| ucs_debug("gpu-nic assignment mode %s", ucp_gpu_nic_assignment_modes[mode]); | ||
|
|
||
| status = ucs_topo_build_groups(&groups); | ||
| if (status != UCS_OK) { | ||
| return status; | ||
|
|
@@ -2788,9 +2827,7 @@ ucp_context_gpu_nic_assignment_init(ucp_gpu_nic_assignment_t **assignment_p) | |
| goto out_release_groups; | ||
| } | ||
|
|
||
| status = ucp_gpu_nic_assignment_build(&groups, | ||
| UCP_GPU_NIC_ASSIGNMENT_POLICY_FLIP, | ||
| assignment); | ||
| status = ucp_gpu_nic_assignment_build(&groups, mode, assignment); | ||
| if (status != UCS_OK) { | ||
| ucs_free(assignment); | ||
| goto out_release_groups; | ||
|
|
@@ -2857,7 +2894,9 @@ ucs_status_t ucp_init_version(unsigned api_major_version, unsigned api_minor_ver | |
| goto err_thread_lock_finalize; | ||
| } | ||
|
|
||
| status = ucp_context_gpu_nic_assignment_init(&context->gpu_nic_assignment); | ||
| status = ucp_context_gpu_nic_assignment_init( | ||
| context->config.ext.gpu_nic_assignment_mode, | ||
| &context->gpu_nic_assignment); | ||
| if (status != UCS_OK) { | ||
| goto err_free_res; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /** | ||
| * Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2001-2017. ALL RIGHTS RESERVED. | ||
| * Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2001-2026. ALL RIGHTS RESERVED. | ||
| * | ||
| * See file LICENSE for terms. | ||
| */ | ||
|
|
@@ -234,6 +234,39 @@ typedef enum { | |
| } ucp_fence_mode_t; | ||
|
|
||
|
|
||
| /** | ||
| * GPU-to-NIC assignment mode. | ||
| */ | ||
| typedef enum { | ||
|
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. minor: these per-value comments repeat the config help string in Rationale: the flip/round_robin/shared semantics are now written out in three places, so they will drift when a policy is added or changed. |
||
| /** Use flip on hardware with a known GPU-NIC topology, otherwise off */ | ||
| UCP_GPU_NIC_ASSIGNMENT_MODE_AUTO, | ||
|
tvegas1 marked this conversation as resolved.
Resolved
|
||
|
|
||
| /** Do not assign NICs to GPUs, select lanes from all NICs */ | ||
| UCP_GPU_NIC_ASSIGNMENT_MODE_OFF, | ||
|
|
||
| /** | ||
| * Assign each NIC, with all of its ports, going forward and then backward | ||
|
Contributor
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. would be good to mention that flip leverage the fact that some hca have immediate access to SSD memory (or better framing)
Contributor
Author
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. Deferred to another PR |
||
| * across the N GPUs of the group. | ||
| * The group's NICs are assigned to the following GPU indices in order: | ||
| * 0, 1, ..., N-1, N-1, ..., 1, 0, 0, 1, ... | ||
| */ | ||
| UCP_GPU_NIC_ASSIGNMENT_MODE_FLIP, | ||
|
|
||
| /** | ||
| * Assign each NIC, with all of its ports, to the N GPUs of the group | ||
| * repeatedly in ascending order. | ||
| * The group's NICs are assigned to the following GPU indices in order: | ||
| * 0, 1, ..., N-1, 0, 1, ..., N-1, 0, 1, ... | ||
| */ | ||
| UCP_GPU_NIC_ASSIGNMENT_MODE_ROUND_ROBIN, | ||
|
|
||
| /** Assign every NIC, with all of its ports, to every GPU in the group */ | ||
| UCP_GPU_NIC_ASSIGNMENT_MODE_SHARED, | ||
|
|
||
| UCP_GPU_NIC_ASSIGNMENT_MODE_LAST | ||
| } ucp_gpu_nic_assignment_mode_t; | ||
|
|
||
|
|
||
| /** | ||
| * Communication scheme in RNDV protocol. | ||
| */ | ||
|
|
||
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.
for my understanding: can you pls remind me when/why the flip policy is needed?
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's because only one of the NICs on a CX9 board has SSD memory, so the goal is to have each GPU assigned to one with and one without SSD memory access.