Skip to content

ARCH/X86: Add AVX512 nt-buffer-transfer functions - #11954

Open
arun-chandran-edarath wants to merge 7 commits into
openucx:masterfrom
arun-chandran-edarath:ntbt_avx512_nt_kernels
Open

arun-chandran-edarath wants to merge 7 commits into
openucx:masterfrom
arun-chandran-edarath:ntbt_avx512_nt_kernels

Conversation

@arun-chandran-edarath

@arun-chandran-edarath arun-chandran-edarath commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What?

Add AVX512BW non-temporal destination and source kernels with masked edge handling. Select the AVX-512 implementation at compile time when configured with --with-avx512bw and retain AVX2 as the fallback.

This is the third part of the split from #11696, following #11878 and #11895.

Why?

Use the full AVX-512 vector width for large cache-bypassing transfers and use byte masks for non-cache-line-aligned edges.

How?

The NT destination kernel copies forward with streaming stores and an sfence. The NT source kernel copies backward with regular stores and no fence. Both implementations retain the existing dispatcher contract.

Build
AVX2: configure with --enable-optimizations.
AVX-512: configure with --with-avx512bw.

Runtime requirements
Currently recommended for workloads using one MPI rank per L3 cache domain.

Required runtime arguments(config params):
UCX_NT_BUFFER_TRANSFER_MIN=0

The default UCX_NT_BUFFER_TRANSFER_MIN start threshold is three-quarters of the detected L3 cache size.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucs/arch/x86_64/cpu.c

#ifdef __AVX__
#if defined(__AVX512BW__)
#include "cpu_nt_avx512.inl"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing in the build ever adds -mavx512bw — config/m4/compiler.m4 only has COMPILER_CPU_OPTIMIZATION([avx], ...), and no job in buildlib//contrib/ passes --with-avx/--enable-optimizations/-march=native. so this branch and the whole new .inl are never compiled, and test_arch.nt_buffer_transfer_* never covers them. can we add an avx512bw optimization knob plus a CI build that enables it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvegas1 @roiedanino Any suggestions on how to handle this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvegas1 @roiedanino @yosefe gentle reminder. Before I can address this thread,
we need to agree on how the AVX-512 kernels should be enabled in the build. I
see a few options and would like your view.

Current state:

  • The NT path is compiled only when __AVX__ is defined, i.e. with
    --enable-optimizations or --with-avx (-mavx).
    run_nt_buffer_transfer_tests in contrib/test_jenkins.sh already builds
    this way and runs test_arch.*.
  • No configure option adds -mavx512bw, so the AVX-512 kernels are compiled
    only when the user passes it in CFLAGS (for example -march=znver5). Such
    a build also skips the CPU_FLAGS check in ucs_check_cpu_flags(), so on a
    CPU without AVX-512 it fails with SIGILL instead of the FATAL message.

Options:

  1. Add --with-avx512bw that follows --enable-optimizations, like
    --with-avx.
    • No CI change: the roce worker that runs
      run_nt_buffer_transfer_tests (currently a Xeon Silver 4210R) supports
      AVX512BW, so it would test the AVX-512 kernels, and the Haswell and Sandy
      Bridge workers keep testing the AVX2 kernels.
    • Existing --enable-optimizations builds on AVX-512 hosts, including
      Skylake-SP and Cascade Lake, switch to the AVX-512 kernels.
      --without-avx512bw keeps the old behavior.
  2. Add --with-avx512bw as opt-in only (default no).
    • No change for existing builds.
    • Needs a CI change: an extra --with-avx512bw build in
      run_nt_buffer_transfer_tests on hosts with avx512bw in
      /proc/cpuinfo.
  3. No new configure option: keep the CFLAGS way and add a compile-only CI
    build.
    • Smallest change.
    • No CPU_FLAGS check and no CI run of the AVX-512 kernels.

For options 1 and 2, the flag would be -mavx512bw: it enables only AVX512F
and AVX512BW, which is what the kernels use, and it matches the
__AVX512BW__ check in cpu.c. As with -mavx today, it applies to the whole
library. I would also add AVX512BW to ucs_arch_get_cpu_flag() and
ucs_check_cpu_flags().

