Skip to content

Commit f53114e

Browse files
committed
UCP/UCT/IB: Add per-endpoint traffic class (DSCP) for RC/RoCE
Add an optional per-endpoint traffic class programmed onto the RC mlx5 QP, so endpoints can be tagged with a distinct DSCP (RoCEv2) or GRH traffic class (IB) for fabric QoS. - API: ucp_ep_params.ep_traffic_class + UCP_EP_PARAM_FIELD_EP_TRAFFIC_CLASS - UCT: uct_ep_connect_to_ep_params_t.ep_traffic_class + UCT_EP_CONNECT_TO_EP_PARAM_FIELD_EP_TRAFFIC_CLASS - Plumb UCP ep params -> wireup -> rc mlx5 devx QP (primary_address_path.dscp for RoCEv2, .tclass for IB); default behavior unchanged when unset - Sentinels UCP_EP_NO_TCLASS / UCT_EP_NO_TCLASS - Java binding constant
1 parent f572f1f commit f53114e

80 files changed

Lines changed: 1128 additions & 208 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Xu Yifeng <yifeng.xyf@alibaba-inc.com>
129129
Yaser Afshar <yaser.afshar@intel.com>
130130
Yihua Xu <yihua.xu@intel.com>
131131
Yiltan Hassan Temucin <yiltan.temucin@amd.com>
132+
Yoel Benabou <ybenabou@nvidia.com>
132133
Yossi Itigin <yosefe@nvidia.com>
133134
Yuriy Shestakov <yuriis@mellanox.com>
134135
Zhenlong Ma <zhenlongm@nvidia.com>

Makefile.am

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,31 @@ include $(srcdir)/docs/doxygen/doxygen.am
115115
pkgconfigdir = $(libdir)/pkgconfig
116116
pkgconfig_DATA = ucx.pc
117117

