# facebookresearch/CompilerGym

Reinforcement learning environments for compiler and program optimization tasks

Repository: https://github.com/facebookresearch/CompilerGym
Canonical: https://ross.abutalabs.com/products/compilergym
Homepage: https://compilergym.ai/
Language: Python
License: MIT
License Family: permissive
Archived: true
Last push: 2026-04-14T22:39:56+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 77, release rhythm 8, longevity 100
- inputs: {"age_days": 2121, "days_push": 141, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1021, forks 136 (observed 2026-08-28T04:03:15.708299+00:00)

## What it is
CompilerGym is a Python library of OpenAI Gym-compatible reinforcement learning environments for compiler and program optimization tasks, covering LLVM, GCC, MLIR, and loop_tool. It bundles benchmark datasets, observation and reward spaces, validation, and leaderboards to lower the barrier to applying ML to compiler research.

## Use cases
- train reinforcement learning agents to optimize compiler passes
- tune GCC optimization flags with machine learning
- benchmark ML models on compiler optimization tasks
- research autotuning of LLVM IR optimization sequences
- expose custom compiler optimization problems as gym environments
- compare compiler optimization techniques reproducibly

## When to choose
- you want to apply RL or search to compiler optimization without writing C++
- you need reproducible compiler benchmarks with datasets and reward signals
- you want a gym-style API for sequential decision-making over compiler choices

## When to avoid
- you need a production compiler or general-purpose build tool
- you only need standard code compilation without ML-driven optimization
- you need actively developed cutting-edge features - development has slowed

## Facets
- artifact type: library
- maturity: maintenance
- function: reinforcement-learning, compiler, benchmarking, machine-learning, simulation
- domain: machine-learning, compilers, performance, artificial-intelligence
- platform: python, cli
- tags: gym-environments, compiler-optimization, llvm, gcc, mlir, autotuning, program-optimization, openai-gym, research, linux, macos, docker

## Member repositories
- facebookresearch/CompilerGym (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:15.708299+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:08:50.008966+00:00, confidence not recorded.
  - readme: https://github.com/facebookresearch/CompilerGym (fetched 2026-08-28T04:03:15.708299+00:00, sha c0c79a0fe5fd)
  - homepage: https://compilergym.ai/ (fetched 2026-08-29T13:09:23.727511+00:00, sha c3db74545aee)
  - site_page: https://compilergym.com/about.html (fetched 2026-08-29T13:09:23.737001+00:00, sha d2cbd4ae6ae0)
  - site_page: https://compilergym.com/changelog.html (fetched 2026-08-29T13:09:23.739236+00:00, sha 2dc8d3d72b3a)
  - site_page: https://compilergym.com/faq.html (fetched 2026-08-29T13:09:23.741687+00:00, sha bb9c8c36e303)
  - site_page: https://compilergym.com/llvm/index.html (fetched 2026-08-29T13:09:23.743552+00:00, sha ba5ab7145c0b)
  - site_page: https://compilergym.com/envs/gcc.html (fetched 2026-08-29T13:09:23.746792+00:00, sha 60442d0dc0a2)
  - site_page: https://compilergym.com/envs/loop_tool.html (fetched 2026-08-29T13:09:23.766268+00:00, sha 4d7d723a7ff4)
  - site_page: https://compilergym.com/envs/mlir.html (fetched 2026-08-29T13:09:23.768396+00:00, sha bd4cebe4c7c5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
