Skip to content

Where to set VMGpuPartitionAdapter Params? #44

@eric-gitta-moore

Description

@eric-gitta-moore

Generally speaking, if using PowerShell to configure GPU-PV, parameters such as OptimalPartitionCompute would be utilized. I would like to know if there is a way to set such parameters in the HCS API? For example, restricting a certain virtual machine to using only 50% of the GPU resources.

NVIDIA SOP of GPU-PV setup: https://docs.nvidia.com/vgpu/latest/pdf/grid-vgpu-user-guide.pdf (page 29)

# VM name
$vmName = "GuestVmWithGpu"

$hostGpus = Get-VMHostPartitionableGpu
$targetGpuIndex = 0
$targetGpu = $hostGpus[$targetGpuIndex]

# From nvidia docs https://docs.nvidia.com/vgpu/latest/pdf/grid-vgpu-user-guide.pdf
Remove-VMGpuPartitionAdapter -VMName $vmName
Add-VMGpuPartitionAdapter -VMName $vmName `
-MinPartitionVRAM $targetGpu.MinPartitionVRAM `
-MaxPartitionVRAM $targetGpu.MaxPartitionVRAM `
-OptimalPartitionVRAM $targetGpu.OptimalPartitionVRAM `
-MinPartitionEncode $targetGpu.MinPartitionEncode `
-MaxPartitionEncode $targetGpu.MaxPartitionEncode `
-OptimalPartitionEncode $targetGpu.OptimalPartitionEncode `
-MinPartitionDecode $targetGpu.MinPartitionDecode `
-MaxPartitionDecode $targetGpu.MaxPartitionDecode `
-OptimalPartitionDecode $targetGpu.OptimalPartitionDecode `
-MinPartitionCompute $targetGpu.MinPartitionCompute `
-MaxPartitionCompute $targetGpu.MaxPartitionCompute `
-OptimalPartitionCompute $targetGpu.OptimalPartitionCompute

# Allow the VM to control cache types for MMIO access.
Set-VM -GuestControlledCacheTypes $true -VMName $vmName

# Set the lower MMIO space to 1 GB to allow sufficient MMIO space to be mapped.
# This amount is twice the amount that the device must allow for alignment. Lower
# MMIO space is the address space below 4 GB and is required for any device that has
# 32-bit BAR memory
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vmName

# Set the upper MMIO space to 32 GB to allow sufficient MMIO space to be mapped.
# This amount is twice the amount that the device must allow for alignment. Upper
# MMIO space is the address space above approximately 64 GB
Set-VM -HighMemoryMappedIoSpace 32GB -VMName $vmName

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions