Skip to content

Implement new synchronization read-write locking mode - #333

Merged
brminich merged 5 commits into
ai-dynamo:mainfrom
w1ldptr:rw2
May 21, 2025
Merged

brminich merged 5 commits into
ai-dynamo:mainfrom
w1ldptr:rw2

Conversation

@w1ldptr

@w1ldptr w1ldptr commented May 19, 2025

Copy link
Copy Markdown
Contributor

First, preparatory commits fixing/extending multi-threading tests.

Then, the new sync mode implementation that changes existing NIXL agent mutex from std to Abseil implementation which supports both regular exclusive locking and read-write modes. Add new 'RW' sync mode and take the lock in the read mode in a subset of NIXL data-path APIs (reateXferReq, postXferReq, getXferStatus, releaseXferReq, genNotif).

On top of that perform small UCX Context class refactoring to initialize UCX context and workers with the most appropriate setting according to the configuration requested by the user (sync mode, progress thread on/off, number of workers).

@github-actions

Copy link
Copy Markdown

👋 Hi w1ldptr! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

@copy-pr-bot

copy-pr-bot Bot commented May 20, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@w1ldptr
w1ldptr force-pushed the rw2 branch 2 times, most recently from aaf5586 to 0575e28 Compare May 20, 2025 08:48
Comment thread src/core/sync.h
Comment thread test/gtest/multi_threading.cpp
Comment thread test/nixl/nixl_test.cpp Outdated
Comment thread test/nixl/nixl_test.cpp Outdated
Comment thread test/gtest/multi_threading.cpp Outdated
Comment thread test/nixl/nixl_test.cpp Outdated
Comment thread test/nixl/nixl_test.cpp Outdated
Comment thread test/nixl/nixl_test.cpp Outdated
w1ldptr added 5 commits May 20, 2025 22:16
The test wasn't updated during previous nixlAgentConfig constructor API
change and doesn't compile. Update the API usage.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Since this change also makes genNotify execute in parallel with several
other data path functions also cover it with thread sanitizer test.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Abseil mutex can be used as a regular mutex or as a read-write lock which
is convenient for run-time selection of synchronization model.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Implement new RW mode that takes advantage of Abseil mutex functionality
that allows using it as a read-write lock:

- Refactor nixlLock class to use callbacks internally in order to simplify
the structure of its methods by doing all necessary processing according to
user-specified mode in the class constructor. All API methods just call
mode-specific callbacks set by the constructor.

- Take the lock in read mode for a data-path subset of NIXL Agent
API (reateXferReq, postXferReq, getXferStatus, releaseXferReq, genNotif).

- Continue using the lock in regular write mode for all other API methods.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Current UCX context configuration doesn't properly take advantage of
synchronization model and progress thread options. Instead of UCX backend
setting the most restrictive option possible, pass progress thread flag,
number of UCX workers and NIXL sync mode. Set the following UCX context
config toggles based on those parameters:

- Set UCX config 'mt_workers_shared' to 1 only when multiple workers have
been requested by the user.

- When progress thread is disabled and sync mode is strict or none chose
NIXL_UCX_MT_SINGLE multi-threading type which translates to
UCS_THREAD_MODE_SERIALIZED UCX worker thread mode. Otherwise, chose
NIXL_UCX_MT_WORKER type which translates to UCS_THREAD_MODE_MULTI UCX
worker mode.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>

This branch was previously deployed

2 inactive deployments
GITLAB — 91e62d7b Deployed May 20, 2025 by copy-pr-bot[bot]
SWX_AWS — 91e62d7b Deployed May 20, 2025 by copy-pr-bot[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants