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

Detect Intel ARC GPU in Meteor Lake chipset #749

Merged
merged 2 commits into from
Feb 7, 2025
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: 11 additions & 1 deletion ramalama/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,19 @@ def get_gpu():
os.environ["HIP_VISIBLE_DEVICES"] = str(gpu_num)
return

# INTEL iGPU CASE (Look for ARC GPU)
igpu_num = 0
for fp in sorted(glob.glob('/sys/bus/pci/drivers/i915/*/device')):
with open(fp, 'rb') as file:
content = file.read()
if b"0x7d55" in content:
igpu_num += 1

if igpu_num:
os.environ["INTEL_VISIBLE_DEVICES"] = str(igpu_num)

def get_env_vars():
prefixes = ("ASAHI_", "CUDA_", "HIP_", "HSA_")
prefixes = ("ASAHI_", "CUDA_", "HIP_", "HSA_", "INTEL_")
env_vars = {k: v for k, v in os.environ.items() if k.startswith(prefixes)}

# gpu_type, gpu_num = get_gpu()
Expand Down
2 changes: 2 additions & 0 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _image(self, args):
"HIP_VISIBLE_DEVICES": "quay.io/ramalama/rocm",
"CUDA_VISIBLE_DEVICES": "quay.io/ramalama/cuda",
"ASAHI_VISIBLE_DEVICES": "quay.io/ramalama/asahi",
"INTEL_VISIBLE_DEVICES": "quay.io/ramalama/intel-gpu",
}

image = images.get(gpu_type, args.image)
Expand Down Expand Up @@ -199,6 +200,7 @@ def gpu_args(self, args, runner=False):
or os.getenv("HIP_VISIBLE_DEVICES")
or os.getenv("ASAHI_VISIBLE_DEVICES")
or os.getenv("CUDA_VISIBLE_DEVICES")
or os.getenv("INTEL_VISIBLE_DEVICES")
or (
# linux and macOS report aarch64 differently
platform.machine() in {"aarch64", "arm64"}
Expand Down
Loading