118+
install-exec-hook:
119+
@if test -n "$(UCX_LIBRARY_FILE_SUFFIX)"; then \
120+
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(moduledir)"; do \
121+
if test -d "$$dir"; then \
122+
for lib in "$$dir"/*$(UCX_LIBRARY_FILE_SUFFIX).so.*; do \
123+
test -e "$$lib" || continue; \
124+
link=`echo "$$lib" | sed 's/\.so\..*/.so/'`; \
125+
$(LN_S) -f "`basename "$$lib"`" "$$link"; \
126+
done; \
127+
fi; \
128+
done; \
129+
fi
130+
131+
uninstall-hook:
132+
@if test -n "$(UCX_LIBRARY_FILE_SUFFIX)"; then \
133+
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(moduledir)"; do \
134+
if test -d "$$dir"; then \
135+
for link in "$$dir"/*$(UCX_LIBRARY_FILE_SUFFIX).so; do \
136+
test -L "$$link" || continue; \
137+
$(RM) "$$link"; \
138+
done; \
139+
fi; \
140+
done; \
141+
fi
142+
118143
DOCLIST = docs/doxygen/doxygen-doc/ucx.tag
119144

120145
FORMAT = pdf

bindings/java/src/main/java/org/openucx/jucx/ucp/UcpConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public class UcpConstants {
8686
static long UCP_EP_PARAM_FIELD_LOCAL_SOCK_ADDR;
8787
static long UCP_EP_PARAM_FIELD_CONN_REQUEST;
8888
static long UCP_EP_PARAM_FIELD_NAME;
89+
static long UCP_EP_PARAM_FIELD_EP_TRAFFIC_CLASS;
8990

9091
/**
9192
* UCP error handling mode.

bindings/java/src/main/native/ucp_constants.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Java_org_openucx_jucx_ucp_UcpConstants_loadConstants(JNIEnv *env, jclass cls)
6565
JUCX_DEFINE_LONG_CONSTANT(UCP_EP_PARAM_FIELD_LOCAL_SOCK_ADDR);
6666
JUCX_DEFINE_LONG_CONSTANT(UCP_EP_PARAM_FIELD_CONN_REQUEST);
6767
JUCX_DEFINE_LONG_CONSTANT(UCP_EP_PARAM_FIELD_NAME);
68+
JUCX_DEFINE_LONG_CONSTANT(UCP_EP_PARAM_FIELD_EP_TRAFFIC_CLASS);
6869

6970
// UCP error handling mode
7071
JUCX_DEFINE_INT_CONSTANT(UCP_ERR_HANDLING_MODE_PEER);

buildlib/pr/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,32 @@ stages:
482482
dependsOn: [Basic_compile]
483483
jobs:
484484
- template: cuda/cuda.yml
485+
- job: soname_suffix_cuda_ib
486+
displayName: SONAME suffix and deepbind on CUDA/IB
487+
pool:
488+
name: MLNX
489+
demands:
490+
- ucx_gpu_test -equals yes
491+
container: ubuntu2404_doca31_gpunetio
492+
workspace:
493+
clean: all
494+
timeoutInMinutes: 120
495+
496+
steps:
497+
- checkout: self
498+
clean: true
499+
fetchDepth: 100
500+
retryCountOnTaskFailure: 5
501+
502+
- bash: |
503+
./buildlib/tools/builds.sh
504+
displayName: Build SONAME suffix with CUDA/IB
505+
env:
506+
BUILD_ID: "$(Build.BuildId)-$(Build.BuildNumber)"
507+
build_mode: soname_suffix
508+
soname_suffix_check_hw: yes
509+
ucx_gpu: yes
510+
EXECUTOR_NUMBER: $(AZP_AGENT_ID)
485511
486512
487513
- stage: AddressSanitizer

buildlib/tools/builds.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build_mode=${build_mode:-}
1818
build_mode=${build_mode:-long}
1919

2020
case "${build_mode}" in
21-
long|short|sanity|compilers)
21+
long|short|sanity|compilers|soname_suffix)
2222
;;
2323
*)
2424
azure_log_error "Unsupported build mode: ${build_mode}"
@@ -507,6 +507,8 @@ check_no_gga() {
507507
fi
508508
}
509509

510+
source ${realdir}/soname-build.sh
511+
510512
az_init_modules
511513
prepare_build
512514

@@ -537,11 +539,15 @@ long)
537539
'build_no_openmp' \
538540
'build_gcc_debug_opt_with_dndebug' \
539541
'build_clang' \
540-
'build_armclang')
542+
'build_armclang'\
543+
'build_soname_suffix')
541544
;;
542545
compilers)
543546
tests=('build_icc' 'build_pgi')
544547
;;
548+
soname_suffix)
549+
tests=('build_soname_suffix')
550+
;;
545551
esac
546552

547553
num_tests=${#tests[@]}

buildlib/tools/soname-build.sh

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
#
2+
# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
#
4+
# See file LICENSE for terms.
5+
#
6+
7+
check_elf_soname() {
8+
lib_path=$1
9+
soname=$2
10+
11+
if [ ! -f "$lib_path" ]; then
12+
azure_log_error "Missing library $lib_path"
13+
exit 1
14+
fi
15+
16+
if ! readelf -d "$lib_path" | grep -q "Library soname: \\[$soname\\]"; then
17+
azure_log_error "Library $lib_path does not have SONAME $soname"
18+
exit 1
19+
fi
20+
}
21+
22+
check_elf_needed() {
23+
binary_path=$1
24+
needed=$2
25+
26+
if [ ! -f "$binary_path" ]; then
27+
azure_log_error "Missing binary $binary_path"
28+
exit 1
29+
fi
30+
31+
if ! readelf -d "$binary_path" | grep -q "Shared library: \\[$needed\\]"; then
32+
azure_log_error "Binary $binary_path is not linked to $needed"
33+
exit 1
34+
fi
35+
}
36+
37+
check_linker_symlink() {
38+
link_path=$1
39+
target_pattern=$2
40+
41+
if [ ! -L "$link_path" ]; then
42+
azure_log_error "Missing linker symlink $link_path"
43+
exit 1
44+
fi
45+
46+
if ! readlink "$link_path" | grep -q "$target_pattern"; then
47+
azure_log_error "Linker symlink $link_path does not point to $target_pattern"
48+
exit 1
49+
fi
50+
}
51+
52+
check_uct_module_linkage() {
53+
module=$1
54+
suffix=$2
55+
module_path="${ucx_inst}/lib/ucx/libuct_${module}-${suffix}.so.0.0.0"
56+
shift 2
57+
58+
check_elf_soname "$module_path" "libuct_${module}-${suffix}.so.0"
59+
for needed in "$@"; do
60+
check_elf_needed "$module_path" "$needed"
61+
done
62+
}
63+
64+
build_soname_suffix() {
65+
suffix=ci
66+
foreign_build_dir=${ucx_build_dir}/foreign
67+
foreign_inst=${ucx_build_dir}/foreign-install
68+
soname_suffix_check_hw=${soname_suffix_check_hw:-no}
69+
common_soname_config_args=(
70+
--without-java
71+
--without-go
72+
--without-rocm
73+
--without-xpmem
74+
--without-knem
75+
--disable-doxygen-doc
76+
)
77+
78+
if [ "${soname_suffix_check_hw}" = "yes" ]; then
79+
echo "==== Enable CUDA and IB for SONAME suffix build ===="
80+
cuda_local_dir="/usr/local/cuda"
81+
have_gdrcopy=no
82+
83+
if ! nvidia-smi -L; then
84+
azure_log_error "SONAME suffix CUDA/IB check requires a GPU"
85+
exit 1
86+
fi
87+
88+
if [ ! -d /dev/infiniband ]; then
89+
azure_log_error "SONAME suffix CUDA/IB check requires IB devices"
90+
exit 1
91+
fi
92+
93+
if [ -d "$cuda_local_dir" ] &&
94+
find "$cuda_local_dir" -name 'libcudart.so.1[2-9]*' | grep -q .; then
95+
common_soname_config_args+=(--with-cuda=$cuda_local_dir)
96+
elif az_module_load $CUDA_MODULE; then
97+
common_soname_config_args+=(--with-cuda)
98+
else
99+
azure_log_error "SONAME suffix CUDA/IB check requires CUDA"
100+
exit 1
101+
fi
102+
103+
if [ -w "/dev/gdrdrv" ] && az_module_load $GDRCOPY_MODULE; then
104+
have_gdrcopy=yes
105+
common_soname_config_args+=(--with-gdrcopy)
106+
else
107+
common_soname_config_args+=(--without-gdrcopy)
108+
fi
109+
110+
common_soname_config_args+=(--with-verbs --with-rdmacm)
111+
else
112+
common_soname_config_args+=(
113+
--without-verbs
114+
--without-rdmacm
115+
--without-cuda
116+
)
117+
fi
118+
119+
echo "==== Build foreign UCX without SONAME suffix ===="
120+
mkdir -p $foreign_build_dir
121+
pushd $foreign_build_dir
122+
${WORKSPACE}/contrib/configure-release --prefix=$foreign_inst \
123+
"${common_soname_config_args[@]}"
124+
$MAKEP
125+
$MAKEP install
126+
popd
127+
128+
echo "==== Build with SONAME suffix and module deepbind ===="
129+
${WORKSPACE}/contrib/configure-release --prefix=$ucx_inst \
130+
--enable-gtest \
131+
--enable-test-apps \
132+
--with-soname-suffix=$suffix \
133+
--enable-module-deepbind \
134+
"${common_soname_config_args[@]}"
135+
$MAKEP
136+
$MAKEP install
137+
138+
grep "#define UCX_MODULE_FILE_SUFFIX \"-$suffix\"" config.h
139+
grep "#define UCX_MODULE_DLOPEN_DEEPBIND 1" config.h
140+
grep " -lucp-${suffix}" "${ucx_inst}/lib/pkgconfig/ucx.pc"
141+
grep " -lucs-${suffix} -lucm-${suffix}" \
142+
"${ucx_inst}/lib/pkgconfig/ucx-ucs.pc"
143+
grep " -luct-${suffix}" "${ucx_inst}/lib/pkgconfig/ucx-uct.pc"
144+
for lib in ucs ucp uct; do
145+
grep "lib${lib}-${suffix}.so" \
146+
"${ucx_inst}/lib/cmake/ucx/ucx-targets.cmake"
147+
done
148+
if [ "${soname_suffix_check_hw}" = "yes" ]; then
149+
grep "#define HAVE_CUDA 1" config.h
150+
grep "#define HAVE_IB 1" config.h
151+
fi
152+
153+
for lib in ucm ucs uct ucp; do
154+
check_elf_soname \
155+
"${ucx_inst}/lib/lib${lib}-${suffix}.so.0.0.0" \
156+
"lib${lib}-${suffix}.so.0"
157+
check_linker_symlink \
158+
"${ucx_inst}/lib/lib${lib}-${suffix}.so" \
159+
"lib${lib}-${suffix}\\.so"
160+
check_linker_symlink \
161+
"${ucx_inst}/lib/lib${lib}.so" \
162+
"lib${lib}-${suffix}\\.so"
163+
done
164+
165+
check_uct_module_linkage cma $suffix \
166+
"libuct-${suffix}.so.0" \
167+
"libucs-${suffix}.so.0"
168+
if [ "${soname_suffix_check_hw}" = "yes" ]; then
169+
for module in cuda ib rdmacm; do
170+
check_uct_module_linkage $module $suffix \
171+
"libuct-${suffix}.so.0" \
172+
"libucs-${suffix}.so.0"
173+
done
174+
if [ "${have_gdrcopy}" = "yes" ]; then
175+
check_uct_module_linkage cuda_gdrcopy $suffix \
176+
"libuct_cuda-${suffix}.so.0"
177+
fi
178+
fi
179+
check_elf_soname \
180+
"${ucx_build_dir}/test/gtest/ucs/test_module/.libs/libtest_module-${suffix}.so.0.0.0" \
181+
"libtest_module-${suffix}.so.0"
182+
check_elf_needed \
183+
"${ucx_inst}/lib/libucp-${suffix}.so.0.0.0" \
184+
"libuct-${suffix}.so.0"
185+
check_elf_needed \
186+
"${ucx_inst}/lib/libucp-${suffix}.so.0.0.0" \
187+
"libucs-${suffix}.so.0"
188+
for lib in ucp uct ucs; do
189+
check_elf_needed \
190+
"${ucx_inst}/bin/ucx_info" \
191+
"lib${lib}-${suffix}.so.0"
192+
done
193+
check_elf_needed \
194+
"${ucx_build_dir}/test/apps/.libs/libtest_ucx_isolation_plugin.so" \
195+
"libucp-${suffix}.so.0"
196+
197+
LD_LIBRARY_PATH="${ucx_inst}/lib:${foreign_inst}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \
198+
"${ucx_build_dir}/test/apps/test_ucx_dlopen_isolation" \
199+
"${foreign_inst}/lib/libucp.so.0.0.0" \
200+
"${ucx_build_dir}/test/apps/.libs/libtest_ucx_isolation_plugin.so" \
201+
"$suffix" deepbind
202+
203+
UCX_MODULES= \
204+
UCX_HANDLE_ERRORS=bt \
205+
GTEST_FILTER=test_sys.module_file_suffix \
206+
$MAKE -C test/gtest test
207+
}

cmake/ucx-targets.cmake.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(NOT TARGET ucx::ucs)
1111
add_library(ucx::ucs SHARED IMPORTED)
1212

1313
set_target_properties(ucx::ucs PROPERTIES
14-
IMPORTED_LOCATION "@libdir@/libucs.so"
14+
IMPORTED_LOCATION "@libdir@/libucs@UCX_LIBRARY_FILE_SUFFIX@.so"
1515
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
1616
)
1717
endif()
@@ -20,7 +20,7 @@ if(NOT TARGET ucx::ucp)
2020
add_library(ucx::ucp SHARED IMPORTED)
2121

2222
set_target_properties(ucx::ucp PROPERTIES
23-
IMPORTED_LOCATION "@libdir@/libucp.so"
23+
IMPORTED_LOCATION "@libdir@/libucp@UCX_LIBRARY_FILE_SUFFIX@.so"
2424
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
2525
)
2626
endif()
@@ -29,7 +29,7 @@ if(NOT TARGET ucx::uct)
2929
add_library(ucx::uct SHARED IMPORTED)
3030

3131
set_target_properties(ucx::uct PROPERTIES
32-
IMPORTED_LOCATION "@libdir@/libuct.so"
32+
IMPORTED_LOCATION "@libdir@/libuct@UCX_LIBRARY_FILE_SUFFIX@.so"
3333
INTERFACE_INCLUDE_DIRECTORIES "@includedir@"
3434
)
3535
endif()

0 commit comments

Comments
 (0)