Skip to content

[Core][TPU] Exclude non-compute PCI functions from VFIO discovery - #68609

Draft
liufangqi wants to merge 1 commit into
ray-project:masterfrom
liufangqi:fix/tpu-vfio-compute-functions-68548
Draft

liufangqi wants to merge 1 commit into
ray-project:masterfrom
liufangqi:fix/tpu-vfio-compute-functions-68548

Conversation

@liufangqi

Copy link
Copy Markdown

Description

On bare-metal tpu7x hosts, Ray can advertise 12 TPUs when only 8 are available for compute. The VFIO vendor check added in #65105 also matches SR-IOV physical functions and the tpu7x ICI management virtual function.

Skip physical functions that expose virtual functions. For tpu7x (VF device ID 0x0076), also skip the management function identified by the physical function's virtfn2 link. Both the advertised TPU count and the worker-visible VFIO device list use this lookup.

Related issues

Fixes #68548. A search for open TPU/VFIO PRs found no other change addressing this overcount.

Testing

The regression test uses a simulated sysfs layout. It checks both the TPU count and the VFIO paths, including that devices with a different PCI ID retain their third virtual function.

  • python -m pytest --import-mode=importlib python/ray/tests/accelerators/test_tpu.py -q -k 'autodetect or vfio' — 50 passed.
  • python -m pytest --import-mode=importlib python/ray/tests/accelerators/test_tpu.py -q -k 'not test_tpu_worker_visible_devices_and_chips and not test_tpu_task_env_restored_on_reused_worker' — 143 passed, 2 deselected.
  • pre-commit run --files python/ray/_private/accelerators/tpu.py python/ray/tests/accelerators/test_tpu.py — all applicable hooks passed.

AI assistance was used for the fix and tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core][TPU] TPUAcceleratorManager over-counts SR-IOV physical functions and ICI management VFs on bare-metal TPU hosts

1 participant