-
Notifications
You must be signed in to change notification settings - Fork 35
[Feature] GPU Direct Storage(GDS) #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| UC_INFO("GDS driver initialized successfully"); | ||
| } else { | ||
| UC_ERROR("GDS driver initialized unsuccessfully"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error handling is insufficient, failures need to be visible to the caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Received,I'll fix it.
ucm/store/device/simu/simu_device.cc
Outdated
| } | ||
| Status S2DSync(int fd, void* address, const size_t length, const size_t fileOffset, const size_t devOffset) override | ||
| { | ||
| return Status::OK(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Status::Unsupported();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| bool DirectStorageQueue::Init(Device& device) | ||
| { | ||
| if (this->deviceId_ < 0) { return true; } | ||
| DeviceFactory::Setup(useDirect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface should be invoked in Setup(), not in Init().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U are right,I'll fix it.
| Status DirectStorageQueue::S2D(Task::Shard& shard, const Device& device) { | ||
| auto path = this->layout_->DataFilePath(shard.block, false); | ||
| int fd = -1; | ||
| auto status = HandlePool<std::string, int>::Instance().Get(path, fd, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use a singleton, use a member variable instead for HandlePool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under the current circumstances, singletons in processes created by fork are hanging. I will fix this.
| int fd = -1; | ||
| auto status = HandlePool<std::string, int>::Instance().Get(path, fd, | ||
| [&path](int& newFd) -> Status { | ||
| newFd = open(path.c_str(), O_RDONLY | O_DIRECT, 0644); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use file interface in file.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Received.
| int fd = -1; | ||
| auto status = HandlePool<std::string, int>::Instance().Get(path, fd, | ||
| [&path](int& newFd) -> Status { | ||
| newFd = open(path.c_str(), O_WRONLY | O_CREAT | O_DIRECT, 0644); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When are the handles cached in HandlePool closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will use member variables and release resources in the destructor.
| for (size_t i = 0; i < streamNumber; i++) { | ||
| auto q = std::make_shared<DirectStorageQueue>(); | ||
| status = | ||
| q->Setup(deviceId, ioSize, bufferNumber, &this->failureSet_, layout, timeoutMs, useDirect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DirectStorageQueue is always direct, and any other queue is never direct, the useDirect flag is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok,I'll fix it.
| q->Setup(deviceId, ioSize, bufferNumber, &this->failureSet_, layout, timeoutMs, useDirect); | ||
| if (status.Failure()) { break; } | ||
| this->queues_.emplace_back(std::move(q)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the if and else branches contain duplicated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Received.
Purpose
What this PR does / why we need it?
This feature introduces GPU Direct Storage (GDS) support to enable direct data transfer between GPU memory and storage, bypassing CPU memory as an intermediate buffer. This significantly reduces memory bandwidth bottlenecks and improves KV cache loading/offloading performance.
Modifications
Does this PR introduce any user-facing change?
A new parameter, useDirect, has been added to the service-startup command. When set to true, GDS transfer is enabled and the data path is Device Memory <-> Storage (direct). When set to false, the path becomes Device Memory <-> Host Memory <-> Storage, as shown below:
"kv_connector_extra_config": {
"ucm_connector_name": "UcmNfsStore",
"ucm_connector_config": {
"storage_backends": "/home/nfs",
"useDirect" : true
Test
How was this patch tested?
embed without GDS:

embed with GDS:

fetch without GDS:

fetch with GDS:
