op-task-extractor

Extract PyTorch operator implementations into KernelBench-ready task_desc.py files.

33|51|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/Just-it/AscendOpGenAgent --skill op-task-extractor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: op-task-extractor
Source: https://github.com/Just-it/AscendOpGenAgent/tree/main/skills/op-task-extractor
Command: npx skills add https://github.com/Just-it/AscendOpGenAgent --skill op-task-extractor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

从用户的 PyTorch/Python 代码中提取可优化的算子实现,构建为 KernelBench 标准格式的单文件 task_desc.py,使其成为一个自包含的可执行单元。支持从独立的文件中提取 shape/dtype 信息。

Core Features & Use Cases

  • 从现有 PyTorch 代码自动提取算子实现及其依赖,生成与 KernelBench 兼容的 task_desc.py。
  • 将依赖内联并包装为自包含的 Model.forward(),并提供 get_inputs() 与 get_init_inputs()。
  • 支持通过额外的形状/数据类型信息源来推断输入/输出签名,确保可重复性。
  • 提供内置的验证流程,包含静态与运行时检查,确保生成的任务正确无误。

Quick Start

提供 PyTorch 源代码路径,以及可选的 shape/dtype 信息源,然后运行该 Skill 生成 KernelBench 的 task_desc.py。

Frequently Asked Questions about op-task-extractor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract PyTorch operators into a KernelBench task?

To extract PyTorch operators into a KernelBench task, provide your PyTorch source code path and an optional shape/dtype source. The Skill automatically inlines dependencies and generates a self-contained task_desc.py file with Model.forward, get_inputs, and get_init_inputs functions.

What is the best way to convert existing PyTorch code into a single-file task_desc.py?

The best way to convert PyTorch code into a single-file task_desc.py is using an automated extraction process that inlines dependencies. It wraps your operator implementation into a self-contained Model.forward() method while preserving deterministic execution for reproducible benchmarking.

How do I infer input and output signatures for KernelBench tasks from existing code?

To infer input and output signatures for KernelBench tasks, supply an additional shape and dtype information source alongside your PyTorch code. The extractor uses these sources to infer signatures and generate the required get_inputs() and get_init_inputs() methods.

Can I validate generated KernelBench tasks for correctness?

Yes, you can validate generated KernelBench tasks for correctness using the built-in validation workflow. This workflow ensures the extracted PyTorch operator implementation is accurate by performing both static and runtime checks on the packaged single-file task.

Does the PyTorch operator extraction process support external dependencies?

Yes, the PyTorch operator extraction process supports external dependencies by automatically inlining them into the generated file. This ensures the final KernelBench-ready task_desc.py remains completely self-contained and executable without missing module errors.