[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-facebookresearch--CompilerGym":3,"tool-facebookresearch--CompilerGym":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",154349,2,"2026-04-13T23:32:16",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":120,"forks":121,"last_commit_at":122,"license":123,"difficulty_score":10,"env_os":124,"env_gpu":124,"env_ram":124,"env_deps":125,"category_tags":131,"github_topics":77,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":133,"updated_at":134,"faqs":135,"releases":164},7326,"facebookresearch\u002FCompilerGym","CompilerGym","Reinforcement learning environments for compiler and program optimization tasks","CompilerGym 是由 Meta AI 研发的一套开源强化学习环境库，专为编译器优化与程序优化任务设计。它旨在解决机器学习研究者难以直接涉足底层系统领域的痛点，将复杂的编译器问题转化为标准的强化学习接口，让利用人工智能提升编译效率变得像训练游戏 AI 一样简单直观。\n\n这款工具非常适合机器学习研究人员、系统开发者以及对编译器技术感兴趣的数据科学家使用。对于算法专家，无需深入掌握 LLVM 等底层细节，即可用熟悉的 Python 语言构建智能体来探索编译策略；对于系统开发者，它提供了便捷的 toolkit，能轻松将新的编译任务暴露给社区进行联合研究。\n\nCompilerGym 的核心亮点在于其“开箱即用”的生态与高度的可复现性。它不仅封装了真实的编译器后端和海量的真实世界程序实例，提供数百万级的训练样本，还内置了多种预计算的程序表示形式（从特征向量到图模型），支持端到端深度学习或传统机器学习方法。此外，项目自带标准的奖励函数、损失函数及基准测试排行榜，确保研究成果的公正对比与快速验证。作为 CGO'22 杰出论文奖得主，CompilerGym 正成为连接人工智能与系统编译领域的关键","CompilerGym 是由 Meta AI 研发的一套开源强化学习环境库，专为编译器优化与程序优化任务设计。它旨在解决机器学习研究者难以直接涉足底层系统领域的痛点，将复杂的编译器问题转化为标准的强化学习接口，让利用人工智能提升编译效率变得像训练游戏 AI 一样简单直观。\n\n这款工具非常适合机器学习研究人员、系统开发者以及对编译器技术感兴趣的数据科学家使用。对于算法专家，无需深入掌握 LLVM 等底层细节，即可用熟悉的 Python 语言构建智能体来探索编译策略；对于系统开发者，它提供了便捷的 toolkit，能轻松将新的编译任务暴露给社区进行联合研究。\n\nCompilerGym 的核心亮点在于其“开箱即用”的生态与高度的可复现性。它不仅封装了真实的编译器后端和海量的真实世界程序实例，提供数百万级的训练样本，还内置了多种预计算的程序表示形式（从特征向量到图模型），支持端到端深度学习或传统机器学习方法。此外，项目自带标准的奖励函数、损失函数及基准测试排行榜，确保研究成果的公正对比与快速验证。作为 CGO'22 杰出论文奖得主，CompilerGym 正成为连接人工智能与系统编译领域的关键桥梁，推动更智能、更高效的编译器技术发展。","![CompilerGym](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_CompilerGym_readme_30c2b6231423.png)\n\n\u003Cp align=\"center\">\n  \u003C!-- Getting started colab -->\n  \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fstable\u002Fexamples\u002Fgetting-started.ipynb\">\n      \u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"Colab\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- Supported python versions list -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fcompiler-gym\" alt=\"Python versions\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- Downloads counter -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_CompilerGym_readme_66a006428217.png\" alt=\"PyPi Downloads\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- PyPi Version -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcompiler-gym.svg\" alt=\"PyPI version\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- license -->\n  \u003Ca href=\"https:\u002F\u002Ftldrlegal.com\u002Flicense\u002Fmit-license\">\n      \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fl\u002Fcompiler-gym\" alt=\"License\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- CI status -->\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Factions?query=workflow%3ACI+branch%3Adevelopment\">\n      \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fworkflows\u002FCI\u002Fbadge.svg?branch=development\" alt=\"CI status\" height=\"20\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ci>Reinforcement learning environments for compiler optimization tasks.\u003C\u002Fi>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ci>\n    Check\n    \u003Ca href=\"http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002F\">the website\u003C\u002Fa>\n    for more information.\n  \u003C\u002Fi>\n\u003C\u002Fp>\n\n\n## Introduction\n\nCompilerGym is a library of easy to use and performant reinforcement learning\nenvironments for compiler tasks. It allows ML researchers to interact with\nimportant compiler optimization problems in a language and vocabulary with which\nthey are comfortable, and provides a toolkit for systems developers to expose\nnew compiler tasks for ML research. We aim to act as a catalyst for making\ncompilers faster using ML. Key features include:\n\n* **Ease of use:** built on the the popular [Gym](https:\u002F\u002Fgym.openai.com\u002F)\n  interface - use Python to write your agent. With CompilerGym, building ML\n  models for compiler research problems is as easy as building ML models to play\n  video games.\n\n* **Batteries included:** includes everything required to get started. Wraps\n  real world programs and compilers to provide millions of instances for\n  training. Provides multiple kinds of pre-computed program representations: you\n  can focus on end-to-end deep learning or features + boosted trees, all the way\n  up to graph models. Appropriate reward functions and loss functions for\n  optimization targets are provided out of the box.\n\n* **Reproducible:** provides validation for correctness of results, common\n  baselines, and [leaderboards](#leaderboards) for you to submit your results.\n\nFor a glimpse of what's to come, check out [our\nroadmap](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fprojects\u002F1).\n\n\n## News\n\n- November 2022: CompilerGym v0.2.5 adds support for Python 3.10 and drops\n  support for 3.7. See [release\n  notes](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Freleases\u002Ftag\u002Fv0.2.5)\n  for full details.\n- April 2022: ⭐️ CompilerGym wins the **distinguished paper award** at\n  [CGO'22](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Fcgo-2022)! You can read our work\n  [here](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.08267.pdf).\n- April 2022: 📖 Our **tutorial** at\n  [CGO'22](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Fcgo-2022) was well attended. If you\n  missed the event, you can work through the materials\n  [here](https:\u002F\u002Fchriscummins.cc\u002F2022\u002Fcgo22-tutorial\u002F).\n- September 2021: 📄 CompilerGym was featured on the **Meta AI research blog**.\n  You can read the post\n  [here](https:\u002F\u002Fai.facebook.com\u002Fblog\u002Fcompilergym-making-compiler-optimizations-accessible-to-all\u002F).\n\n\n## Installation\n\nInstall the latest CompilerGym release using:\n\n    pip install -U compiler_gym\n\nSee\n[INSTALL.md](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FINSTALL.md)\nfor further details.\n\n\n## Usage\n\nStarting with CompilerGym is simple. If you not already familiar with the gym\ninterface, refer to the [getting started\nguide](http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002Fgetting_started.html) for\nan overview of the key concepts.\n\nIn Python, import `compiler_gym` to use the environments:\n\n```py\n>>> import compiler_gym                      # imports the CompilerGym environments\n>>> env = compiler_gym.make(                 # creates a new environment (same as gym.make)\n...     \"llvm-v0\",                           # selects the compiler to use\n...     benchmark=\"cbench-v1\u002Fqsort\",         # selects the program to compile\n...     observation_space=\"Autophase\",       # selects the observation space\n...     reward_space=\"IrInstructionCountOz\", # selects the optimization target\n... )\n>>> env.reset()                              # starts a new compilation session\n>>> env.render()                             # prints the IR of the program\n>>> env.step(env.action_space.sample())      # applies a random optimization, updates state\u002Freward\u002Factions\n>>> env.close()                              # closes the environment, freeing resources\n```\n\nSee the [examples](\u002Fexamples) directory for agent implementations, environment\nextensions, and more. See the [documentation\nwebsite](http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002F) for the API reference.\n\n\n## Leaderboards\n\nThese leaderboards track the performance of user-submitted algorithms for\nCompilerGym tasks. To submit a result please see\n[this document](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FCONTRIBUTING.md#leaderboard-submissions).\n\n\n### LLVM Instruction Count\n\nLLVM is a popular open source compiler used widely in industry and research. The\n`llvm-ic-v0` environment exposes LLVM's optimizing passes as a set of actions\nthat can be applied to a particular program. The goal of the agent is to select\nthe sequence of optimizations that lead to the greatest reduction in instruction\ncount in the program being compiled. Reward is the reduction in instruction\ncount achieved scaled to the reduction achieved by LLVM's builtin `-Oz`\npipeline.\n\nThis leaderboard tracks the results achieved by algorithms on the `llvm-ic-v0`\nenvironment on the 23 benchmarks in the `cbench-v1` dataset.\n\n| Author                                           | Algorithm | Links | Date | Walltime (mean) | Codesize Reduction (geomean) |\n|--------------------------------------------------| --- | --- | --- |-----------------|------------------------------|\n | Robin Schmöcker, Yannik Mahlau, Nicolas Fröhlich | PPO + Guided Search | [write-up](leaderboard\u002Fllvm_instcount\u002Fppo\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Fppo\u002Fresults.csv) | 2022-02 | 69.821s  | **1.070×**                   |\n| Facebook                                         | Random search (t=10800) | [write-up](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t10800.csv) | 2021-03 | 10,512.356s     | 1.062×                       |\n| Facebook                                         | Random search (t=3600) | [write-up](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t3600.csv) | 2021-03 | 3,630.821s      | 1.061×                       |\n| Facebook                                         | Greedy search | [write-up](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002Fresults_e0.csv) | 2021-03 | 169.237s        | 1.055×                       |\n| Anthony. W. Jung                                 | GATv2 + DD-PPO | [write-up](leaderboard\u002Fllvm_instcount\u002Fgatv2_ddppo\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Fgatv2_ddppo\u002Fresult.csv) | 2022-06 | 258.149s        | 1.047×                       |\n| Facebook                                         | Random search (t=60) | [write-up](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t60.csv) | 2021-03 | 91.215s         | 1.045×                       |\n| Facebook                                         | e-Greedy search (e=0.1) | [write-up](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002Fresults_e10.csv) | 2021-03 | 351.611s        | 1.041×                       |\n| Jiadong Guo                                      | Tabular Q (N=5000, H=10) | [write-up](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002Fresults-H10-N5000.csv) | 2021-04 | 2534.305        | 1.036×                       |\n| Facebook                                         | Random search (t=10) | [write-up](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t10.csv) | 2021-03 | 42.939s         | 1.031×                       |\n| Patrick Hesse                                    | DQN (N=4000, H=10) | [write-up](leaderboard\u002Fllvm_instcount\u002Fdqn\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Fdqn\u002Fresults-instcountnorm-H10-N4000.csv) | 2021-06 | 91.018s         | 1.029×                       |\n| Jiadong Guo                                      | Tabular Q (N=2000, H=5) | [write-up](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002FREADME.md), [results](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002Fresults-H5-N2000.csv) | 2021-04 | 694.105         | 0.988×                       |\n\n\n## Contributing\n\nWe welcome contributions to CompilerGym. If you are interested in contributing please see\n[this document](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FCONTRIBUTING.md).\n\n\n## Citation\n\nIf you use CompilerGym in any of your work, please cite [our\npaper](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.08267.pdf):\n\n```\n@inproceedings{CompilerGym,\n      title={{CompilerGym: Robust, Performant Compiler Optimization Environments for AI Research}},\n      author={Chris Cummins and Bram Wasti and Jiadong Guo and Brandon Cui and Jason Ansel and Sahir Gomez and Somya Jain and Jia Liu and Olivier Teytaud and Benoit Steiner and Yuandong Tian and Hugh Leather},\n      booktitle={CGO},\n      year={2022},\n}\n```\n","![CompilerGym](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_CompilerGym_readme_30c2b6231423.png)\n\n\u003Cp align=\"center\">\n  \u003C!-- 快速入门 Colab -->\n  \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fstable\u002Fexamples\u002Fgetting-started.ipynb\">\n      \u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"Colab\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- 支持的 Python 版本列表 -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fcompiler-gym\" alt=\"Python 版本\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- 下载次数统计 -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_CompilerGym_readme_66a006428217.png\" alt=\"PyPI 下载量\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- PyPI 版本 -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcompiler-gym\u002F\">\n      \u003Cimg src=\"https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcompiler-gym.svg\" alt=\"PyPI 版本\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- 许可证 -->\n  \u003Ca href=\"https:\u002F\u002Ftldrlegal.com\u002Flicense\u002Fmit-license\">\n      \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fl\u002Fcompiler-gym\" alt=\"许可证\" height=\"20\">\n  \u003C\u002Fa>\n  \u003C!-- CI 状态 -->\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Factions?query=workflow%3ACI+branch%3Adevelopment\">\n      \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fworkflows\u002FCI\u002Fbadge.svg?branch=development\" alt=\"CI 状态\" height=\"20\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ci>用于编译器优化任务的强化学习环境。\u003C\u002Fi>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ci>\n    更多信息请访问\n    \u003Ca href=\"http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002F\">官网\u003C\u002Fa>\n  \u003C\u002Fi>\n\u003C\u002Fp>\n\n\n## 简介\n\nCompilerGym 是一个易于使用且性能优越的编译器任务强化学习环境库。它使机器学习研究人员能够以他们熟悉的语言和术语与重要的编译器优化问题进行交互，并为系统开发者提供了一个工具包，用于向机器学习研究开放新的编译器任务。我们的目标是利用机器学习技术加速编译器的发展。其主要特点包括：\n\n* **易用性：** 基于流行的 [Gym](https:\u002F\u002Fgym.openai.com\u002F) 接口构建——您可以使用 Python 编写智能体。借助 CompilerGym，构建用于编译器研究问题的机器学习模型就像构建用于玩电子游戏的机器学习模型一样简单。\n\n* **开箱即用：** 包含开始所需的一切。封装了真实世界的程序和编译器，提供数百万个训练实例。提供了多种预计算的程序表示形式：您可以专注于端到端深度学习或特征工程结合集成树模型，甚至图模型。针对不同优化目标的奖励函数和损失函数均已内置。\n\n* **可复现性：** 提供结果正确性的验证、常用基线以及用于提交结果的 [排行榜](#leaderboards)。\n\n欲了解未来计划，请查看我们的 [路线图](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fprojects\u002F1)。\n\n\n## 最新消息\n\n- 2022年11月：CompilerGym v0.2.5 添加对 Python 3.10 的支持，并停止对 Python 3.7 的支持。完整详情请参阅 [发布说明](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Freleases\u002Ftag\u002Fv0.2.5)。\n- 2022年4月：⭐️ CompilerGym 在 [CGO'22](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Fcgo-2022) 上荣获 **杰出论文奖**！您可以在 [这里](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.08267.pdf) 阅读我们的研究成果。\n- 2022年4月：📖 我们在 [CGO'22](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Fcgo-2022) 上的 **教程** 受到广泛关注。如果您错过了活动，可以在此处学习相关材料 [这里](https:\u002F\u002Fchriscummins.cc\u002F2022\u002Fcgo22-tutorial\u002F)。\n- 2021年9月：📄 CompilerGym 被刊登在 **Meta AI 研究博客** 上。您可以在 [这里](https:\u002F\u002Fai.facebook.com\u002Fblog\u002Fcompilergym-making-compiler-optimizations-accessible-to-all\u002F) 阅读该文章。\n\n\n## 安装\n\n使用以下命令安装最新版本的 CompilerGym：\n\n    pip install -U compiler_gym\n\n更多详细信息请参阅 [INSTALL.md](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FINSTALL.md)。\n\n\n## 使用方法\n\n开始使用 CompilerGym 非常简单。如果您还不熟悉 Gym 接口，请参考 [快速入门指南](http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002Fgetting_started.html)，了解关键概念。\n\n在 Python 中，导入 `compiler_gym` 即可使用这些环境：\n\n```py\n>>> import compiler_gym                      # 导入 CompilerGym 环境\n>>> env = compiler_gym.make(                 # 创建一个新的环境（类似于 gym.make）\n...     \"llvm-v0\",                           # 选择要使用的编译器\n...     benchmark=\"cbench-v1\u002Fqsort\",         # 选择要编译的程序\n...     observation_space=\"Autophase\",       # 选择观测空间\n...     reward_space=\"IrInstructionCountOz\", # 选择优化目标\n... )\n>>> env.reset()                              # 开始一个新的编译会话\n>>> env.render()                             # 打印程序的中间表示\n>>> env.step(env.action_space.sample())      # 应用随机优化，更新状态、奖励和动作\n>>> env.close()                              # 关闭环境，释放资源\n```\n\n有关智能体实现、环境扩展等内容，请参阅 [examples](\u002Fexamples) 目录。API 参考文档请访问 [文档网站](http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002F)。\n\n\n## 排行榜\n\n这些排行榜记录了用户提交的算法在 CompilerGym 任务中的表现。如需提交结果，请参阅 [此文档](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FCONTRIBUTING.md#leaderboard-submissions)。\n\n### LLVM 指令计数\n\nLLVM 是一款流行的开源编译器，在工业界和研究领域得到广泛应用。`llvm-ic-v0` 环境将 LLVM 的优化传递暴露为一组可应用于特定程序的操作。智能体的目标是选择能够使待编译程序的指令数量减少最多的优化序列。奖励是所实现的指令数量减少量，按 LLVM 内置 `-Oz` 优化流水线所达到的减少量进行归一化。\n\n该排行榜记录了算法在 `cbench-v1` 数据集中的 23 个基准测试上，于 `llvm-ic-v0` 环境中取得的结果。\n\n| 作者                                           | 算法 | 链接 | 日期 | 实际运行时间（均值） | 代码大小缩减倍率（几何平均） |\n|--------------------------------------------------| --- | --- | --- |-----------------|------------------------------|\n | Robin Schmöcker、Yannik Mahlau、Nicolas Fröhlich | PPO + 引导搜索 | [说明](leaderboard\u002Fllvm_instcount\u002Fppo\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Fppo\u002Fresults.csv) | 2022-02 | 69.821秒  | **1.070×**                   |\n| Facebook                                         | 随机搜索（t=10800） | [说明](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t10800.csv) | 2021-03 | 10,512.356秒     | 1.062×                       |\n| Facebook                                         | 随机搜索（t=3600） | [说明](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t3600.csv) | 2021-03 | 3,630.821秒      | 1.061×                       |\n| Facebook                                         | 贪心搜索 | [说明](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002Fresults_e0.csv) | 2021-03 | 169.237秒        | 1.055×                       |\n| Anthony. W. Jung                                 | GATv2 + DD-PPO | [说明](leaderboard\u002Fllvm_instcount\u002Fgatv2_ddppo\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Fgatv2_ddppo\u002Fresult.csv) | 2022-06 | 258.149秒        | 1.047×                       |\n| Facebook                                         | 随机搜索（t=60） | [说明](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t60.csv) | 2021-03 | 91.215秒         | 1.045×                       |\n| Facebook                                         | e-贪心搜索（e=0.1） | [说明](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Fe_greedy\u002Fresults_e10.csv) | 2021-03 | 351.611秒        | 1.041×                       |\n| Jiadong Guo                                      | 表格 Q 学习（N=5000，H=10） | [说明](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002Fresults-H10-N5000.csv) | 2021-04 | 2534.305秒       | 1.036×                       |\n| Facebook                                         | 随机搜索（t=10） | [说明](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Frandom_search\u002Fresults_p125_t10.csv) | 2021-03 | 42.939秒         | 1.031×                       |\n| Patrick Hesse                                    | DQN（N=4000，H=10） | [说明](leaderboard\u002Fllvm_instcount\u002Fdqn\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Fdqn\u002Fresults-instcountnorm-H10-N4000.csv) | 2021-06 | 91.018秒         | 1.029×                       |\n| Jiadong Guo                                      | 表格 Q 学习（N=2000，H=5） | [说明](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002FREADME.md)、[结果](leaderboard\u002Fllvm_instcount\u002Ftabular_q\u002Fresults-H5-N2000.csv) | 2021-04 | 694.105秒       | 0.988×                       |\n\n\n## 贡献\n\n我们欢迎对 CompilerGym 的贡献。如果您有兴趣参与，请参阅\n[此文档](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FCONTRIBUTING.md)。\n\n\n## 引用\n\n如果您在任何工作中使用了 CompilerGym，请引用\n[我们的论文](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2109.08267.pdf)：\n\n```\n@inproceedings{CompilerGym,\n      title={{CompilerGym: Robust, Performant Compiler Optimization Environments for AI Research}},\n      author={Chris Cummins and Bram Wasti and Jiadong Guo and Brandon Cui and Jason Ansel and Sahir Gomez and Somya Jain and Jia Liu and Olivier Teytaud and Benoit Steiner and Yuandong Tian and Hugh Leather},\n      booktitle={CGO},\n      year={2022},\n}\n```","# CompilerGym 快速上手指南\n\nCompilerGym 是一个用于编译器优化任务的强化学习环境库。它基于流行的 Gym 接口构建，让机器学习研究者能够像训练游戏 AI 一样，轻松探索编译器优化问题（如指令计数减少、代码体积优化等）。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux (推荐 Ubuntu) 或 macOS。Windows 支持可能受限，建议使用 WSL2。\n*   **Python 版本**：Python 3.8, 3.9 或 3.10 (v0.2.5+ 已不再支持 Python 3.7)。\n*   **前置依赖**：\n    *   `pip` (Python 包管理工具)\n    *   `git` (用于克隆示例代码，可选)\n    *   基础编译工具链 (如 `build-essential`, `cmake` 等，通常安装 LLVM 后端时需要)\n\n> **注意**：CompilerGym 底层依赖 LLVM 编译器基础设施。虽然 `pip` 安装通常会处理大部分二进制依赖，但在某些 Linux 发行版上，可能需要手动安装系统级的 LLVM 开发库以确保最佳兼容性。\n\n## 安装步骤\n\n推荐使用 `pip` 直接安装最新稳定版。国内用户若遇到下载速度慢的问题，可使用清华或阿里镜像源加速。\n\n### 方式一：使用官方源安装\n\n```bash\npip install -U compiler_gym\n```\n\n### 方式二：使用国内镜像源加速（推荐）\n\n```bash\npip install -U compiler_gym -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n安装完成后，可通过以下命令验证是否安装成功（若无报错则说明成功）：\n\n```bash\npython -c \"import compiler_gym; print(compiler_gym.__version__)\"\n```\n\n详细的高级安装选项（如从源码构建特定 LLVM 版本）请参考项目仓库中的 `INSTALL.md` 文件。\n\n## 基本使用\n\nCompilerGym 的使用方式与 OpenAI Gym 完全一致。以下是一个最小化的示例，展示如何创建一个 LLVM 优化环境、重置状态、执行随机动作并查看结果。\n\n### 代码示例\n\n创建一个名为 `quick_start.py` 的文件，填入以下内容：\n\n```py\n>>> import compiler_gym                      # 导入 CompilerGym 环境\n>>> env = compiler_gym.make(                 # 创建新环境 (用法同 gym.make)\n...     \"llvm-v0\",                           # 选择编译器后端 (LLVM)\n...     benchmark=\"cbench-v1\u002Fqsort\",         # 选择待编译的基准程序 (qsort)\n...     observation_space=\"Autophase\",       # 选择观察空间 (程序特征表示)\n...     reward_space=\"IrInstructionCountOz\", # 选择优化目标 (以减少指令数为奖励)\n... )\n>>> env.reset()                              # 开始新的编译会话\n>>> env.render()                             # 打印程序的中间表示 (IR)\n>>> env.step(env.action_space.sample())      # 执行一个随机优化动作，更新状态\u002F奖励\n>>> env.close()                              # 关闭环境，释放资源\n```\n\n### 运行说明\n\n1.  将上述代码保存为 `.py` 文件。\n2.  在终端运行：`python quick_start.py`。\n3.  程序将初始化环境，输出程序的 IR 代码，并执行一步随机优化策略。\n\n### 下一步建议\n\n*   **更多示例**：查看项目根目录下的 `examples` 文件夹，其中包含了完整的 Agent 实现和环境扩展案例。\n*   **文档参考**：访问 [CompilerGym 官方文档网站](http:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002F) 获取详细的 API 参考和概念指南。\n*   **排行榜**：关注 `llvm-ic-v0` 等环境的排行榜，了解当前 SOTA 算法的性能表现。","某芯片公司的编译器团队正致力于利用强化学习自动优化 LLVM 编译器的指令调度策略，以提升自家 AI 加速器的代码执行效率。\n\n### 没有 CompilerGym 时\n- **环境搭建极其繁琐**：研究人员需手动配置复杂的 LLVM 版本、编写底层 C++ 接口来连接 Python 算法，往往花费数周时间在环境调试而非模型设计上。\n- **缺乏标准化基准**：团队内部各自构建测试用例，数据格式不统一，导致不同优化算法的效果难以横向对比，复现他人成果几乎不可能。\n- **奖励函数开发困难**：自定义衡量代码速度或大小的奖励函数需要深入理解编译器内部状态，门槛极高且容易出错，阻碍了端到端深度学习的应用。\n- **样本规模受限**：难以快速获取海量真实的程序代码作为训练集，导致训练的强化学习代理（Agent）泛化能力差，仅在少数测试程序上有效。\n\n### 使用 CompilerGym 后\n- **开箱即用的交互接口**：基于熟悉的 Gym 接口，研究人员仅需几行 Python 代码即可启动包含真实 LLVM 环境的训练循环，将环境准备时间从数周缩短至几分钟。\n- **内置权威基准与榜单**：直接调用预置的数百万个程序实例和标准评估指标，团队可立即在统一基准上验证新算法，并通过官方榜单直观对比全球研究水平。\n- **预定义多样化奖励**：工具自带针对代码大小、编译时间及运行速度的成熟奖励函数，让研究者能直接聚焦于神经网络架构创新，快速实现端到端优化。\n- **海量真实训练数据**：无缝访问包裹好的真实世界程序库，Agent 能在多样化的代码场景中进行大规模训练，显著提升了优化策略在实际业务中的泛化性能。\n\nCompilerGym 通过屏蔽底层系统复杂度并提供标准化科研设施，让机器学习专家能像训练游戏 AI 一样高效地解决编译器优化难题。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_CompilerGym_766f8be1.png","facebookresearch","Meta Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ffacebookresearch_449342bd.png","",null,"https:\u002F\u002Fopensource.fb.com","https:\u002F\u002Fgithub.com\u002Ffacebookresearch",[81,85,89,93,97,101,105,109,113,117],{"name":82,"color":83,"percentage":84},"Python","#3572A5",63.8,{"name":86,"color":87,"percentage":88},"C++","#f34b7d",14.8,{"name":90,"color":91,"percentage":92},"CMake","#DA3434",7.6,{"name":94,"color":95,"percentage":96},"JavaScript","#f1e05a",5.8,{"name":98,"color":99,"percentage":100},"Starlark","#76d275",4.2,{"name":102,"color":103,"percentage":104},"C","#555555",1.5,{"name":106,"color":107,"percentage":108},"SCSS","#c6538c",0.9,{"name":110,"color":111,"percentage":112},"Makefile","#427819",0.6,{"name":114,"color":115,"percentage":116},"LLVM","#185619",0.3,{"name":118,"color":119,"percentage":116},"Dockerfile","#384d54",1005,136,"2026-04-07T09:49:59","MIT","未说明",{"notes":126,"python":127,"dependencies":128},"该工具是基于 Gym 接口的编译器优化强化学习环境。安装命令为 `pip install -U compiler_gym`。它封装了真实的编译器（如 LLVM）和程序基准（如 cbench-v1），用于生成训练实例。详细安装步骤需参考项目中的 INSTALL.md 文件。","3.8, 3.9, 3.10 (v0.2.5+ 不再支持 3.7)",[129,130],"gym","llvm",[14,132],"其他","2026-03-27T02:49:30.150509","2026-04-14T12:26:54.871523",[136,141,146,151,156,160],{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},32900,"如何在 CMake 构建中指定外部已安装的 LLVM 路径？","如果 LLVM 未安装在默认位置（如 \u002Fusr\u002Flocal），可以通过设置 CMAKE_PREFIX_PATH 或特定的包目录变量来指定路径。通常使用 LLVM_DIR 变量，命令示例如下：\ncmake -D LLVM_DIR=\u002Fpath\u002Fto\u002Fllvm\u002Finstall ...\n此外，确保使用 find_package(LLVM REQUIRED CONFIG) 来查找配置。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fissues\u002F506",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},32901,"gRPC 接口是否支持嵌套的观测空间（Nested Spaces）结构？","虽然 proto 定义本身不直接支持嵌套，但可以通过自定义转换器来实现。对于观测值，可以通过重写 CompilerEnv 中的 _observation_view_type 方法来实现；对于动作和动作空间，可以在初始化 CompilerEnv 时传入自定义的转换函数，或者通过继承并重写相关方法。核心是需要能够传递或自定义四个函数：proto 观测空间到 gym 观测空间、proto 动作空间到 gym 动作空间、gym 动作到 proto 动作、以及 proto 观测到 gym 观测的转换逻辑。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fissues\u002F526",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},32902,"运行 CompilerGym 实验后为什么会留下大量缓存目录，如何避免？","这通常是一个竞争条件（race condition）导致的 bug，特别是在多进程或大规模实验（如使用 Ray tune）结束时，清理例程可能未能正确执行。维护者已确认这是一个需要修复的问题。作为临时解决方案，建议在实验脚本结束后手动清理 COMPILER_GYM_CACHE 环境变量指向的目录，或者在代码中显式调用环境的关闭\u002F清理方法以确保资源释放。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fissues\u002F582",{"id":152,"question_zh":153,"answer_zh":154,"source_url":155},32903,"如何简化为新编译器添加支持的过程，避免重复编写 RPC 服务器代码？","CompilerGym 提供了基类来帮助用户只需关注“编译会话”的实现，而无需编写通用的 RPC 服务器样板代码。用户应继承 CompilationSession 基类（Python 或 C++），仅实现与特定编译器交互的核心逻辑（如应用动作、计算观测值）。框架将自动处理 RPC 服务器的监听、请求分发和并发管理，从而降低开发新编译器服务的难度并减少并发错误。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fissues\u002F254",{"id":157,"question_zh":158,"answer_zh":159,"source_url":145},32904,"不同的环境类实例是否可以绑定到唯一的调度器（dispatcher）？","是的，可以通过实例化默认的 py_converters 转换器来实现，这些转换器支持通过添加额外类型并基于 type_id 进行分发来自定义行为。如果需要更高级的控制，也可以完全覆盖默认的转换器逻辑，从而让不同的环境实例拥有独立的调度策略。",{"id":161,"question_zh":162,"answer_zh":163,"source_url":140},32905,"在使用 CMake 构建时遇到 gtest 定义冲突怎么办？","在迁移到 CMake 的过程中，可能会遇到第三方库（如 gtest）的定义冲突。解决方法通常是在 CMakeLists.txt 中使用条件判断（if\u002Felse 块），根据 COMPILER_GYM_LLVM_PROVIDER 等选项来决定是否包含外部依赖或使用系统安装的版本。确保正确配置 find_package 以避免重复定义，必要时可参考项目中 external.cmake 文件的最新修改来调整依赖查找逻辑。",[165,170,175,180,185,190,195,200,205,210,215,220,225,230,235],{"id":166,"version":167,"summary_zh":168,"released_at":169},247603,"v0.2.5","## 版本 0.2.5（2022-11-01）\n\nCompilerGym v0.2.5 新增了一个新的 LLVM 数据集、两个新的观测空间，并包含大量更新和错误修复。\n\n## 变更摘要\n\n- [llvm] 添加了两个新的观测空间 `LexedIr` 和 `LexedIrTuple`，提供对 IR 令牌序列的访问（[#742](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F742)，感谢 @fivosts！）。\n- [llvm] 添加了“Jotaibench”基准测试套件，提供了从 GitHub 上的手写代码中提取的 18,761 个新的可执行 C 程序（[#705](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F705)，感谢 @canesche！）。\n- 增加了对 Python 3.10 的支持。\n- [llvm] 修复了子进程无法终止的 bug（[#741](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F741)，感谢 @thecoblack！）。\n- [llvm] 修复了 `reset()` 报告的运行次数不正确的问题（[#761](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F761)），以及预热运行次数不正确的问题（[#717](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F717)，感谢 @lqwk！）。\n- [llvm] 使用 GATv2 和 DD-PPO 提交的新排行榜成绩（[#728](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F728)，感谢 @anthony0727！）。\n- 增加了为每个环境操作设置超时的功能（[#716](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F716)，感谢 @ricardoprins！）。\n- 在 `CompilerEnvStateReader.read_paths()` 中增加了加载 URL 的支持（[#692](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F692)，感谢 @thecoblack！）。\n- 简化了 Makefile 规则：将 `install-test` 重命名为 `test`，并弃用了 Bazel 测试规则。\n- 修复了 `TimeLimit` 包装器会干扰基准测试迭代器包装器的 bug（[#739](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F739)，感谢 @nluu175！）。\n- [ci] 增加了对示例服务的 CI 测试覆盖率（[#695](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F695)、[#642](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F642)、[#699](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F699)，感谢 @mostafaelhoushi！）。\n- [ci] 将 GitHub Actions 更新为使用 Node v16。\n- 减少了 CMake 构建的日志输出量和构建时间。\n- 更新并修复了依赖包冲突问题（修复 #771、#768）。\n\n## 致谢\n\n衷心感谢所有代码贡献者！\n\n* @anthony0727\n* @canesche 在 [#705](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F705) 中完成了首次贡献\n* @fivosts 在 [#742](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F742) 中完成了首次贡献\n* @jaopaulolc 在 [#738](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F738) 中完成了首次贡献\n* @lqwk 在 [#717](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F717) 中完成了首次贡献\n* @mostafaelhoushi\n* @nluu175 在 [#739](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F739) 中完成了首次贡献\n* @ricardoprins 在 [#716](","2022-11-02T04:28:05",{"id":171,"version":172,"summary_zh":173,"released_at":174},247604,"v0.2.4","本次发布新增了一个编译器环境、一系列新的 API，以及一整套后端改进，旨在提升 CompilerGym 环境的灵活性。特别感谢以下代码贡献者：@sogartar、@KyleHerndon、@SoumyajitKarmakar、@uduse 和 @anthony0727！\n\n本次发布的亮点包括：\n\n- [MLIR] 开始构建基于 MLIR 的矩阵乘法新环境（[#652](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F652)，感谢 @KyleHerndon 和 @sogartar！）。请注意，该环境尚未包含在 PyPI 包中，需从源码进行编译（[参见文档](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FINSTALL.md#building-from-source-with-cmake)）。\n- [LLVM] 新增了 `env.benchmark_from_clang_invocation()` 方法（[#577](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F577)），可通过 C\u002FC++ 编译器调用来自动构建 LLVM 环境。这使得将 CompilerGym 集成到现有构建脚本中变得更加便捷。\n- 新增了三个包装类：`Counter` 提供操作计数以供分析使用（[#683](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F683)）；`SynchronousSqliteLogger` 将环境交互日志记录到关系型数据库中（[#679](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F679)）；以及 `ForkOnStep` 提供 `undo()` 操作功能（[#682](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F682)）。\n- 向 `env.reset()` 添加了 `reward_space` 和 `observation_space` 参数（[#659](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F659)，感谢 @SoumyajitKarmakar！）。\n\n此外，本次发布还对后端 API 进行了多项改进，使开发新的 CompilerGym 环境更加容易：\n\n- 重构了后端架构，将 `CompilerEnv` 定义为抽象接口，而将 `ClientServiceCompilerEnv` 作为该接口的具体实现。这一改动使得无需使用 gRPC 即可实现新环境（[#633](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F633)，感谢 @sogartar！）。\n- 扩展了对不同类型动作空间和观测空间的支持（[#641](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F641)、[#643](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F643)，感谢 @sogartar！），新增了 `Permutation` 和 `SpaceSequence` 空间（[#645](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F645)，感谢 @sogartar！）。\n- 在编译服务的工作目录中新增了 `disk\u002F` 子目录，并将其符号链接到磁盘上的位置，以支持那些使用内存工作目录的设备。此举修复了 LLVM 中残留临时目录的问题（[#672](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F672)）。\n\n最后，本次发布还包括大量错误修复和改进，其中许多是由社区报告或解决的。例如，修复了缓存文件路径相关的问题（[#656](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F656)，感谢 @uduse！），以及一个遗漏…","2022-05-25T17:26:14",{"id":176,"version":177,"summary_zh":178,"released_at":179},247605,"v0.2.3","本次发布对核心 `env.step()` 函数引入了弃用性变更，并为通过 CompilerGym 暴露新型编译器优化奠定了基础。特别感谢以下代码贡献者：@mostafaelhoushi、@sogartar、@KyleHerndon、@uduse、@parthchadha 和 @xtremey！\n\n本次发布的亮点包括：\n\n- 为 LLVM 添加了一个新的 `TextSizeInBytes` 观测空间（[#575](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F575)）。\n- 新增了一个 PPO 排行榜条目（[#580](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F580)）。感谢 @xtremey！\n- 修复了一个 bug，该 bug 导致 LLVM 环境创建的临时目录未能被清理（[#592](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F592)）。\n- **[后端]** 函数 `createAndRunCompilerGymService` 现在返回一个整数，即退出状态码（[#592](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F592)）。\n- 对示例文档（[#548](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F548)）和常见问题解答（[#586](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F586)）进行了改进。\n\n弃用与破坏性变更：\n\n- `CompilerEnv.step` 不再接受动作列表（[#627](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F627)）。一个新的方法 `CompilerEnv.multistep` 提供了这一功能。此举旨在与动作空间为列表的环境保持兼容。要更新您的代码，请将所有传入动作列表的 `env.step()` 调用替换为 `env.multistep()`。感谢 @sogartar！\n- `step()` 中的参数 `observations` 和 `rewards` 分别重命名为 `observation_spaces` 和 `reward_spaces`（[#627](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F627)）。\n- `Reward.id` 已重命名为 `Reward.name`（[#565](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F565)、[#612](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F612)）。感谢 @parthchadha！\n- 后端 Protocol Buffer 模式已更新，原生支持更多类型的观测和动作，并支持嵌套空间（[#531](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F531)）。感谢 @sogartar！\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fcompare\u002Fv0.2.2...v0.2.3","2022-03-18T22:15:16",{"id":181,"version":182,"summary_zh":183,"released_at":184},247606,"v0.2.2","本次发布的主要亮点包括对 CMake 构建的支持，以及基于循环展开的新编译器环境。在此特别感谢 @sogartar、@mostafaelhoushi、@KyleHerndon 和 @yqtianust 的代码贡献！\n\n- 增加了在 Linux 上使用 **CMake** 从源码构建 CompilerGym 的支持（[#498](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F498)、[#478](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F478)）。新的构建系统与 Bazel 构建共存，并允许自定义用于构建 LLVM 环境的 CMake 配置。详情请参阅 [INSTALL.md](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002FINSTALL.md#building-from-source-with-cmake)。感谢：@sogartar、@KyleHerndon。\n- 添加了一个用于 LLVM 循环优化的环境（[#530](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F530)、[#529](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F529)、[#517](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F517)）。该示例环境可控制循环展开因子，并演示如何使用新的 CMake 构建系统生成独立的 LLVM 二进制文件。感谢：@mostafaelhoushi。\n- 新增了一个 `BenchmarkUri` 类及用于解析 URI 的 API（[#525](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F525)）。这使得基准测试可以包含可选参数，供后端服务根据这些参数调整其行为。\n- **[llvm]** 在不支持 `\u002Fdev\u002Fshm` 执行可执行文件的系统上，启用了运行时奖励的计算（[#510](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F510)）。\n- **[llvm]** 新增了 `benchmark:\u002F\u002Fmibench-v1` 数据集，并弃用了 `benchmark:\u002F\u002Fmibench-v0`（[#511](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F511)）。如果您正在使用 `mibench-v0`，请升级到新版本。\n- **[llvm]** 启用了 `benchmark:\u002F\u002Fcbench-v1` 数据集中全部 20 个 cBench 运行时数据集（[#525](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F525)）。\n- 将 `Dataset` 类构造函数中的 `site_data_base` 参数设为可选（[#518](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F518)）。\n- 增加了在 macOS Monterey 上从源码构建 CompilerGym 的支持（[#494](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fissues\u002F494)）。\n- 移除了在 v0.1.8 中已弃用的旧版数据集脚本和 API。请改用 [新版数据集 API](https:\u002F\u002Fcompilergym.com\u002Fcompiler_gym\u002Fdatasets.html#datasets)。具体移除内容如下：\n    - `compiler_gym.bin.datasets` 脚本。\n    - 属性：`CompilerEnv.available_datasets` 和 `CompilerEnv.benchmarks`。\n    - 方法：`CompilerEnv.require_dataset()`、`CompilerEnv.require_datasets()`、`CompilerEnv.register_dataset()` 和 `CompilerEnv.get_benchmark_validation_callback()`。\n- 此外还进行了多项错误修复和改进。\n\n**完整变更日志**：[v0.2.1...v0.2.2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fcompare\u002Fv0.2.1...v0.","2022-01-21T09:28:48",{"id":186,"version":187,"summary_zh":188,"released_at":189},247607,"v0.2.1","本次发布的主要亮点包括：\n\n- **[复杂与复合动作空间]** 新增了一种用于描述动作空间的全新模式（[#369](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F369)）。此次全面重构使得能够暴露更丰富的动作集合，例如复合动作空间、字典型动作以及连续动作。\n- **[状态转移数据集]** 我们发布了第一版状态转移数据集，这是一份针对 LLVM 环境的大型 (state, action, reward) 三元组集合，适用于大规模监督学习。我们在 `examples\u002Fgnn_cost_model` 中添加了一个使用图神经网络训练的成本模型示例（[#484](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F484)，感谢 @bcui19！）。\n- **[新增示例]** 我们在 `examples\u002F` 目录下新增了多个示例，包括基于 LLVM 的新循环展开演示（[#477](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F477)，感谢 @mostafaelhoushi！）、循环工具演示（[#457](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F457)，感谢 @bwasti！）、操作微基准测试，以及强化学习脚本示例（[#484](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F484)）。详情请参阅 `examples\u002FREADME.md`。此外，我们还对示例编译器 Gym 服务进行了全面重构（[#467](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F467)）。\n- **[新Logo]** 感谢 Christy 为 CompilerGym 设计的全新优秀 Logo！（[#471](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F471)）\n- **[llvm]** 新增了一个 `Bitcode` 观测空间（[#442](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F442)）。\n- 大量错误修复和改进。\n\n已弃用功能及破坏性变更：\n\n- **[破坏性变更]** 非树内编译器服务需要更新以适配新的动作空间 API（[#369](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F369)）。\n- `env.observation.add_derived_space()` 方法已被弃用，并将在未来版本中移除。请改用 `CompilerEnv` 构造函数中的新参数 `derived_observation_spaces`（[#463](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F463)）。\n- `compiler_gym.utils.logs` 模块已被弃用，请改用 `compiler_gym.utils.runfiles_path`（[#453](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F453)）。\n- `compiler_gym.replay_search` 模块已被弃用，并合并至 `compiler_gym.random_search`（[#453](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F453)）。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fcompare\u002Fv0.2.0...v0.2.1","2021-11-18T12:58:47",{"id":191,"version":192,"summary_zh":193,"released_at":194},247608,"v0.2.0","本次发布在 CompilerGym 中新增了两个编译器优化问题：GCC 命令行选项优化和 CUDA 循环嵌套优化。\n\n- **[GCC]** 由 @hughleat 撰写的全新 `gcc-v0` 环境，将 [GCC](https:\u002F\u002Fgcc.gnu.org\u002F) 的命令行选项暴露为强化学习环境。GCC 是一款用于 C 和 C++ 的生产级编译器，在工业界广泛使用。该环境提供了多个数据集以及一个庞大、高维的动作空间，并支持多个 GCC 版本。更多详情请参阅 [参考文档](https:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002Fenvs\u002Fgcc.html)。\n- **[loop_tool]** 由 @bwasti 撰写的全新 `loop_tool-v0` 环境，提供了一种用于 *n* 维数据计算的实验性中间表示，可被降级到 CPU 和 GPU 后端。这为通过操纵循环嵌套以最大化吞吐量提供了一个强化学习环境。更多详情请参阅 [参考文档](https:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002Fenvs\u002Floop_tool.html)。\n\n此外，本次发布的其他亮点包括：\n\n- **[Docker]** 发布了一个 [chriscummins\u002Fcompiler_gym](https:\u002F\u002Fhub.docker.com\u002Frepository\u002Fdocker\u002Fchriscummins\u002Fcompiler_gym) Docker 镜像，可用于在独立的隔离容器中运行 CompilerGym 服务（[#424](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F424)）。\n- **[LLVM]** 修复了实验性 `Runtime` 观测空间中的一个 bug，该 bug 导致观测性能随时间逐渐下降（[#398](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F398)）。\n- **[LLVM]** 添加了一个新的工具模块，用于从位码中计算观测值（[#405](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F405)）。\n- 对持续集成服务进行了全面重构，使计算资源需求降低了 59.4%，同时提高了测试覆盖率（[#392](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F392)）。\n- 改进了观测计算失败时的错误报告机制（[#380](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F380)）。\n- 将 `compiler_gym.random_search()` 的返回类型更改为 `CompilerEnv`（[#387](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F387)）。\n- 还进行了多项其他 bug 修复和改进。\n\n特别感谢以下代码贡献者：@thecoblack、@bwasti、@hughleat 和 @sahirgomez1！","2021-09-29T18:33:16",{"id":196,"version":197,"summary_zh":198,"released_at":199},247609,"v0.1.10","本次发布为 CompilerGym 的多项全新且令人期待的功能奠定了基础：\n\n- [LLVM] 新增了针对**运行时优化**和**编译时优化**的实验性支持（[#307](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F307)）。目前这仍处于概念验证阶段，尚未稳定。现阶段仅支持 `benchmark:\u002F\u002Fcbench-v1` 和 `generator:\u002F\u002Fcsmith-v0` 数据集。\n- [CompilerGym Explorer] 已开始开发 LLVM 环境的**Web 前端**。正在开发中的 Flask API 和 React 网站位于 `www` 目录中。\n- [新后端 API] 添加了一种向编译器服务后端发送任意数据负载的机制（[#313](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F313)）。这使得在单个 episode 期间可以设置不符合常规动作空间的临时参数。只需在后端实现可选的 [`handle_session_parameter()`](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002F63ee95a34157856ca21c392c49d35234e065fa8d\u002Fcompiler_gym\u002Fservice\u002Fcompilation_session.py#L94-L112) 方法来支持这些参数，然后使用 [`send_params()`](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002F63ee95a34157856ca21c392c49d35234e065fa8d\u002Fcompiler_gym\u002Fenvs\u002Fcompiler_env.py#L1317-L1338) 方法即可发送参数。\n\n此外，本次发布还有以下亮点：\n\n- [LLVM] Csmith 程序生成器现作为 CompilerGym 二进制发行版的一部分提供，无需再本地编译（[#348](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F348)）。\n- [LLVM] 新增了 `ProgramlJson` 观测空间，它直接提供 ProGraML 图的 JSON 节点-边数据，而无需解析为 `nx.MultiDiGraph` 对象（[#332](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F332)）。\n- [LLVM] 添加了一个 DQN 智能体的排行榜提交（[#292](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F292)，感谢 @phesse001！）。\n- [后端 API 更新] `Reward.reset()` 方法现在会接收一个观测视图，可用于计算初始状态（[#341](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F341)，感谢 @bwasti！）。\n- [数据集 API] 将无限数据集的大小从 `float(\"inf\")` 改为 `0`（[#347](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F347)）。这是为了兼容 `__len__()` 方法对整数值的要求而做的修复。\n- 阻止内存缓存过度增长（[#299](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F299)）。\n- 多项针对 `compiler_gym.wrappers` 的兼容性修复。\n- 以及其他众多 bug 修复和改进。","2021-09-08T10:07:57",{"id":201,"version":202,"summary_zh":203,"released_at":204},247610,"v0.1.9","本次 CompilerGym 发布重点聚焦于 **后端可扩展性**，并新增多项功能，以简化对新编译器的支持添加流程：\n\n- 新增 `CompilationSession` 类，封装单个增量编译会话（[#261](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F261)）。\n- 引入 CompilerGym 服务的通用运行时，该运行时接受 `CompilationSession` 子类，并自动处理所有 RPC 相关逻辑（[#270](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F270)）。\n- 将 LLVM 服务及示例服务移植到新的运行时环境（[#277](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F277)），在代码行数减少的同时实现了性能提升。\n\n此外，本次发布还包括以下亮点：\n\n- [核心 API] 新增 `compiler_gym.wrappers` 模块，允许在不修改环境代码的情况下，轻松对 CompilerGym 环境应用模块化变换（[#272](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F272)）。\n- [核心 API] 新增 `Datasets.random_benchmark()` 方法，用于从一个或多个数据集中均匀随机地选择基准测试用例（[#247](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F247)）。\n- [核心 API] 新增 `compiler_gym.make()` 函数，等同于 `gym.make()`（[#257](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F257)）。\n- [LLVM] 新增 `IrSha1` 观测空间，采用快速的服务端 C++ 实现来计算环境状态的校验和（[#267](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F267)）。\n- [LLVM] 新增来自 CHStone 基准测试套件的 12 个 C 程序（[#284](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F284)）。\n- [LLVM] 添加 `anghabench-v1` 数据集，并弃用了 `anghabench-v0`（[#242](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F242)）。\n- 大量错误修复与改进。","2021-06-04T00:29:50",{"id":206,"version":207,"summary_zh":208,"released_at":209},247611,"v0.1.8","本次发布对基准测试的管理方式进行了重大调整，引入了全新的数据集 API。这使得我们能够支持数百万个新的基准测试，并为 LLVM 环境提供了更高效的实现。不过，这也需要将旧代码迁移到新的接口上（详见下方的“迁移检查清单”）。\n\n## 亮点\n\n本版本的一些关键变化包括：\n\n- **[核心 API 变更]** 我们新增了一个 Python 的 `Benchmark` 类（[#190](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F190)）。现在，`env.benchmark` 属性是一个该类的实例，而非字符串（[#222](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F222)）。\n- **[核心行为变更]** 环境将不再随机选择基准测试。现在，`env.reset()` 始终会选取上次使用的基准测试，除非显式提供了 `benchmark` 参数，或者已手动设置了 `env.benchmark`。若未指定基准，则会使用默认值。\n- **[API 弃用]** 我们引入了全新的 `Dataset` 类层次结构（[#191](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F191), [#192](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F192)）。所有数据集现在无需预先下载即可直接使用，并且可以通过新的 `Datasets` 类对其进行遍历（[#200](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F200)）。同时，我们已弃用了旧的数据集管理操作、`compiler_gym.bin.datasets` 脚本，并从命令行工具中移除了 `--dataset` 和 `--ls_benchmark` 标志。\n- **[RPC 接口变更]** `StartSession` RPC 端点现在可以接受一个初始观测值列表进行计算。这消除了立即调用 `Step` 的需求，从而将环境重置时间缩短了 15% 至 21%（[#189](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F189)）。\n- [LLVM] 我们新增了多个基准测试数据集，其中包括 Csmith 和 llvm-stress 程序生成器（[#207](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F207)）、OpenCL 内核数据集（[#208](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F208)），以及可编译的 C 函数数据集（[#210](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F210)）。有关概述，请参阅文档：[LLVM 数据集](https:\u002F\u002Ffacebookresearch.github.io\u002FCompilerGym\u002Fllvm\u002Findex.html#datasets)。\n- `CompilerEnv` 现在允许在构造时传入一个可选的 `Logger` 实例，以便对日志输出进行更细粒度的控制（[#187](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F187)）。\n- [LLVM] LLVM-IR 模块的 ModuleID 和 source_filename 现在已被匿名化，以防止模型因基准测试名称而产生无意的过拟合（","2021-04-30T17:41:41",{"id":211,"version":212,"summary_zh":213,"released_at":214},247612,"v0.1.7","此版本引入了[公开排行榜](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym#leaderboards)，用于跟踪用户提交的算法在编译器优化任务上的性能。\n\n- 新增了 `compiler_gym.leaderboard` 包，其中包含用于准备排行榜提交的实用工具 [(#161)](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F161)。\n- 添加了一个基于 LLVM 指令计数的排行榜，并以随机搜索基线作为初始数据 [(#117)](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F117)。\n- 增加了对 Python 3.9 的支持，将支持的 Python 版本扩展为 3.6、3.7、3.8 和 3.9 [(#160)](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F160)。\n- [llvm] 新增了一个 `InstCount` 观测空间，该空间包含每种指令类型的计数 [(#159)](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym\u002Fpull\u002F159)。\n\n## 构建依赖更新通知\n\n此版本更新了若干构建依赖项的最低要求版本。如果您是从源代码构建并从旧版本的 CompilerGym 升级，则需要更新您的构建环境。最简单的方法是使用 `conda remove --name compiler_gym --all` 删除现有的 conda 环境，并按照[从源代码构建](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FCompilerGym#building-from-source)中的步骤重新创建环境。","2021-04-02T10:36:00",{"id":216,"version":217,"summary_zh":218,"released_at":219},247613,"v0.1.6","This release focuses on hardening the LLVM environments, providing improved\r\nsemantics validation, and improving the datasets. Many thanks to @JD-at-work,\r\n@bwasti, and @mostafaelhoushi for code contributions.\r\n\r\n- [llvm] Added a new `cBench-v1` dataset which changes the function attributes\r\n  of the IR to permit inlining. `cBench-v0` is deprecated and will be removed no\r\n  earlier than v0.1.6.\r\n- [llvm] Removed 15 passes from the LLVM action space: `-bounds-checking`,\r\n  `-chr`, `-extract-blocks`, `-gvn-sink`, `-loop-extract-single`,\r\n  `-loop-extract`, `-objc-arc-apelim`, `-objc-arc-contract`, `-objc-arc-expand`,\r\n  `-objc-arc`, `-place-safepoints`, `-rewrite-symbols`,\r\n  `-strip-dead-debug-info`, `-strip-nonlinetable-debuginfo`, `-structurizecfg`.\r\n  Passes are removed if they are: irrelevant (e.g. used only debugging), if they\r\n  change the program semantics (e.g. inserting runtimes bound checking), or if\r\n  they have been found to have nondeterministic behavior between runs.\r\n- Extended `env.step()` so that it can take a list of actions that are all\r\n  performed in a single batch. This improve efficiency.\r\n- Added default reward spaces for `CompilerEnv` that are derived from scalar\r\n  observations (thanks @bwasti!)\r\n- Added a new Q learning example (thanks @JD-at-work!).\r\n- *Deprecation:* The next release v0.1.7 will introduce a new datasets API that\r\n  is easier to use and more flexible. In preparation for this, the `Dataset`\r\n  class has been renamed to `LegacyDataset`, the following dataset operations\r\n  have been marked deprecated: `activate()`, `deactivate()`, and `delete()`. The\r\n  `GetBenchmarks()` RPC interface method has also been marked deprecated..\r\n- [llvm] Improved semantics validation using LLVM's memory, thread, address, and\r\n  undefined behavior sanitizers.\r\n- Numerous bug fixes and improvements.","2021-03-23T19:53:18",{"id":221,"version":222,"summary_zh":223,"released_at":224},247614,"v0.1.3","This release adds numerous enhancements aimed at improving ease-of-use. Thanks\r\nto @broune, @hughleat, and @JD-ETH for contributions.\r\n\r\n* Added a new `env.validate()` API for validating the state of an environment.\r\n  Added semantics validation for some LLVM benchmarks.\r\n* Added a `env.fork()` method to efficiently duplicate an environment state.\r\n* The `manual_env` environment has been improved with new features such as hill\r\n  climbing search and tab completion.\r\n* Ease of use improvements for string observation space and reward space names:\r\n  Added new getter methods such as `env.observation.Autophase()` and generated\r\n  constants such as `llvm.observation_spaces.autophase`.\r\n* *Breaking change*: Calculation of environment reward has been moved to Python.\r\n  Reward functions have been removed from backend service implementations and\r\n  replaced with equivalent Python classes.\r\n* Various bug fixes and improvements.","2021-02-26T23:57:25",{"id":226,"version":227,"summary_zh":228,"released_at":229},247615,"v0.1.2","* Add a new `compiler_gym.views.ObservationView.add_derived_space(...)` API\r\n  for constructing derived observation spaces.\r\n* Added default reward and observation values for `env.step()` in case of\r\n  service failure.\r\n* Extended the public `compiler_gym.datasets` API for managing datasets.\r\n* [llvm] Adds `-Norm`-suffixed rewards that are normalized to unoptimized cost.\r\n* Extended documentation and example codes.\r\n* Numerous bug fixes and improvements.","2021-01-25T20:12:55",{"id":231,"version":232,"summary_zh":233,"released_at":234},247616,"v0.1.1","* Expose the package version through `compiler_gym.__version__`, and the compiler version through `CompilerEnv.compiler_version`.\r\n* Add a [notebook version](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ffacebookresearch\u002FCompilerGym\u002Fblob\u002Fdevelopment\u002Fexamples\u002Fgetting-started.ipynb) of the \"Getting Started\" guide that can be run in colab.\r\n* [llvm] Reformulate reward signals to be cumulative.\r\n* [llvm] Add a new reward signal based on the size of the `.text` section of compiled object files.\r\n* [llvm] Add a `LlvmEnv.make_benchmark()` API for easily constructing custom benchmarks for use in environments.\r\n* Numerous bug fixes and improvements.","2020-12-28T21:23:49",{"id":236,"version":237,"summary_zh":238,"released_at":239},247617,"v0.1.0","Initial LLVM phase ordering problem set targeting static code size.","2020-12-19T00:21:38"]