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

Get Device Capabilities for AMD GPUs #417

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
17 changes: 12 additions & 5 deletions exo/topology/device_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,19 @@ def linux_device_capabilities() -> DeviceCapabilities:
flops=CHIP_FLOPS.get(gpu_name, DeviceFlops(fp32=0, fp16=0, int8=0)),
)
elif Device.DEFAULT == "AMD":
# TODO AMD support
import pyamdgpuinfo

gpu_raw_info = pyamdgpuinfo.get_gpu(0)
gpu_name = gpu_raw_info.name
Copy link
Contributor

Choose a reason for hiding this comment

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

On my NixOS box there's no /usr/share/libdrm/amdgpu.ids, so this value is assigned None
You might want to consider using this instead (for cases where that happens or there's no matching card):

gpu_name = gpu_raw_info.name if gpu_raw_info.name is not None else "Unknown AMD"

gpu_memory_info = gpu_raw_info.memory_info["vram_size"]

if DEBUG >= 2: print(f"AMD device {gpu_name=} {gpu_memory_info=}")

return DeviceCapabilities(
model="Linux Box (AMD)",
chip="Unknown AMD",
memory=psutil.virtual_memory().total // 2**20,
flops=DeviceFlops(fp32=0, fp16=0, int8=0),
model=f"Linux Box ({gpu_name})",
chip=gpu_name,
memory=gpu_memory_info // 2**20,
flops=CHIP_FLOPS.get(gpu_name, DeviceFlops(fp32=0, fp16=0, int8=0)),
)
else:
return DeviceCapabilities(
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"prometheus-client==0.20.0",
"protobuf==5.27.1",
"psutil==6.0.0",
"pyamdgpuinfo==2.1.6;platform_system=='Linux'",
"pydantic==2.9.2",
"requests==2.32.3",
"rich==13.7.1",
Expand Down