Skip to content

Conversation

@mamar123
Copy link
Contributor

@mamar123 mamar123 commented Aug 5, 2025

What?

Refactored plugins GTest infrastructure to support more flexible test cases and flows.

Why?

To make it easier to add and manage test variations (e.g., sizes, random data, edge cases) and reduce duplication.

How?

Used transferMemConfig for configuration, added support for random buffers, and simplified test setup logic.

@mamar123 mamar123 requested a review from a team as a code owner August 5, 2025 11:24
@copy-pr-bot
Copy link

copy-pr-bot bot commented Aug 5, 2025

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.

@github-actions
Copy link

github-actions bot commented Aug 5, 2025

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

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

🚀

@mamar123
Copy link
Contributor Author

mamar123 commented Aug 5, 2025

/ok to test 79dc9d2

@mamar123
Copy link
Contributor Author

mamar123 commented Aug 5, 2025

/build

ovidiusm
ovidiusm previously approved these changes Aug 6, 2025
aranadive
aranadive previously approved these changes Aug 7, 2025
@mamar123 mamar123 dismissed stale reviews from aranadive and ovidiusm via e25d9ed August 10, 2025 11:16
@mamar123 mamar123 force-pushed the plugins_gtest_enhance_pr branch from 79dc9d2 to e25d9ed Compare August 10, 2025 11:16
@mamar123
Copy link
Contributor Author

/build

@mamar123
Copy link
Contributor Author

/ok to test e25d9ed

@mamar123
Copy link
Contributor Author

/build

}

TEST_P(setupObjTestFixture, XferMultiBufsTest) {
transferMemConfig mem_cfg{.numBufs_ = 3};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is 3 a must? if yes, please use a constant, otherwise a random value to make it clear

Comment on lines +39 to +43
const size_t numEntries_ = 1;
const size_t entrySize_ = 64;
const size_t numBufs_ = 1;
const uint8_t srcBufByte_ = getRandomInt(0, 255);
const uint8_t dstBufByte_ = getRandomInt(0, 255);
Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought, not sure if const is the right choice when applied for everything.
This has several drawbacks e.g. impossible to assign.
If this configuration is local and we don't keep it - its fine to have the user decide.

Comment on lines +66 to +67
srcDevId_(0),
dstDevId_(isRemoteXfer_ ? 1 : 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does 0/1 means? should they be constants?


void
setLocalMem() {
addSrcDesc(nixlMetaDesc &meta_desc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can be const

}

void
addDstDesc(nixlMetaDesc &meta_desc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can be const

nixl_status_t
waitForTransfer() {
nixl_status_t ret = NIXL_IN_PROG;
auto end_time = absl::Now() + absl::Seconds(3);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 3? maybe a constant?

int entry_size = split_buf ? ENTRY_SIZE : BUF_SIZE;
for (size_t i = 0; i < srcMem_.size(); i++) {
for (int entry_i = 0; entry_i < num_entries; entry_i++) {
for (size_t entry_i = 0; entry_i < memConfig_.numEntries_; entry_i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

auto is easier to maintain

Comment on lines +120 to +125
while (ret == NIXL_IN_PROG && absl::Now() < end_time) {
ret = srcBackendEngine_->checkXfer(xferHandle_);
if (ret != NIXL_SUCCESS && ret != NIXL_IN_PROG) return ret;

if (dstBackendEngine_->supportsProgTh()) dstBackendEngine_->progress();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ret == NIXL_IN_PROG in the condition isn't needed since you're only waiting for NIXL_SUCCESS or timeout
This loop can be rewritten as follows (in a more declarative way):

        auto progress = { if (dstBackendEngine_->supportsProgTh()) dstBackendEngine_->progress();  };
        do {
            auto ret = srcBackendEngine_->checkXfer(xferHandle_);
            if (ret != NIXL_SUCCESS && ret != NIXL_IN_PROG) return ret;

            progress();
        } while (absl::Now() < end_time);

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.

4 participants