triton-ascend-api-rules

Enforce Triton Ascend kernel syntax rules for Atlas A2/A3 backends.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Triton Ascend API hard rules define a strict, must-follow contract for every kernel written in the Triton Ascend DSL, preventing prohibited constructs and ensuring safe, predictable compilation and execution on Ascend hardware.

Core Features & Use Cases

  • Enforces forbidden syntax such as return, break, continue, lambda, and direct tensor indexing.
  • Specifies allowed patterns like mask-based control flow, constexpr usage, and safe tl operations.
  • Use case: ensure a kernel adheres to platform requirements before deployment to Ascend backends.

Quick Start

Start by reviewing the documented rules before implementing any Triton Ascend kernel to ensure compliance.

Frequently Asked Questions about triton-ascend-api-rules

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

FAQPage Schema
What syntax is forbidden when writing Triton Ascend kernels?

Forbidden syntax in Triton Ascend kernels includes return, break, continue, lambda, and direct tensor indexing. Banning these constructs prevents unsafe compilation and runtime failures on Ascend hardware.

How do I ensure safe control flow in Triton Ascend DSL kernels?

Use mask-based control flow and safe tl.where operations instead of break or continue statements. This approach enforces predictable execution paths and prevents runtime failures during Ascend compilation.

Do I need constexpr for Triton Ascend kernel compilation on Atlas A2?

Yes, constexpr usage is mandated for Triton Ascend kernel compilation on Atlas A2 backends. Enforcing compile-time evaluation of specific variables ensures safe compilation and predictable execution.

Why does my Triton Ascend kernel fail to compile with direct tensor indexing?

Direct tensor indexing fails compilation because the Triton Ascend hard rules explicitly disallow it. This static prohibition prevents unsafe memory access patterns and ensures predictable execution on Ascend backends.

What are the limitations of using lambda expressions in Triton Ascend kernels?

Lambda expressions are strictly prohibited in Triton Ascend kernels. This limitation prevents unsafe syntax constructs that could cause unpredictable compilation or runtime failures on Ascend hardware.