intel / intel/torch-xpu-ops

Setup Self-hosted runner for Copilot auto debugging

Open
#3,345 0 comments 0 reactions 1 assignee Claimed by @chuanqi129 View on GitHub
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 13h
Merged PRs (30d)
107

Description

# Issue Description

We are trying to fully leverage on the copilot to do first round of issue fix and submit the PR. No local device will be involved.

But currently, the agent on the cloud does not have the XPU device, so it can't setup the auto-run/fix during the dialogue.

```
Validation run
python -m compileall test/xpu/test_torch_xpu.py ✅
Could not run runtime XPU tests locally because this sandbox lacks torch at runtime.
```

# Solution
To follow https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/cloud-agent/customize-the-agent-environment

We need to setup the `.github/workflows/copilot-setup-steps.yml` similar as follows:

This exposed the `pvc_rolling` label self-hosted runner for the copilot cloud.

```yaml
name: "Copilot Setup Steps"

# Automatically run when changed to allow easy validation.
# Also allows manual testing via the repository's "Actions" tab.
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
# Run on the project's self-hosted Intel XPU runner.
# NOTE: Copilot's integrated firewall is incompatible with self-hosted runners.
# You MUST disable it in: Repository Settings → Copilot → "Disable firewall".
runs-on: pvc_rolling

permissions:
contents: read

timeout-minutes: 30

steps:
- name: Checkout code
uses: actions/checkout@v4

# Source Intel oneAPI environment if available on the runner.
# This provides the SYCL compiler (icx/icpx), CMake toolchain, and XPU drivers.
- name: Source Intel oneAPI environment
run: |
if [ -f /opt/intel/oneapi/setvars.sh ]; then
source /opt/intel/oneapi/setvars.sh --force
# Persist oneAPI env vars for subsequent steps
env | grep -E '^(ONEAPI_ROOT|CMPLR_ROOT|DPCPPROOT|MKLROOT|SYCL|OCL_ICD|CPATH|LD_LIBRARY_PATH|PKG_CONFIG_PATH|PATH|LIBRARY_PATH)=' \
>> "$GITHUB_ENV" || true
else
echo "oneAPI setvars.sh not found at /opt/intel/oneapi/setvars.sh — skipping."
fi

# Ensure uv is available for fast Python package management (used by lintrunner.sh).
- name: Ensure uv is installed
run: |
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
fi

# Install Python build dependencies from pyproject.toml [build-system] requires.
- name: Install Python build dependencies
run: |
uv pip install --system \
setuptools \
wheel \
numpy \
ninja \
pyyaml \
cmake \
"typing-extensions" \
requests

# Install Python linting tools used by .github/scripts/lintrunner.sh.
- name: Install linting tools
run: |
uv pip install --system \
lintrunner \
ruamel.yaml \
ruff

# Verify the CMake + SYCL toolchain can find the XPU build dependencies.
- name: Verify CMake and SYCL toolchain
run: |
cmake --version
if command -v icpx &> /dev/null; then
icpx --version
else
echo "icpx not in PATH — CMake XPU builds may not work without oneAPI."
fi
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.