Which option do you prefer, or is there another approach you want? I will
update the PR once we agree.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems AVX-512 might not always be faster than AVX2 so i would not enable it for every --enable-optimizations build.

Can we do it this way?

  • add --with-avx512bw, default no (explicit opt-in) and test in CI
  • let --with-march=<arch> take a value (today it is only yes/no), and in m4 enable avx512bw by default only for arches where we measured a gain, e.g. znver5
  • in cpu.c, select the AVX-512 kernels from a configure define instead of __AVX512BW__, otherwise -march=znver4 in CFLAGS would still select them
  • add AVX512BW to ucs_arch_get_cpu_flag() / ucs_check_cpu_flags(), and one --with-avx512bw build in run_nt_buffer_transfer_tests

Also, is runtime selection doable? i.e. build both AVX2 and AVX-512 kernels, and pick one in ucs_cpu_init() by cpu flag + vendor/model (like ucs_cpu_memcpy_thresh()), with a UCX_ knob to override. It would let one binary use the best kernel on each CPU.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvegas1 agreed, opt-in is the right default for AVX-512. The update:

  • --with-avx512bw is off by default, and --enable-optimizations does not
    turn it on. If it is requested but the compiler or build machine cannot run
    AVX512BW code, configure fails instead of quietly building the AVX2 kernels.
  • The AVX-512 kernels are now selected by a configure define instead of
    __AVX512BW__, so -march=znver4 in CFLAGS alone keeps the AVX2 kernels.
  • AVX512BW is added to ucs_arch_get_cpu_flag() and checked at load time, so
    running such a build on a CPU without AVX512BW gives the FATAL message
    instead of SIGILL.
  • CI: run_nt_buffer_transfer_tests adds a --with-avx512bw build on
    AVX512BW hosts and runs test_arch.* with it.

Adding the flag exposed a bug in the existing detection.
ucs_arch_get_cpu_flag() reads CPUID leaf 7 without setting the sub-leaf in
ECX, so depending on the compiler it can read an invalid sub-leaf and miss AVX2
even on CPUs that have it. AVX512BW comes from the same leaf, so without a fix
a --with-avx512bw build could stop with the FATAL message on a CPU that does
support AVX512BW. The read now uses sub-leaf 0. A gtest cross-checks each of
the AVX2 and AVX512BW flags against __builtin_cpu_supports().

I kept --with-march=<arch> out of this PR:

  • On x86, configure never evaluates --with-march today. On AArch64 it means
    "use the detected -march", and accepting a value would change that.
  • -march lets the compiler use the whole ISA anywhere in UCX, while the
    load-time check covers only the flags UCX knows. A mismatch would then show
    up as SIGILL rather than the FATAL message.
  • A per-architecture default would mean keeping a CPU list in configure. With
    the opt-in option, anyone building for AVX-512 systems can already enable it
    with one flag.

I don't plan to add run-time selection either. The cases where AVX-512 loses
to AVX2 are mainly older CPUs, where 512-bit instructions lower the clock
frequency. Recent designs have reduced or removed that penalty, so we expect
AVX-512 to be the better choice on new CPUs. Run-time selection would be new
infrastructure, because UCX selects ISA-specific code only at build time
today. It would need both kernels in one library, a choice in ucs_cpu_init()
by vendor and model, a CPU table to maintain, and a UCX_ override, mostly to
serve CPUs that are going out of service. The opt-in option already covers
them: builds for those systems leave --with-avx512bw off.

Comment thread src/ucs/arch/x86_64/cpu.c Outdated
}

#ifdef __AVX__
#if defined(__AVX512BW__)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on Intel Skylake-SP/Cascade Lake, 512-bit stores trigger AVX-512 frequency licensing, so a -march=native build there may end up slower than the AVX2 path. should the AVX-512 kernels be picked by vendor/uarch instead of purely by __AVX512BW__?

ucs_memory_bus_store_fence();
}

/* AVX-512 NT_SOURCE copy-out: body stores, descending. An unconditional

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why descending here? ucs_x86_nt_src_avx2_buffer_transfer copies ascending, and the descent is the only reason for the four _bwd helpers — the same masked-head + ascending-body structure as ucs_x86_nt_dst_avx512_buffer_transfer would drop all of them.


/* Vector copy helpers. Ascending helpers store from the base [dst, dst+n);
* descending (_bwd) helpers store from the top [dst-n, dst). The
* ucs_compiler_fence() between the four stores pins their order (they are

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the store ordering needed here when cpu_nt_avx2.inl has no fences at all? each 512-bit store already covers a full 64B line, so write-combining should not depend on the order, and in the _bwd helpers these are plain WB stores where the barrier only constrains the scheduler.

Comment thread src/ucs/Makefile.am
arch/ppc64/cpu.h \
arch/rv64/cpu.h \
arch/x86_64/cpu.h \
arch/x86_64/cpu_nt_avx512.inl \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: pls keep the list sorted.

Suggested change
arch/x86_64/cpu_nt_avx512.inl \
arch/x86_64/cpu_nt_avx2.inl \
arch/x86_64/cpu_nt_avx512.inl \

static UCS_F_ALWAYS_INLINE void
ucs_x86_avx512_nt_masked_head_64(void *dst, const void *src, size_t edge_len)
{
const size_t head_pad = 64u - edge_len;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: -head_pad on a size_t wraps to 2^64 - head_pad and then relies on the implementation-defined (intptr_t) conversion in UCS_PTR_BYTE_OFFSET.

Suggested change
const size_t head_pad = 64u - edge_len;
const ptrdiff_t head_pad = 64 - (ptrdiff_t)edge_len;
const __mmask64 k = (__mmask64)(~0ull << head_pad);

@arun-chandran-edarath

Copy link
Copy Markdown
Contributor Author

@roiedanino @tvegas1 Please review.

@arun-chandran-edarath
arun-chandran-edarath requested a review from a team as a code owner November 23, 2026 13:02
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

CLA check passed

All commits are covered by a signed CLA.

@svc-ucx

svc-ucx commented Nov 23, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — CLA · commit dc24343f

TL;DR: This is not a code/test failure — the CLA GitHub Actions gate rejected PR #11954 because all 7 of its commits carry no verified GPG/SSH signature; the author must sign the CLA and re-sign (amend) the commits, then force-push.

Full analysis

Summary: The CLA workflow job failed with exit code 1 from buildlib/tools/cla_check.sh, reporting 7 commits without verified signatures.

Root cause: Policy gate failure, not a build/test regression. The log shows the check ran cleanly (Checking 7 new commits, 3 s runtime, no errors, no timeouts) and then deliberately failed:

### CLA check failed
- Commits without a verified signature: dc24343fcb (unsigned), [REDACTED:Hex High Entropy String] (unsigned),
  a8d0cf83d1 (unsigned), cf44479744 (unsigned), c56d15f36d (unsigned),
  8671fe0ce1 (unsigned), a8b863d09a (unsigned).
...
##[error]CLA check failed, see the job summary
##[error]Process completed with exit code 1.

Every commit on branch ntbt_avx512_nt_kernels is unsigned, so GitHub reports no verified signature and the script cannot bind the commits to a CLA-listed signer identity. Nothing in the UCX source (including the AVX512 NT-kernel changes in this PR) contributed to the failure — the job only sparse-checks out buildlib/tools/cla_check.sh and never compiles anything.

Implicated commit: The failure is attributable to the PR's own commits (HEAD [REDACTED:Hex High Entropy String], plus [REDACTED:Hex High Entropy String], a8d0cf8, cf44479, c56d15f, 8671fe0, a8b863d) being unsigned. The check itself was introduced by PR #12120 ("CI: Add UCF CLA check for pull requests").

File: buildlib/tools/cla_check.sh (invoked from .github/workflows/cla.yml) — note both files exist only on master at [REDACTED:Hex High Entropy String], not in this branch's tree, so they could not be read locally.

Suggested fix: The PR author should:

  1. Ensure their commit-author email is on the UCF CLA list (items 1 and 2 of .github/CONTRIBUTING.md); sign the individual or entity CLA if not already done, using the same email as git config user.email.
  2. Configure commit signing and re-sign the existing history, e.g.
    git config user.signingkey <key>; git config commit.gpgsign true (GPG) or gpg.format ssh with user.signingkey pointing at an SSH key uploaded to GitHub as a signing key, then
    git rebase --exec 'git commit --amend --no-edit -S' -i [REDACTED:Hex High Entropy String]
    and force-push the branch.
  3. Verify the commits show "Verified" in the GitHub UI, then re-run the CLA check (a new push re-triggers it automatically).

Do not retry the job or touch CI config expecting a different result — the check is deterministic and will keep failing until the commits are signed by a CLA-registered identity.

Related: #12120 (added the CLA check), #11954 (the failing PR), .github/CONTRIBUTING.md items 1–2

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 998c1687-574f-4aae-a89e-41048b427b4c in the triage console for the audit trail.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucs/arch/cpu.h Outdated
UCS_CPU_FLAG_AVX = UCS_BIT(9),
UCS_CPU_FLAG_AVX2 = UCS_BIT(10)
UCS_CPU_FLAG_AVX2 = UCS_BIT(10),
UCS_CPU_FLAG_AVX512BW = UCS_BIT(11)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master already uses UCS_BIT(11) for UCS_CPU_FLAG_LS64, which was added after this branch, so after a rebase two flags would share the same bit. pls rebase and take the next free bit.

Suggested change
UCS_CPU_FLAG_AVX512BW = UCS_BIT(11)
UCS_CPU_FLAG_AVX512BW = UCS_BIT(12)

Comment thread src/ucs/arch/x86_64/cpu.c
#ifndef __AVX512BW__
#error "HAVE_NT_AVX512BW is set but -mavx512bw is not in effect"
#endif
#include "cpu_nt_avx512.inl"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the kernel is picked at build time and -mavx512bw ends up in BASE_CFLAGS for the whole library, so ucs_check_cpu_flags() aborts such a build on any CPU without AVX512BW, and packaged builds can never enable it. why not dispatch at runtime on UCS_CPU_FLAG_AVX512BW, which this PR already detects, and build only this kernel with __attribute__((target("avx512bw")))?

Comment thread config/m4/compiler.m4
[no],
[AC_DEFINE([HAVE_NT_AVX512BW], [1],
[Use the AVX512BW NT buffer-transfer kernels])],
[AC_MSG_ERROR([--with-avx512bw was requested, but the compiler or this build machine does not support -mavx512bw])])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHECK_CROSS_COMP runs the probe, so --with-avx512bw now hard-fails on any build machine whose CPU lacks AVX512BW, even when the deployment target has it. can we make this one a compile/link-only check and leave the CPU validation to ucs_check_cpu_flags()?


/* 256B NT store (4x), ascending, aligned load. */
static UCS_F_ALWAYS_INLINE void
ucs_x86_avx512_loada_stream_256(void *dst, const void *src)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the four 256B helpers differ only in load alignment and store direction; can we fold them into one always-inline helper taking aligned/descending as constant args? root AGENTS.md asks not to duplicate similar implementation patterns.

__m512i z3 = _mm512_loadu_si512(sa + 3);

_mm512_stream_si512(da, z0);
ucs_compiler_fence();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is ucs_compiler_fence() needed between the stream stores here, while the AVX2 kernels issue 8 stream stores with no barrier? this is the hot loop, so pls keep the barriers only if they show a measurable gain.

ucs_memory_bus_store_fence();
}

/* AVX-512 NT_SOURCE copy-out: body stores, descending. An unconditional

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does the AVX-512 NT_SOURCE copy descend while the AVX2 one ascends? descending streams are less friendly to the HW prefetchers, so pls note the reason in the comment.

Comment thread contrib/test_jenkins.sh
echo "==== Running test_arch tests with optimizations ===="
./test/gtest/gtest --gtest_filter="test_arch.*"

if ! grep -qw avx512bw /proc/cpuinfo

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do the x86 CI nodes report avx512bw? if not, the whole --with-avx512bw build and the new kernels are silently never tested.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Add AVX512BW kernels with masked edge handling and compile-time ISA
selection. Keep the AVX2 implementation as the fallback when AVX512BW is
not enabled.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
CPUID leaf 7 reports the AVX2 and AVX-512 feature bits in EBX of
sub-leaf 0, selected by ECX. ucs_arch_get_cpu_flag() read the leaf
with ucs_x86_cpuid(), which loads only EAX, so the sub-leaf was
whatever ECX held. The value depends on code generation; in one
optimized build it was part of a stack address. CPUID returns zeros
for an invalid sub-leaf, so ucs_arch_get_cpu_flag() then omitted
UCS_CPU_FLAG_AVX2 on an AVX2-capable CPU.

Use ucs_x86_cpuid_ecx() with sub-leaf 0, as the leaf 4 cache code
already does.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
Compare UCS_CPU_FLAG_AVX2 with the compiler's __builtin_cpu_supports()
result. Before the previous commit read CPUID leaf 7 sub-leaf 0, UCX
did not report AVX2 on AVX2-capable CPUs and nothing noticed, because
no code or test consumed the flag.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
Comment thread src/ucs/arch/cpu.h Outdated
UCS_CPU_FLAG_AVX = UCS_BIT(9),
UCS_CPU_FLAG_AVX2 = UCS_BIT(10)
UCS_CPU_FLAG_AVX2 = UCS_BIT(10),
UCS_CPU_FLAG_AVX512BW = UCS_BIT(11)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker: UCS_BIT(11) is already taken by UCS_CPU_FLAG_LS64 on master, pls rebase and use UCS_BIT(12) for AVX512BW.

__m512i z3 = _mm512_loadu_si512(sa + 3);

_mm512_stream_si512(da, z0);
ucs_compiler_fence();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the ucs_compiler_fence() between the stores here? the AVX2 kernel issues 8 independent _mm256_stream_si256 without any, so this looks like an unexplained difference in the hot loop. (Applies to the other three helpers as well.)

ucs_memory_bus_store_fence();
}

/* AVX-512 NT_SOURCE copy-out: body stores, descending. An unconditional

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is NT_SOURCE descending here while the AVX2 NT_SOURCE kernel copies ascending? pls add the reason to the comment, it is the only place the two kernels differ in direction.

Add UCS_CPU_FLAG_AVX512BW. It is set when the CPU reports AVX,
AVX512F and AVX512BW, and XCR0 shows that the OS saves the opmask and
full ZMM state, so a hypervisor or kernel that hides AVX-512 state is
treated as lacking support.

Register "avx512bw" in ucs_check_cpu_flags() so a library built with
that CPU flag fails at load time on a CPU without it.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
Compare UCS_CPU_FLAG_AVX512BW with the compiler's
__builtin_cpu_supports() result. The test runs on every x86 host, so
hosts without AVX-512 check the negative case. GCC 5 and older reject
the "avx512bw" feature name, so the test is compiled only by Clang and
GCC 6 or newer.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
Select the AVX512BW NT buffer-transfer kernels with an explicit
--with-avx512bw configure option instead of the compiler's
__AVX512BW__ macro. A -march in CFLAGS that enables AVX-512 no longer
switches kernels on its own; such builds keep the AVX2 kernels.

The option defaults to no and is not enabled by
--enable-optimizations. When given, configure compiles and runs a
masked AVX512BW load and store on the build machine (link only when
cross-compiling) and stops with an error if that fails, rather than
silently building the AVX2 kernels. On success it adds -mavx512bw,
records avx512bw in CPU_FLAGS for the load-time CPU check, and defines
HAVE_NT_AVX512BW. Values other than yes or no are rejected.

COMPILER_CPU_OPTIMIZATION gains optional default, action-if-found and
action-if-not-found arguments; existing callers are unchanged.

cpu.c stops the build if HAVE_NT_AVX512BW is set while user CFLAGS
such as -mno-avx512bw turn AVX512BW off again.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
After the existing optimized build, check that ucx_info -b does not
report HAVE_NT_AVX512BW, which covers the default path. On a worker
whose CPU reports avx512bw, rebuild with --with-avx512bw, require
HAVE_NT_AVX512BW 1 in ucx_info -b, and rerun the test_arch tests
against the AVX512BW kernels. Other workers print an explicit skip.

Signed-off-by: Arun Chandran <Arun.Chandran@amd.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread contrib/test_jenkins.sh
return
fi

build release --enable-gtest --enable-optimizations --with-avx512bw

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second build is requested based on CPU flags only, but configure now hard-errors on --with-avx512bw if the compiler rejects -mavx512bw (e.g. gcc < 5), and build runs under set -e, so the whole job fails on such a host. Please gate this on compiler support too.

Comment thread config/m4/compiler.m4
# alone keeps the AVX2 kernels. The probe runs a masked AVX512BW load and store,
# so the build machine must support AVX512BW unless cross-compiling.
#
AS_CASE(["x$with_avx512bw"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this reads $with_avx512bw before COMPILER_CPU_OPTIMIZATION declares the option, and no other --with- validates its value. Can we fold the check into the macro so all CPU options behave the same?

Comment thread src/ucs/Makefile.am
arch/ppc64/cpu.h \
arch/rv64/cpu.h \
arch/x86_64/cpu.h \
arch/x86_64/cpu_nt_avx512.inl \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: list is alphabetical, "avx2" sorts before "avx512". Suggestion (replacing the two adjacent lines):

Suggested change
arch/x86_64/cpu_nt_avx512.inl \
arch/x86_64/cpu_nt_avx2.inl \
arch/x86_64/cpu_nt_avx512.inl \

@svc-nvidia-pr-review

Copy link
Copy Markdown

src/ucs/arch/x86_64/cpu_nt_avx512.inl

Please add one line on why NT_SOURCE descends here while the AVX2 kernel ascends; the direction flip is the main behavioral difference between the two files and is not obvious from the code. (Around line 218.)

Residual coverage gaps: the AVX-512 kernels are exercised only by run_nt_buffer_transfer_tests on an AVX512BW CI host; no default build compiles them, and no valgrind/ASAN job covers them (valgrind cannot execute EVEX encodings, so this is a reasonable consequence of the compile-time opt-in).

@svc-ucx

svc-ucx commented Nov 24, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer BlueField on worker 2) · commit 51605102

TL;DR: The BlueField ASan job failed on the LeakSanitizer check at the end of the gtest run (SUMMARY: AddressSanitizer: 68024 byte(s) leaked in 17 allocation(s)) during test_ucp_proto_mock_rcx_speed_change.rma_get — two ucp_wireup_eps (with their stub ifaces, an rc_mlx5 UCT EP/QP and the md dbrec buffers they pin) created in the test's init()/connect() are never destroyed after the device-speed-change EP reconfiguration. This is unrelated to PR #11954 (x86 AVX512 NT memcpy kernels, aarch64 job) and should be chased in the recent UCP path-bandwidth / speed-change series.

Full analysis

Summary: make test (gtest, AddressSanitizer BlueField/aarch64) exited with code 2 because LeakSanitizer reported 17 leaked allocations attributed to test_ucp_proto_mock_rcx_speed_change_rma_get.

Root cause: Every leaked allocation's stack bottoms out in the test's setup path:

  • ucp_test::init() → ucp_worker_create → ucp_worker_iface_open → uct_rc_mlx5_iface_t_new (CQ dbrecs ib_mlx5_dv.c:701/710, SRQ buf rc_mlx5_devx.c:233, dbrec mpool page ib_mlx5dv_md.c:1717)
  • test_ucp_proto_mock::connect() → ucp_ep_create → ucp_wireup_init_lanes → ucp_wireup_ep_create/ucp_wireup_ep_connect → uct_stub_iface_open (832 B in 2 objects) and uct_rc_mlx5_ep_t_new (320 B ep + 64 KB QP buffer via uct_ib_mlx5_devx_create_qp).

The QP buffer, the rc_mlx5 EP and the stub ifaces are reported as indirect leaks, i.e. they are still referenced by a leaked root object — the two wireup EPs created for the initial lanes. So the EPs/lanes built during connect() are dropped without uct_ep_destroy/discard, and because a dbrec from the md pool is still held, the md's dbrec mpool page also leaks at md close. The only thing this test does beyond a normal proto-mock test is repeatedly fire IBV_EVENT_DEVICE_SPEED_CHANGE (test_ucp_proto_mock.cc:5133), which drives ucp_worker_iface_ep_event_cb → ucp_worker_iface_path_bw_progress → ucp_worker_ep_path_bw_update and an EP reconfiguration (new ep/rkey configs each time). The reconfiguration path is leaking the previous lanes' wireup EPs. Note also that ucp_worker_destroy (src/ucp/core/ucp_worker.c:3415-3417) runs ucp_worker_discard_uct_ep_cleanup() (which sets UCP_WORKER_FLAG_DISCARD_DISABLED) before ucp_worker_destroy_eps()/ucp_ep_close_force(), and never removes a pending ucp_worker_iface_path_bw_progress oneshot nor frees leftover worker->ep_path_bw values (kh_destroy_inplace at line 3462 only) — both plausible contributors in this teardown ordering.

There is nothing in the log tying this to the PR under test: PR #11954 (ntbt_avx512_nt_kernels) touches x86 AVX-512 non-temporal memcpy kernels, which are not even compiled on this aarch64/BlueField agent. This is a master-side failure that the PR merge picked up.

Implicated commit: Most likely [REDACTED:Hex High Entropy String] "UCP/RMA: Balance GET by the path bandwidth samples of PUT (#12387)" — dmitrygx, 2026-11-21 (2 days before this build); it extends exactly the failing test (rma_get in test_ucp_proto_mock_rcx_speed_change) and the per-EP path-bandwidth/reconfiguration machinery. Same series/area: 4748c2a0 (#12362), 48795b8b (#12334) and f68fa5fc "UCP/CORE: Close endpoints by force on worker destroy (#12360)", all dmitrygx.

File: test/gtest/ucp/test_ucp_proto_mock.cc:5126-5222 (failing test); leaking product code: src/ucp/core/ucp_worker.c:1134-1184 / 3405-3417 and src/ucp/wireup/wireup.c:2194-2252 (ucp_wireup_connect_lane_to_ep / ucp_wireup_init_lanes).

Suggested fix:

  1. Don't block PR ARCH/X86: Add AVX512 nt-buffer-transfer functions #11954 on this — re-run the BlueField ASan job on current master to confirm the leak reproduces without the PR (./build-test/test/gtest/gtest --gtest_filter=*rcx_speed_change*rma_get* with ASan + detect_leaks=1).
  2. Fix the reconfiguration teardown: when the speed-change event causes a new EP configuration, make sure every old lane's uct_ep/ucp_wireup_ep goes through ucp_worker_discard_uct_ep() (or uct_ep_destroy) before the lane array is overwritten — the two leaked wireup EPs plus their next_ep prove one reconfiguration drops them silently.
  3. In ucp_worker_destroy(), force-close the endpoints before ucp_worker_discard_uct_ep_cleanup() (or drain discards again after ucp_worker_destroy_eps()), remove any pending ucp_worker_iface_path_bw_progress oneshot callbacks, and free remaining worker->ep_path_bw values instead of just kh_destroy_inplace.

Related: PR #12387 ([REDACTED:Hex High Entropy String]), PR #12362, PR #12334, PR #12360; possibly relevant open work on reconfiguration: #12410. Prior fix in the same test: 6f2c2dd3 "UCP/GTEST: Fix expected rkey config count in port speed change test".

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 5f31685c-3103-4995-94ba-d9d340e146f5 in the triage console for the audit trail.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants