Skip to content

Conversation

@anton-nayshtut
Copy link
Contributor

@anton-nayshtut anton-nayshtut commented Nov 24, 2025

What?

This patch set minimizes the IO queue abstraction, making it as low-level as possible.

Why?

This patch set prepares the code for the POSIX plugin threading model implementation. With it, the threading will be implemented once, in the posix_backend.

How?

The IO queue abstraction now only wraps the lowest-level IO-related API. It works with a set of IOs (writes or reads) while leaving the Xfer level logic to the upper layer (posix_backend).

This patch set allows the posix_backend to implement the common logic, while only offloading the details of specific file access API to the IO queue abstraction.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Nov 24, 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

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

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

🚀

@anton-nayshtut anton-nayshtut changed the title plugins/posix: file_api abstraction plugins/posix: minimized IOQueue abstraction Nov 25, 2025
@anton-nayshtut anton-nayshtut changed the title plugins/posix: minimized IOQueue abstraction plugins/posix: minimized IO queue abstraction Nov 25, 2025
}

protected:
static std::map<std::string, nixlPosixIOQueueCreateFn> apis;
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is implicit singleton, which is often considered as anti-pattern
Maybe these fields should not be static?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I replaced it by a static array. Please don't hesitate to suggest an alternative.

static const uint32_t MAX_IOS;
};

#define NIXL_POSIX_IO_QUEUE_REGISTER(io_queue_name, class_name) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's C++, better use template, not macro

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The macro has changed. Please re-examine.

@anton-nayshtut anton-nayshtut force-pushed the antonn/posix_file_api branch 2 times, most recently from b131f48 to 1546c41 Compare November 26, 2025 14:33
virtual ~nixlPosixIOQueue() {}

virtual nixl_status_t
enqueue(int fd,
Copy link
Contributor

Choose a reason for hiding this comment

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

This enqueue encapsulates all possible params, even if some of them are not used by an actual impl, right?
IMO this is not very clean from design perspective

At least we can define a structure for these params, need to think more on that
The class itself may be a template, so that we can encapsulate the common structures (free_list, etc)
This way you can reuse much more than just an interface

Maybe it should be something like:

template <typename Entry>
class nixlQ {
    protected:
        std::list<Entry> free_list_;  // reuse common logic in all impl
        ..
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This enqueue encapsulates all possible params, even if some of them are not used by an actual impl, right?
No. All params are used by each impl but they're treated differently.

I'll think about templates though. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the other hand, the whole idea of this design is to properly use inheritance - have generic nixlPosixIOQueue pointer and instantiate it as a specific IO Queue type. As far as I understand, templates are incompatible with this idea. Am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! I get it. I can have an additional level of inheritance, which would be a template. Will do. Thanks!

This patch set minimizes the IO queue abstraction, making it as low-
level as possible.

It now only wraps the lowest-level IO-related API. It works with a set
of IOs (writes or reads) while leaving the Xfer level logic to the upper
layer (posix_backend).

This patch set allows the posix_backend to implement the common logic,
while only offloading the details of specific file access API to the IO
queue abstraction.

This patch set prepares the code for the POSIX plugin threading model
implementation. With it, the threading will be implemented once,
in the posix_backend.

Signed-off-by: Anton Nayshtut <[email protected]>
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.

3 participants