Logo von Xpu Port

Xpu Port

Organisation
intel
xpu-port

Execute a single-target CUDA-to-XPU port of a PyTorch Python repo with libcst-based scan, mechanical rewrite, optional generic availability checks, and CPU FP64 vs target-dtype correctness verify on one forward pass. Use when the request says "port" — "port my repo to XPU", "port my repo at ./my-model to XPU", "rewrite the CUDA calls to XPU", "apply the mechanical transforms", "run the scan and rewrite", "make the port changes now". Not for the "migrate" verb ("migrate my repo", "migrate this repo to XPU") or a bare whole-repo workflow request where scope is not yet set — those start with cuda-to-xpu-migration, whose plan routes here. Not for assessment-only, throughput (torch-xpu-bench), op-level slowness (torch-xpu-profile), custom CUDA C++ extensions, or dual-target CUDA+XPU codebases.

Übersicht

Herausgeberintel
Repositoryskills
Skill-Namexpu-port
Sterne
31
Forks
14
Mitgelieferte Dateien
5
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • 5 mitgelieferte Dateien

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von intel auf GitHub veröffentlicht. Prüfen Sie den Quellinhalt vor der Installation.

Installation

Installieren Sie den KI-Skill Xpu Port in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner — liest SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/intel/skills/tree/main/skills/xpu-port
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill anlegen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format lesen kann, kann diesen Skill nutzen — kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/intel/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/xpu-port .claude/skills/xpu-port
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Xpu Port in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Xpu Port automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Xpu Port nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Keys.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

xpu-port

Three deterministic scripts; the agent drives the loop.

scripts/
├── xpu_port_scan.py     # libcst, classifies sites mechanical/semantic/escalate
├── xpu_port_rewrite.py  # libcst, named transforms, --check previews diff
└── xpu_port_verify.py   # CPU FP64 reference vs target dtype, one forward
sh
pip install libcst

Targets

Single-target XPU only. After the port, the codebase runs on Intel XPU. CUDA call sites are rewritten, not dual-gated. If the user wants both CUDA and XPU at runtime (dual-target), stop and say so — that's a different problem (per-call-site guards, device-aware factories) and this skill produces broken half-ported code if used for it.

Backstop — wrong entry point

This skill executes; it does not assess or route. One redirect exists, pointing one way. If the request is really an assessment or a whole-repo migration ("migrate this repo", "what would it take to run on XPU" — scope not yet set), hand it to cuda-to-xpu-migration and stop; its report's Next steps lead back here for the Python surface.

The same backstop covers mis-scoped ports. This skill reads Python source only — its gates say nothing about Dockerfiles, launch scripts, or dependency pins. When no migration report is in hand and the step-1 scan comes back empty while its advisory flags NVIDIA/CUDA infrastructure surfaces, the port was mis-scoped: hand it to cuda-to-xpu-migration and stop. When a migration report is in hand, execute the Python surface it scoped and list its non-Python surfaces as documented-not-rewritten — an advisory on the final scan does not reopen this gate (see step 5).

Procedure

The port's minimum gate is final scan empty + verifier green. Both are necessary; neither alone is sufficient (for service repos with no single forward, the serving skill's smoke test stands in for the verifier — see step 6).

Important: the verifier confirms one forward pass is numerically correct — it does not confirm the training loop runs end-to-end (e.g. torch.compile, custom LR schedulers, or data-loader workers may still fail on XPU). After the gates pass, run at least 2 real training iterations on the target device before declaring the port complete.

1. Scan

sh
python3 path/to/xpu_port_scan.py . > findings.json

Findings tagged mechanical (safe to rewrite), semantic (agent edits per references/semantic-patterns.md), escalate (custom .cu, CUDAExtension, CUDA-only attrs — agent decides per finding). Each finding also carries a route field: a skill name (e.g. torch-xpu-profile) names the skill an orchestrating agent should chain to for that site; null means there is no single downstream skill — either xpu-port resolves the site in-loop (a mechanical transform or a semantic hand-edit) or the site is escalate (redesign, no mechanical port). Read bucket first: null does not by itself mean "already handled".

Empty scan on an NVIDIA-stacked repo: if the scan found no real CUDA sites (synthetic unreadable/unparseable bookkeeping findings don't count) but the JSON contains an advisory block (also printed to stderr; emitted on directory scans only — a single-file scan never carries one), the repo has NVIDIA/CUDA surface xpu-port cannot rewrite — container files, dependency pins, launch scripts, or distinctive cloud NIM/API endpoints (e.g. integrate.api.nvidia.com) in source. That is an API-first migration, not a torch.cuda port. Stop and route to cuda-to-xpu-migration (assessment) then xpu-deploy-plan (serving plan). That is the no-plan case: with a migration report already in hand, don't bounce back — follow the report's routes for the non-Python surfaces instead (see Backstop). A bare 0 with no advisory is a hint, not a proof of "nothing to migrate": the check is bounded (distinctive markers, capped file read), so for anything beyond a pure PyTorch repo, confirm with cuda-to-xpu-migration's full inventory scan.

2. Mechanical pass

sh
for t in device_string cuda_to_xpu dot_cuda imports dist_backend amp_autocast amp_gradscaler; do
    python3 path/to/xpu_port_rewrite.py --transform "$t" --path .
done

--check previews the diff without writing. Read references/cuda_to_xpu_whitelist.md before running the mechanical pass to understand what cuda_to_xpu rewrites and why CUDA-only attrs are flagged instead.

Availability defaults to torch.xpu.is_available(). To request torch.accelerator.is_available() instead, read the availability guidance in references/semantic-patterns.md, then add --availability-api accelerator to the cuda_to_xpu invocation. Existing generic checks stay unchanged. This option covers qualified availability references only; the port and verifier still target XPU.

3. Re-scan (gate)

sh
python3 path/to/xpu_port_scan.py . > findings.after_mechanical.json

Mechanical bucket must be 0. If not, a transform missed something — don't proceed until resolved.

4. Semantic + escalate edits

Read references/semantic-patterns.md before editing any semantic finding. Hand-edit each semantic finding per that reference. For each escalate: replace, document, or stop. Don't invent fixes.

Common semantics on real repos:

  • TF32 toggles → delete
  • device_type == 'cuda' runtime gates → flip to 'xpu'
  • flash-attn / bitsandbytes hard imports → replace with XPU-aware fallback

Full table: references/semantic-patterns.md.

5. Final scan (gate)

sh
python3 path/to/xpu_port_scan.py . > findings.final.json

Empty = done with edits. Anything left = a missed semantic edit or an escalation that needs a recorded decision.

An advisory block on this final scan is not a failed gate: it lists the infra surfaces (Dockerfiles, dependency pins, launch scripts) the Python port intentionally left untouched. It does not reopen the Python gate. If no migration report is in hand, route to cuda-to-xpu-migration; if a report is already in hand, record those surfaces as outside the Python port and continue with the report's routes.

6. Verify

sh
# Write a builder file (avoids shell-quoting issues):
cat > verify_builder.py << 'EOF'
import sys, torch
sys.path.insert(0, ".")
from model import GPT, GPTConfig
m = GPT(GPTConfig(n_layer=2, n_head=2, n_embd=64,
                  block_size=64, vocab_size=128))
x = {"idx": torch.randint(0, 128, (1, 16))}
out = (m, x)
EOF

python3 path/to/xpu_port_verify.py \
    --builder-file verify_builder.py \
    --target-dtype bfloat16 \
    > verify.json

--builder (inline string) also works but is fragile with shell quoting for multi-line builders. Prefer --builder-file for anything beyond a one-liner.

Reference is CPU FP64; target is XPU at the chosen dtype. PYTORCH_ENABLE_XPU_FALLBACK=0 is set unconditionally at import time so silent CPU fallback always raises. Without --no-xpu, XPU must be present or the script exits with an error. --no-xpu runs CPU-vs-FP64 — useful on hosts without an Intel GPU but not a substitute for the target box.

JSON on stdout; builder prints redirected to stderr.

Target dtypertolatol
float321e-51e-6
bfloat161e-21e-3
float165e-31e-3

--rtol / --atol to override. A failing verify means either the port is genuinely off or the model isn't deterministic at this scale (dropout left on, RNG not seeded). Re-run with --seed 0.

No single forward to verify? Service / microservice repos (an HTTP API, a Celery worker, a multi-process app) often have no one nn.Module forward pass to build. The FP64 verifier is N/A there — skip it and confirm correctness with the runtime smoke test from the serving skill (vllm-xpu-run / sglang-xpu-run / torch-xpu-run) instead. The final-scan gate still applies.

7. Profile (optional)

After correctness passes, if the port is slow, invoke torch-xpu-profile to find the hot op. Common substitutions in references/semantic-patterns.md "After-profile" section.

Distributed backend

xccl, not ccl (the legacy torch_ccl plugin). The dist_backend transform rewrites init_process_group(backend="nccl") → "xccl" and bare backend = "nccl" assignments.

What this skill does NOT cover

  • Assessment-only / migration plan → cuda-to-xpu-migration
  • CUDA → XPU rule reference → torch-xpu-run
  • Throughput / TTFT / TPOT → torch-xpu-bench
  • Op-level slowness → torch-xpu-profile, xpu-profile-unitrace
  • Container / driver setup → xpu-container-run, xpu-discover
  • Custom CUDA C++ extensions, dual-target codebases (out of scope; see "Targets")

References

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Xpu Port?

Execute a single-target CUDA-to-XPU port of a PyTorch Python repo with libcst-based scan, mechanical rewrite, optional generic availability checks, and CPU FP64 vs target-dtype correctness verify on one forward pass. Use when the request says "port" — "port my repo to XPU", "port my repo at ./my-model to XPU", "rewrite the CUDA calls to XPU", "apply the mechanical transforms", "run the scan and rewrite", "make the port changes now". Not for the "migrate" verb ("migrate my repo", "migrate this repo to XPU") or a bare whole-repo workflow request where scope is not yet set — those start with c...

Warum Xpu Port in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Xpu Port besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Xpu Port in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/intel/skills/tree/main/skills/xpu-port ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Xpu Port nutzen?

Jedes Modell, das Sie in TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Xpu Port verwenden?

So viele Sie möchten. Solange ein Modell Skills unterstützt, können Sie Xpu Port damit verwenden – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama und weitere – alles in TypingMind mit Ihren eigenen API-Schlüsseln.

Ist der KI-Skill Xpu Port kostenlos?

Ja. Der Skill wird von intel auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: eine Datei namens SKILL.md mit einem Namen und einer Beschreibung sowie allen Skripten, Vorlagen oder Referenzdateien, die das Modell möglicherweise benötigt. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und benötigen daher weder Server noch API-Schlüssel oder Laufzeitumgebung. Sie funktionieren mit jedem Modell.

Alle

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