task-constructor

Extract PyTorch/Triton operator implementations into single-file KernelBench tasks.

258|48|Updated Jun 22, 2020
One-click install
npx skills add https://github.com/mindspore-ai/akg --skill task-constructor-mindspore-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: task-constructor
Source: https://github.com/mindspore-ai/akg/tree/main/akg_agents/python/akg_agents/op/resources/skills/task-constructor
Command: npx skills add https://github.com/mindspore-ai/akg --skill task-constructor-mindspore-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

从 PyTorch/Triton 代码仓中提取算子实现,构建为 KernelBench 格式的标准化单文件自包含任务。支持代码提取、AST 依赖追踪、函数内联、import 清理、格式验证和参考对比测试。当用户需要从现有代码构建 task_code 时使用此 Skill。

Core Features & Use Cases

  • 从现有 PyTorch/Triton 代码中提取算子实现,生成单文件自包含的 KernelBench 任务。
  • 进行 AST 依赖追踪、函数内联与 import 清理,确保任务的可移植性和可重复性。
  • 提供格式验证与参考对比测试,确保任务与原实现保持一致性。

Quick Start

Provide the path to a PyTorch/Triton codebase and run the skill to generate a KernelBench task.

Frequently Asked Questions about task-constructor

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

FAQPage Schema
How do I convert PyTorch code into KernelBench tasks?

To convert PyTorch code into KernelBench tasks, you provide the path to a PyTorch or Triton codebase. The skill extracts operator implementations and packages them into a single-file, self-contained task.

What is AST dependency tracking for code extraction?

AST dependency tracking identifies and resolves required functions during code extraction. It ensures the generated KernelBench task remains portable and reproducible by automatically inlining dependencies and cleaning imports.

Does this tool work with Triton codebases or only PyTorch?

This tool works with both PyTorch and Triton codebases. It extracts operator implementations from either framework and packages them into self-contained KernelBench tasks with automated dependency inlining.

What's the best way to package self-contained operator implementations?

The best way to package self-contained operator implementations is using automated AST dependency tracking and import cleanup. This extracts the operator, inlines required functions, and formats it into a reproducible single file.

How do I validate generated KernelBench tasks against original implementations?

To validate generated KernelBench tasks, the skill performs format verification and reference-based testing. This ensures the extracted task maintains consistency with the original PyTorch or Triton implementation.

Why does my extracted PyTorch task fail format verification?

Extracted PyTorch tasks may fail format verification if dependency tracking or import cleanup is incomplete. The skill automates AST inlining and validation to enforce single-file format consistency and prevent these errors.