Skip to content
Merged
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
12 changes: 4 additions & 8 deletions mojo/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@ _gpu_toolchains_tag = tag_class(
"mi300x": "amdgpu:gfx942",
"mi325": "amdgpu:gfx942",
"rtx5090": "nvidia:120a",
"m1": "metal:10",
"m2": "metal:20",
"m3": "metal:30",
"m4": "metal:40",
"metal3": "metal:30",
"metal4": "metal:40",
},
doc = "The GPUs supported by this toolchain, mapping to Mojo's target accelerators.",
),
Expand All @@ -231,10 +229,8 @@ _gpu_toolchains_tag = tag_class(
"MI325": "mi325",
"Navi": "radeon",
"AMD Radeon Graphics": "radeon",
"Apple M1": "m1",
"Apple M2": "m2",
"Apple M3": "m3",
"Apple M4": "m4",
"Metal 3": "metal3",
"Metal 4": "metal4",
},
doc = "The output from nvidia-smi or rocm-smi to the corresponding GPU name in SUPPORTED_GPUS.",
),
Expand Down
10 changes: 5 additions & 5 deletions mojo/mojo_host_platform.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ def _get_apple_constraint(rctx, gpu_mapping):

_log_result(rctx, "/usr/sbin/system_profiler SPDisplaysDataType", result)

chipset = None
metal_version = None
for line in result.stdout.splitlines():
if "Chipset Model" in line:
chipset = line
if "Metal Support:" in line:
metal_version = line
break

if not chipset: # macOS VMs may not have GPUs attached
if not metal_version: # macOS VMs may not have GPUs attached
return None

for gpu_name, constraint in gpu_mapping.items():
if gpu_name in chipset:
if gpu_name in metal_version:
if constraint:
return "@mojo_gpu_toolchains//:{}_gpu".format(constraint)
else:
Expand Down