Skip to content

Enhance Dynamic MIG: Optimize the MIG template allocation algorithm #2831

Description

@FouoF

Improve MIG profile placement and template selection so that each allocation preserves the largest possible contiguous free region and reduces fragmentation.

For common seven-slice GPUs, such as an A100 configured as 7 × 1g, a greedy strategy can be used:

  1. Process profiles that require more slices first.
  2. Evaluate the remaining contiguous space after each candidate placement.
  3. Prefer placements that do not split a large free region into smaller fragments.
  4. Use a stable and deterministic placement order when multiple candidates have the same score.
  5. Fall back to backtracking or exhaustive search when the greedy strategy cannot find a valid solution.

For example, a 1g instance should preferably be allocated from the edge of a free region so that the remaining contiguous slices can still accommodate 2g, 3g, or larger profiles.

The algorithm should cover:

  • Multiple allocations of the same profile.
  • Mixed small and large profiles.
  • GPUs with existing active MIG instances.
  • Cases where greedy selection fails but backtracking can still find a valid placement.
  • Different GPU models, slice counts, and placement constraints reported by NVML.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions