Skip to content

Commit 519a213

Browse files
Update magpie skill and add filter to import_external_skills (#66)
1 parent 4fd7b38 commit 519a213

5 files changed

Lines changed: 46 additions & 9 deletions

File tree

.github/scripts/import_external_skills.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
Usage:
3131
uv run .github/scripts/import_external_skills.py # write changes
3232
uv run .github/scripts/import_external_skills.py --dry-run # report only
33+
uv run .github/scripts/import_external_skills.py --only magpie # one skill
34+
35+
The `--only` flag (repeatable) restricts the run to the named skill
36+
folder(s): other skills in the catalog are skipped and pruning is limited
37+
to the named skills, so unrelated federated skills are never removed.
3338
3439
The companion GitHub Actions workflow `import-external-skills` calls this
3540
script on manual dispatch and opens a pull request with the result.
@@ -553,9 +558,33 @@ def main(argv: list[str] | None = None) -> int:
553558
default=CATALOG_FILE,
554559
help=f"Path to the catalog file (default: {CATALOG_FILE}).",
555560
)
561+
parser.add_argument(
562+
"--only",
563+
action="append",
564+
metavar="SKILL",
565+
help=(
566+
"Import only the named skill folder (repeatable). When set, "
567+
"skills not named here are left untouched and pruning is "
568+
"restricted to the named skills, so other federated skills are "
569+
"never removed."
570+
),
571+
)
556572
args = parser.parse_args(argv)
557573

558574
sources = parse_sources(args.catalog)
575+
576+
only = set(args.only or [])
577+
if only:
578+
known = {spec.folder for source in sources for spec in source.skills}
579+
unknown = only - known
580+
if unknown:
581+
raise ValueError(
582+
"--only names skill(s) not present in the catalog: "
583+
+ ", ".join(sorted(unknown))
584+
)
585+
for source in sources:
586+
source.skills = [s for s in source.skills if s.folder in only]
587+
sources = [source for source in sources if source.skills]
559588
log: list[str] = []
560589
declared: set[str] = set()
561590
all_results: list[ImportResult] = []
@@ -573,7 +602,15 @@ def main(argv: list[str] | None = None) -> int:
573602
declared.add(spec.folder)
574603
all_results.extend(import_source(source, args.dry_run, log))
575604

576-
pruned = prune_orphans(declared, existing_federated, args.dry_run, log)
605+
# With --only we deliberately ignore skills the user didn't name, so
606+
# restrict orphan pruning to just those skills. Otherwise every other
607+
# federated skill would look like an orphan and be deleted.
608+
prunable = (
609+
{name: marker for name, marker in existing_federated.items() if name in only}
610+
if only
611+
else existing_federated
612+
)
613+
pruned = prune_orphans(declared, prunable, args.dry_run, log)
577614
marketplace_changed = update_marketplace(all_results, args.dry_run)
578615

579616
for line in log:

skills/magpie/.federated.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"source": "amd-agi-magpie",
33
"repo": "AMD-AGI/Magpie",
44
"ref": "main",
5-
"commit": "2a9263833f71755df2a93b466cdd3a9f803fc625",
5+
"commit": "02d9a7dfc3aedec0e3feadb7449f6c0c318621d5",
66
"path": "skills/magpie",
77
"license": "MIT",
8-
"imported_at": "2026-05-28T21:37:43Z"
8+
"imported_at": "2026-06-18T20:31:36Z"
99
}

skills/magpie/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ magpie analyze path/to/kernel.hip --testcase "./run_test.sh"
3737
- `--no-perf`: Skip performance profiling.
3838
- `-o`, `--output-dir`: Output directory (default: `./results`).
3939

40-
**Config template (single kernel):** Use `kernel:` with `id`, `type`, `source_files`, `working_dir`, `testcase_command`, optional `compile_command`, `env`. See [Magpie/kernel_config.yaml.example](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/Magpie/kernel_config.yaml.example) and [examples/ck_gemm_add.yaml](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/examples/ck_gemm_add.yaml).
40+
**Config template (single kernel):** Use `kernel:` with `id`, `type`, `source_files`, `working_dir`, `testcase_command`, optional `compile_command`, `env`. See [Magpie/kernel_config.yaml.example](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/Magpie/kernel_config.yaml.example) and [examples/ck_gemm_add.yaml](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/examples/ck_gemm_add.yaml).
4141

4242
## Compare (multiple kernels)
4343

@@ -59,7 +59,7 @@ magpie compare kernel1.hip kernel2.hip --testcase "./run_test.sh"
5959
- `--baseline`: Index of baseline kernel (default: 0).
6060
- `--no-perf`, `-o`: Same as analyze.
6161

62-
Example: [examples/ck_grouped_gemm_compare.yaml](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/examples/ck_grouped_gemm_compare.yaml).
62+
Example: [examples/ck_grouped_gemm_compare.yaml](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/examples/ck_grouped_gemm_compare.yaml).
6363

6464
## Benchmark (vLLM / SGLang)
6565

@@ -81,7 +81,7 @@ magpie benchmark --benchmark-config examples/benchmarks/benchmark_vllm_dsr1.yaml
8181
- `--run-mode`: `docker` (default) or `local`.
8282
- `--docker-image`, `--timeout`, `-o`: Override image, timeout (seconds), output dir.
8383

84-
Example configs: [examples/benchmarks/benchmark_vllm_dsr1.yaml](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/examples/benchmarks/benchmark_vllm_dsr1.yaml), [docs/benchmark.md](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/docs/benchmark.md).
84+
Example configs: [examples/benchmarks/benchmark_vllm_dsr1.yaml](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/examples/benchmarks/benchmark_vllm_dsr1.yaml), [docs/how-to/benchmark.md](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/docs/how-to/benchmark.md).
8585

8686
## Gap analysis (standalone)
8787

@@ -109,7 +109,7 @@ Shows vendor, architecture, compiler, profiler. No mode required.
109109

110110
When the user needs a kernel config file:
111111

112-
1. Emit YAML matching the structure in [Magpie/kernel_config.yaml.example](https://github.com/AMD-AGI/Magpie/blob/2a9263833f71755df2a93b466cdd3a9f803fc625/Magpie/kernel_config.yaml.example): `kernel:` with `id`, `type` (hip|cuda|pytorch), `source_files`, `working_dir`, `testcase_command`, and optionally `compile_command`, `env`.
112+
1. Emit YAML matching the structure in [Magpie/kernel_config.yaml.example](https://github.com/AMD-AGI/Magpie/blob/02d9a7dfc3aedec0e3feadb7449f6c0c318621d5/Magpie/kernel_config.yaml.example): `kernel:` with `id`, `type` (hip|cuda|pytorch), `source_files`, `working_dir`, `testcase_command`, and optionally `compile_command`, `env`.
113113
2. Write the file to the user's requested path (e.g. `kernel_config.yaml`).
114114
3. Run: `magpie analyze --kernel-config <that_file>`.
115115

skills/magpie/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ kernels:
100100
101101
## Benchmark config YAML
102102
103-
Top-level key `benchmark:` with `framework`, `model`, `precision`, `envs`, `profiler`, `gap_analysis`, `timeout_seconds`, etc. See `examples/benchmarks/benchmark_vllm_dsr1.yaml` and `docs/benchmark.md`.
103+
Top-level key `benchmark:` with `framework`, `model`, `precision`, `envs`, `profiler`, `gap_analysis`, `timeout_seconds`, etc. See `examples/benchmarks/benchmark_vllm_dsr1.yaml` and `docs/how-to/benchmark.md`.

skills/magpie/skill-card.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Description
44

5-
Perform GPU kernel correctness and performance evaluation and LLM inference benchmarking with Magpie (HIP/CUDA/PyTorch kernels, vLLM/SGLang benchmarks, TraceLens, and torch-trace gap analysis).
5+
Performs GPU kernel correctness and performance evaluation and LLM inference benchmarking with Magpie. Analyzes single or multiple kernels (HIP/CUDA/PyTorch), compares kernel implementations, runs vLLM/SGLang benchmarks with profiling and TraceLens, and runs gap analysis on torch traces.
66

77
## Owner
88

0 commit comments

Comments
 (0)