Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mooncake-transfer-engine/src/topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,11 @@ static std::vector<TopologyEntry> discoverCudaTopology(
avail_hca.push_back(hca.name);
}
}
topology.push_back(TopologyEntry{.name = "cuda:" + std::to_string(i),
.preferred_hca = preferred_hca,
.avail_hca = avail_hca});
topology.push_back(
TopologyEntry{.name = "cuda:" + std::to_string(i),
TopologyEntry{.name = "gpu:" + std::to_string(i),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wonder what the difference is between cuda:x and gpu:x, it seems the same thing in torch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is no difference for the Torch API. However, now, in Mooncake, we select the device to use based on the segment buffer name, which is a string comparison. Therefore, if the user registers the memory and declares it as “gpu:”, Mooncake will fall back to using the device corresponding to kWildcardLocation because it cannot find a matching string.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nope, I do think people should use cuda: instead of gpu:, see document here: https://github.com/kvcache-ai/Mooncake/blob/main/doc/zh/transfer-engine.md#transferengineregisterlocalmemory

Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing the name may lead compatibility problem after merging it.

Copy link
Collaborator

@alogfans alogfans Jul 31, 2025

Choose a reason for hiding this comment

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

In other words, you can check whether there is any hard-coded "cuda:" in elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other words, you can check whether there is any hard-coded "cuda:" in elsewhere.

mooncake internal (location and topology) uniformly uses cuda:xx.

.preferred_hca = std::move(preferred_hca),
.avail_hca = std::move(avail_hca)});
}
Expand Down
9 changes: 8 additions & 1 deletion mooncake-transfer-engine/src/transfer_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fstream>
#include <string>

#include "config.h"
#include "transfer_metadata_plugin.h"
#include "transport/transport.h"

Expand Down Expand Up @@ -150,8 +151,11 @@ int TransferEngine::init(const std::string &metadata_conn_string,
} else {
local_topology_->discover(filter_);
}
LOG(INFO) << "Topology discovery complete. Found "
LOG(INFO) << "Auto-discovering topology complete: Found "
<< local_topology_->getHcaList().size() << " HCAs.";
if (globalConfig().trace) {
LOG(INFO) << "Topology:\n" << local_topology_->toString();
}

#ifdef USE_MNNVL
if (local_topology_->getHcaList().size() > 0 &&
Expand Down Expand Up @@ -215,6 +219,9 @@ Transport *TransferEngine::installTransport(const std::string &proto,
LOG(ERROR) << "Failed to parse NIC priority matrix";
return nullptr;
}
if (globalConfig().trace) {
LOG(INFO) << "Install transport " << proto << " with custom topology:\n" << local_topology_->toString();
}
}

transport = multi_transports_->installTransport(proto, local_topology_);
Expand Down
Loading