agentleFS
flagos-aiflagos-ai/FlagGems/AGENTS.md

FlagGems

AGENTS.md1.2k starsChanged 4 months agoApache-2.0View on GitHub

FlagGems is a high-performance, generic Triton operator library that accelerates LLM training and inference across diverse AI hardware by registering into PyTorch's ATen backend.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about flagos-ai/FlagGems

The biggest 5 of 46 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 46

Talked about on GitHub (46 times).

On GitHub · 46

41 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Dual Validation: Every operator change requires numerical accuracy verification (vs.

    line 10
  2. Very specific:

    Place in src/flag_gems/{ops,fused,experimental_ops}/<op_name>.py (snake_case, lowercase, no leading _ or .).

    line 24
  3. Very specific:

    Generic Baseline ("公版算子"): Must run on the official upstream Triton compiler on NVIDIA Ampere (e.g., A100).

    line 25
  4. Very specific:

    Run: pytest tests/test_<op_id>.py (add --ref cpu for CPU baseline, --quick for smoke tests).

    line 43
  5. Distinctive:

    Device Isolation: Always isolate devices on shared nodes before testing:

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Project: FlagGems

FlagGems is a high-performance, generic Triton operator library that accelerates LLM training and inference across diverse AI hardware by registering into PyTorch's ATen backend.

1. Core Principles

  • Triton-First & Multi-Backend: Implement core kernels in Triton for portability across NVIDIA, Ascend, Hygon, Moore Threads, MetaX, Iluvatar, Kunlunxin, Cambricon, etc.
  • Seamless Integration: Register operators into PyTorch's ATen dispatcher for zero-code-change acceleration.
  • Host Function Isolation: Host functions MUST NOT invoke PyTorch compute ops (only allocation/init like empty_like, zeros, randn, or other FlagGems ops are allowed) and must launch device kernels.
  • Dual Validation: Every operator change requires numerical accuracy verification (vs. CPU/native ATen) and performance benchmarking.

2. Directory Structure

  • src/flag_gems/: Main package — ops/ (standard kernels), fused/ (fused kernels), experimental_ops/ (incubating ops), modules/ (nn.Module blocks like RMSNorm/RoPE), runtime/ (multi-backend dispatchers & backend/_<vendor>/), utils/ (@pointwise_dynamic, LibTuner, caching), testing/ (test helpers).
  • cpp/: C++ extensions (include/, lib/ for LibTritonJIT, ctest/).
  • conf/: operators.yaml (operator metadata source of truth), backends.yaml (toolchains), ci_test_aliases.yaml (test markers).
  • tests/ & benchmark/: Pytest accuracy suite and triton.testing.do_bench performance suite.
  • examples/ & tools/ci_checks/: Model examples, pre-tuning scripts, and CI/pre-commit rule checks.
  • setup.sh & pyproject.toml: Per-backend environment setup and build config.

3. Operator Development Checklist

  1. Implement Kernel:
    • Place in src/flag_gems/{ops,fused,experimental_ops}/<op_name>.py (snake_case, lowercase, no leading _ or .).
    • Generic Baseline ("公版算子"): Must run on the official upstream Triton compiler on NVIDIA Ampere (e.g., A100). Place vendor-specific customizations under src/flag_gems/runtime/backend/_<vendor>/.
    • vLLM Notice: vLLM-specific fused operators have migrated to FlagGems-vllm; submit vLLM kernels there instead of src/flag_gems/fused/.
  2. Register & Export:
    • Export in src/flag_gems/__init__.py (or fused/__init__.py) and map ATen ops in _FULL_CONFIG.
    • Sort __all__ alphabetically via python tools/ci_checks/sort_exports.py.
  3. Register Metadata (conf/operators.yaml):
      - id: <op_id>                  # Matches function name
        description: <Description>
        for: [<aten_op_name>]        # e.g., aten::add.Tensor
        labels: [aten]               # e.g., aten, Reduction, pointwise
        kind: [Math]                 # e.g., Math, NeuralNetwork, LinearAlg
        stages: [{beta: '5.4'}]      # alpha, beta, or stable with version
        name: [<abstract_op_name>]   # OpInfo style name
        source: [aten]
  4. Accuracy Tests (tests/test_<op_id>.py):
    • Decorate tests with @pytest.mark.<op_id>.
    • Run: pytest tests/test_<op_id>.py (add --ref cpu for CPU baseline, --quick for smoke tests).
  5. Benchmarks (benchmark/test_<op_id>_perf.py):
    • Implement using Benchmark and run: pytest benchmark/test_<op_id>_perf.py -s.
  6. Validate Static CI Checks:
    python tools/ci_checks/check_operators_yaml.py --operators '["<op_id>"]'
    python tools/ci_checks/check_init_exports.py
    python tools/ci_checks/check_operator_markers.py --operators '["<op_id>"]'
    python tools/ci_checks/check_aten_operators.py --operators '["<op_id>"]'

4. Coding Standards & Environment

  • Formatting & Linting: Python uses black, isort (black profile), and flake8 (max line length 120); C++ uses clang-format. Always run pre-commit run --all-files.
  • Environment & Build:
    # Install backend deps (e.g., nvidia-cuda128, ascend-cann900, metax-maca3810)
    [COMPILER=flagtree|triton] [ENABLE_CPP=1] ./setup.sh <backend>
    export USE_C_EXTENSION=1  # Enable C++ runtime dispatcher if built with ENABLE_CPP=1
  • Device Isolation: Always isolate devices on shared nodes before testing:
    • NVIDIA: CUDA_VISIBLE_DEVICES=<id>
    • Ascend: ASCEND_RT_VISIBLE_DEVICES=<id>
    • Enflame: TOPS_VISIBLE_DEVICES=<id>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.