Skip to content
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

vmm: add NVIDIA GPUDirect P2P support. #6235

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

thomasbarrett
Copy link
Contributor

@thomasbarrett thomasbarrett commented Feb 26, 2024

On platforms where PCIe P2P is supported, inject a PCI capability into NVIDIA GPU to indicate support.

A previous PR added support for PCIe P2P between VFIO devices. The NVIDIA driver does not utilize PCIe P2P unless it detects hardware support. The PCIe specification doesn't require platforms to support PCIe P2P traffic between root ports (although many systems do). Within a virtual machine, information about the host PCIe bridge is lost, so NVIDIA recommends the use of an injected PCI capability to signal support for PCIe P2P between GPUs.

This PR adds a new argument x_nv_gpudirect_clique to VFIO devices --device path=<PCI_DEVICE_PATH>,x_nv_gpudirect_clique=<CLIQUE_ID> that injects a PCI capability indicating the "P2P clique" that the GPU belongs to. This option is only valid for modern datacenter NVIDIA GPUs (NVIDIA Turing, Ampere, Hopper, and Lovelace). The NVIDIA provided specification can be found here.

After enabling this feature, we benchmarked a decrease in GPU P2P latency from 12 us to 1.4 us compared to the fallback shared memory communication mechanism.

The nvidia-smi utility can be used to confirm that the P2P support. For example, the following cloud-hypervisor guest has 4 NVIDIA L40S GPUS.

nvidia-smi topo -p2p r
 	GPU0	GPU1	GPU2	GPU3	
 GPU0	X	OK	OK	OK	
 GPU1	OK	X	OK	OK	
 GPU2	OK	OK	X	OK	
 GPU3	OK	OK	OK	X	

Legend:

  X    = Self
  OK   = Status Ok
  CNS  = Chipset not supported
  GNS  = GPU not supported
  TNS  = Topology not supported
  NS   = Not supported
  U    = Unknown

@rbradford
Copy link
Member

I slightly prefer the naming QEMU has - x-nv-gpudirect-clique - will also make it easier for folks to google, wdyt?

@thomasbarrett
Copy link
Contributor Author

Yeah that makes sense to me @rbradford. Do you like x-nv-gpudirect-clique or nv-gpudirect-clique? We don’t have a “x-” naming convention in cloud-hypervisor?

@rbradford
Copy link
Member

Yeah that makes sense to me @rbradford. Do you like x-nv-gpudirect-clique or nv-gpudirect-clique? We don’t have a “x-” naming convention in cloud-hypervisor?

Yes, I think the x- prefix is a good idea.

@thomasbarrett thomasbarrett force-pushed the gpudirectp2p branch 2 times, most recently from 9e2989d to fdb7a6b Compare February 28, 2024 19:22
@rbradford
Copy link
Member

@thomasbarrett the CI configuration has changed so please rebase your work on the latest "main" branch

On platforms where PCIe P2P is supported, inject a PCI capability into
NVIDIA GPU to indicate support.

Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com>
Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

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

Thanks @thomasbarrett - without access to this specific hardware am trusting your testing :-)

@rbradford rbradford added this pull request to the merge queue Feb 29, 2024
@rbradford rbradford removed this pull request from the merge queue due to a manual request Feb 29, 2024
@rbradford rbradford added this pull request to the merge queue Feb 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 29, 2024
@rbradford rbradford added this pull request to the merge queue Feb 29, 2024
Merged via the queue into cloud-hypervisor:main with commit b750c33 Feb 29, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants