[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-google-research--circuit_training":3,"tool-google-research--circuit_training":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 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[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":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":65,"owner_location":65,"owner_email":65,"owner_twitter":65,"owner_website":76,"owner_url":77,"languages":78,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":91,"env_os":92,"env_gpu":93,"env_ram":94,"env_deps":95,"category_tags":104,"github_topics":65,"view_count":32,"oss_zip_url":65,"oss_zip_packed_at":65,"status":17,"created_at":106,"updated_at":107,"faqs":108,"releases":137},8179,"google-research\u002Fcircuit_training","circuit_training",null,"AlphaChip 是一个开源框架，旨在利用分布式深度强化学习技术自动生成芯片的布局规划（Floorplan）。它复现了发表在《自然》杂志上的突破性研究成果，解决了传统芯片设计中依赖人工经验、耗时漫长且难以在宏单元数量激增时找到最优解的难题。通过智能算法，AlphaChip 能够同时优化线长、拥塞度和密度等多个关键指标，自动决定数百个宏单元的位置与朝向，显著缩短设计周期并提升芯片性能。\n\n这款工具特别适合芯片设计研究人员、EDA 算法开发者以及希望探索 AI 辅助硬件设计的工程师使用。其核心技术亮点在于基于 TensorFlow 2.x 和 TF-Agents 构建，支持大规模分布式训练与数据收集，可轻松扩展至数百个执行节点。此外，AlphaChip 功能丰富，不仅支持宏单元与边界间距约束、固定宏单元处理，还能兼容 DREAMPlace 进行标准单元布局，并允许用户自定义工艺技术参数。作为首个将强化学习成功应用于现实世界工程问题的案例之一，AlphaChip 为学术界和工业界提供了一个强大的基础平台，推动着\"AI 造芯”技术的持续演进。","\u003C!--* freshness: {\n  owner: 'wenjiej'\n  owner: 'esonghori'\n  owner: 'sguada'\n  owner: 'morpheus-core'\n  reviewed: '2024-08-14'\n  review_interval: '12 months'\n} *-->\n\n# AlphaChip: An open-source framework for generating chip floorplans with distributed deep reinforcement learning.\n\n*AlphaChip* is an open-source framework\nfor generating chip floorplans with distributed deep reinforcement learning.\nThis framework reproduces the methodology published in the Nature 2021 paper:\n\n*[A graph placement methodology for fast chip design.](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w)\nAzalia Mirhoseini, Anna Goldie, Mustafa Yazgan, Joe Wenjie Jiang, Ebrahim\nSonghori, Shen Wang, Young-Joon Lee, Eric Johnson, Omkar Pathak, Azade Nazi,\nJiwoo Pak, Andy Tong, Kavya Srinivasa, William Hang, Emre Tuncer, Quoc V. Le,\nJames Laudon, Richard Ho, Roger Carpenter & Jeff Dean, 2021. Nature, 594(7862),\npp.207-212.\n[[PDF]](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w.epdf?sharing_token=tYaxh2mR5EozfsSL0WHZLdRgN0jAjWel9jnR3ZoTv0PW0K0NmVrRsFPaMa9Y5We9O4Hqf_liatg-lvhiVcYpHL_YQpqkurA31sxqtmA-E1yNUWVMMVSBxWSp7ZFFIWawYQYnEXoBE4esRDSWqubhDFWUPyI5wK_5B_YIO-D_kS8%3D)*\n\nAlphaChip--one of the first reinforcement learning approaches used to solve a\nreal-world engineering problem--has led to a proliferation of research in AI\nfor chips over the past few years. It is now used to design layouts for chips\nacross Alphabet and outside, and has been extended to various stages of the\ndesign process, including logic synthesis, macro selection, timing optimization,\nand more! We hope that researchers will continue building on top of AlphaChip\nmethodologies and open-source framework. Please see our [blogpost](https:\u002F\u002Fdeepmind.google\u002Fdiscover\u002Fblog\u002Fhow-alphachip-transformed-computer-chip-design\u002F) for more information.\n\nAlphaChip is built on top of\n[TF-Agents](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fagents) and\n[TensorFlow 2.x](https:\u002F\u002Fwww.tensorflow.org\u002F) with support for eager execution,\ndistributed training across multiple GPUs, and distributed data collection\nscaling to 100s of actors.\n\n## Table of contents\n\n\u003Ca href='#Features'>Features\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Installation'>Installation\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#QuickStart'>Quick start\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Testing'>Testing\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Releases'>Releases\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#PreTrainedModelCheckpoint'>Pre-Trained Model Checkpoint\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#HowToUseTheCheckpoint'>How to use the checkpoint\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Results'>Results\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#FAQ'>FAQ\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Contributing'>How to contribute\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Principles'>AI Principles\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Contributors'>Contributors\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Citation'>How to cite\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Disclaimer'>Disclaimer\u003C\u002Fa>\u003Cbr>\n\n\u003Ca id='Features'>\u003C\u002Fa>\n\n## Features\n\n*   Places netlists with hundreds of macros and millions of stdcells (in\n    clustered format).\n*   Computes both macro location and orientation (flipping).\n*   Optimizes multiple objectives including wirelength, congestion, and density.\n*   Supports alignment of blocks to the grid, to model clock strap or macro\n    blockage.\n*   Supports macro-to-macro, macro-to-boundary spacing constraints.\n*   Supports fixed macros.\n*   Supports [DREAMPlace](https:\u002F\u002Fgithub.com\u002Flimbo018\u002FDREAMPlace) as the stdcell placer.\n*   Allows users to specify their own technology parameters, e.g. and routing\n    resources (in routes per micron) and macro routing allocation.\n*   Generates\n    [clustered netlists](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fmain\u002Fcircuit_training\u002Fgrouping).\n*   [TILOS-AI-Institute](https:\u002F\u002Fwww.tilos.ai\u002F) has created a\n    [script](https:\u002F\u002Fgithub.com\u002FTILOS-AI-Institute\u002FMacroPlacement\u002Ftree\u002Fmain\u002FCodeElements\u002FFormatTranslators)\n    to convert LEF\u002FDEF and Bookshelf to the\n    [Netlist Protocol Buffer](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fblob\u002Fmain\u002Fdocs\u002FNETLIST_FORMAT.md)\n    used as the input for AlphaChip.\n\n\u003Ca id='Installation'>\u003C\u002Fa>\n\n## Installation\n\n> :warning: AlphaChip only supports Linux based OSes.\n\n> :warning: AlphaChip requires Python 3.9 or greater.\n\n## Stable\n\nAlphaChip is a research project. We are not currently creating PyPi\nbuilds. Stable in this instance is relative to HEAD and means that the code\nwas tested at this point in time and branched. With upstream libraires\nconstantly changing; older branches may end up rotting faster than expected.\n\nThe steps below install the most recent branch and the archive is in the\n[releases section](#releases). There are two methods for installing; but before\ndoing either one you need to run the preliminary setup](#preliminary-setup).\n\n*  [Use the docker](#using-the-docker) (**Highly Recommended**)\n*  [Install locally](#install-locally)\n\n\n### Preliminary Setup\n\nBefore following the instructions set the following variables and clone the\nrepo:\n\n```shell\n$ export CT_VERSION=0.0.4\n# Currently supports python3.9, python3.10, and python3.11\n# The docker is python3.9 only.\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_20231214_c5a83e5_${PYTHON_VERSION}.tar.gz\n# If the verson of TF-Agents in the table is not current, change this command to\n# match the version tf-agenst that matches the branch of AlphaChip used.\n$ export TF_AGENTS_PIP_VERSION=tf-agents[reverb]\n\n# Clone the Repo and checkout the desired branch.\n$  git clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training.git\n$  git -C $(pwd)\u002Fcircuit_training checkout r${CT_VERSION}\n```\n\n### Using the docker\n\nDo not forget to do the [prelimary setup](#preliminary-setup). The cleanest way\nto use AlphaChip is to use the docker, these commands will create a\ndocker with all the dependencies needed:\n\n```shell\n$ export REPO_ROOT=$(pwd)\u002Fcircuit_training\n\n# Build the docker image.\n$ docker build --pull --no-cache --tag circuit_training:core \\\n    --build-arg tf_agents_version=\"${TF_AGENTS_PIP_VERSION}\" \\\n    --build-arg dreamplace_version=\"${DREAMPLACE_PATTERN}\" \\\n    --build-arg placement_cost_binary=\"plc_wrapper_main_${CT_VERSION}\" \\\n    -f \"${REPO_ROOT}\"\u002Ftools\u002Fdocker\u002Fubuntu_circuit_training ${REPO_ROOT}\u002Ftools\u002Fdocker\u002F\n\n# Run the end2end smoke test using the image. Takes 10-20 minutes.\n$ mkdir -p ${REPO_ROOT}\u002Flogs\n$ docker run --rm -v ${REPO_ROOT}:\u002Fworkspace --workdir \u002Fworkspace circuit_training:core \\\n    bash tools\u002Fe2e_smoke_test.sh --root_dir \u002Fworkspace\u002Flogs\n```\n\n### Install locally\n\nDo not forget to do the [prelimary setup](#preliminary-setup).\n\nAlphaChip installation steps:\n\n*   Install our DREAMPlace binary.\n*   Install TF-Agents and The Placement Cost Binary\n*   Run a test\n\n\n#### Install DREAMPlace\n\nFollow the [instructions](#install-dreamplace) for DREAMPlace but do not change\nthe ENV VARS that you already exported previously.\n\n\n#### Install TF-Agents and the Placement Cost binary\n\nThese commands install TF-Agents and the placement cost binary.\n\n```shell\n# Installs TF-Agents with stable versions of Reverb and TensorFlow 2.x.\n$  pip install $TF_AGENTS_PIP_VERSION\n$  pip install tf-keras\n# Using keras-2\n$ export TF_USE_LEGACY_KERAS=1\n# Copies the placement cost binary to \u002Fusr\u002Flocal\u002Fbin and makes it executable.\n$  sudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_${CT_VERSION} \\\n     -o  \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n$  sudo chmod 555 \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n```\n\n#### Run a test.\n\nThese commands run a basic unit test; if the current stable tf-agents is not the\nversion you installed, then edit the tox.ini file and change `tf-agents[reverb]`\nto `tf-agents[reverb]~=\u003Cversion you want>`\n\n```shell\ntox -e py39-stable -- circuit_training\u002Fgrouping\u002Fgrouping_test.py\n```\n\n\n## HEAD\n\nWe recommand using [stable](#stable) branches; but our team does work from the\n`HEAD`. The main issue is `HEAD` breaks when upstream libraries are broken and\nour `HEAD` utilizes other nightly created libraries adding to the variablity.\n\nThe steps below install the most recent branch and the archive is in the\n[releases section](#releases). There are two methods for installing; but before\ndoing either one you need to run the [preliminary setup](#preliminary-setup-2).\n\n*  [Use the docker](#using-the-docker-2) (**Highly Recommended**)\n*  [Install locally](#install-locally-2)\n\n\n### Preliminary Setup\n\nBefore following the instructions set the following variables and clone the\nrepo:\n\n```shell\n# Currently supports python3.9, python3.10, and python3.11\n# The docker is python3.9 only.\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_${PYTHON_VERSION}.tar.gz\n\n# Clone the Repo and checkout the desired branch.\n$  git clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training.git\n```\n\n### Using the docker\n\nDo not forget to do the [preliminary setup](#preliminary-setup). The cleanest way\nto use AlphaChip is to use docker, these commands will create an image\nwith all the dependencies needed:\n\n```shell\n$ export REPO_ROOT=$(pwd)\u002Fcircuit_training\n\n# Builds the image with current DREAMPlace and Placement Cost Binary.\n$ docker build --pull --no-cache --tag circuit_training:core \\\n    --build-arg tf_agents_version=\"tf-agents-nightly[reverb]\" \\\n    -f \"${REPO_ROOT}\"\u002Ftools\u002Fdocker\u002Fubuntu_circuit_training ${REPO_ROOT}\u002Ftools\u002Fdocker\u002F\n\n# Run the end2end smoke test using the image. Takes 10-20 minutes.\n$ mkdir -p ${REPO_ROOT}\u002Flogs\n$ docker run --rm -v ${REPO_ROOT}:\u002Fworkspace --workdir \u002Fworkspace circuit_training:core \\\n    bash tools\u002Fe2e_smoke_test.sh --root_dir \u002Fworkspace\u002Flogs\n```\n\n### Install locally\n\nAlphaChip installation steps:\n\n*   Install our DREAMPlace binary.\n*   Install TF-Agents Nightly and the placement cost binary\n*   Run a test\n\n#### Install DREAMPlace\n\nFollow the [instructions](#install-dreamplace) for DREAMPlace but do not change\nthe ENV VARS that you already exported previously.\n\n\n#### Install TF-Agents and the Placement Cost binary\n\nThese commands install TF-Agents and the placement cost binary.\n\n```shell\n# Installs TF-Agents with stable versions of Reverb and TensorFlow 2.x.\n$  pip install tf-agents-nightly[reverb]\n$  pip install tf-keras\n# Using keras-2\n$ export TF_USE_LEGACY_KERAS=1\n# Copies the placement cost binary to \u002Fusr\u002Flocal\u002Fbin and makes it executable.\n$  sudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main \\\n     -o  \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n$  sudo chmod 555 \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n```\n\n#### Run a test.\n\nThese commands run a basic unit test.\n\n```shell\ntox -e py39-nightly -- circuit_training\u002Fgrouping\u002Fgrouping_test.py\n```\n\n## Install DREAMPlace\n\nDREAMPlace is **not** provided as a PyPi package and needs to be compilede. We \nprovide compiled versions of DREAMPlace taken from our\n[branch](https:\u002F\u002Fgithub.com\u002Fesonghori\u002FDREAMPlace\u002Ftree\u002Fcircuit_training) for a\nrange of Python versions built for our docker image (Ubuntu 20.4). We also use\nthem for presubmit testing. If our binaries are not compatible with your OS tool\nchain, you will need to compile your own version. We use this\n[script](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fblob\u002Fmain\u002Ftools\u002Fbootstrap_dreamplace_build.sh)\nto create our DREAMPlace binary.\n\n```shell\n# These ENV VARS may have been set above, do not export again if already set.\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_${PYTHON_VERSION}.tar.gz\n# Installs DREAMPlace into `\u002Fdreamplace`. Anywhere is fine as long as PYTHONPATH\n# is set correctly.\n$  mkdir -p \u002Fdreamplace\n# Picks the binary that matches your version of Python.\n$  curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fdreamplace\u002Fdreamplace_python3.9.tar.gz -o \u002Fdreamplace\u002Fdreamplace.tar.gz\n\n# Unpacks the package.\n$  tar xzf \u002Fdreamplace\u002Fdreamplace.tar.gz -C \u002Fdreamplace\u002F\n\n# Sets the python path so we can find Placer with `import dreamplace.Placer`\n# This also needs to put all of DREAMPlace at the root because DREAMPlace python\n# is not setup like a package with imports like `dreamplace.Param`.\n$  export PYTHONPATH=\"${PYTHONPATH}:\u002Fdreamplace:\u002Fdreamplace\u002Fdreamplace\"\n\n# DREAMPlace requires some additional system and python libraries\n# System packages\n$  apt-get install -y \\\n      flex \\\n      libcairo2-dev \\\n      libboost-all-dev\n\n# Python packages\n$  python3 -mpip install pyunpack>=0.1.2 \\\n      patool>=1.12 \\\n      timeout-decorator>=0.5.0 \\\n      matplotlib>=2.2.2 \\\n      cairocffi>=0.9.0 \\\n      pkgconfig>=1.4.0 \\\n      setuptools>=39.1.0 \\\n      scipy>=1.1.0 \\\n      numpy>=1.15.4 \\\n      torch==1.13.1 \\\n      shapely>=1.7.0\n\n```\n\n\u003Ca id='QuickStart'>\u003C\u002Fa>\n\n## Quick start\n\nThe best quick start is to run the\n[end2end smoke test](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fmain\u002Ftools#end-to-end-smoke-test)\nand then look at the full distributed example\n[AlphaChip for Ariane RISC-V](.\u002Fdocs\u002FARIANE.md).\nFor the pre-training\non multiple netlists see [Pre-Training Instruction](.\u002Fdocs\u002FPRETRAINING.md).\n\n\u003Ca id='Testing'>\u003C\u002Fa>\n\n## Testing\n\n```shell\n# Runs tests with nightly TF-Agents.\n$  tox -e py39-nightly,py310-nightly,py311-nightly\n# Runs with latest stable TF-Agents.\n$  tox -e py39-stable,py310-stable,py311-stable\n\n# Using our Docker for CI.\n## Build the docker\n$  docker build --tag circuit_training:ci -f tools\u002Fdocker\u002Fubuntu_ci tools\u002Fdocker\u002F\n## Runs tests with nightly TF-Agents.\n$  docker run -it --rm -v $(pwd):\u002Fworkspace --workdir \u002Fworkspace circuit_training:ci \\\n     tox -e py39-nightly,py310-nightly,py311-nightly\n## Runs tests with latest stable TF-Agents.\n$  docker run -it --rm -v $(pwd):\u002Fworkspace --workdir \u002Fworkspace circuit_training:ci \\\n     tox -e py39-stable,py310-stable,py311-stable\n\n```\n\n\u003Ca id='Releases'>\u003C\u002Fa>\n\n## Releases\n\nWhile running at `HEAD` likely works, working from a branch has advantages of\nbeing more stable. We have tagged the code base to mark\ncompatibility with stable releases of the underlying libraries. For DREAMPlace\nthe filename pattern can be used to install DREAMPle for the versions of Python\nsupported. For the Placement Cost binary, the ULR is to the version of the PLC\nused at the time the branch was cut.\n\nRelease | Branch \u002F Tag                                                              | TF-Agents                 | DREAMPlace                       | PL\n------- | ------------------------------------------------------------------------- | ------------------------- | -------------------------------- | -------------- |\nHEAD    | [main](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit-training)               | tf-agents-nightly[reverb] |\n0.0.4   | [v0.0.4](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fr0.0.4) | tf-agents[reverb]~=0.19.0 | dreamplace_20231214_c5a83e5_python3.9.tar.gz | [plc_wrapper_main_0.0.4](https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_0.0.4)\n0.0.3   | [v0.0.3](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fr0.0.3) | tf-agents[reverb]~=0.16.0 | dreamplace_20230414_b31e8af_python3.9.tar.gz | [plc_wrapper_main_0.0.3](https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_0.0.3)\n0.0.2   | [v0.0.2](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fv0.0.2) | tf-agents[reverb]~=0.16.0 |\n\n\u003Ca id='PreTrainedModelCheckpoint'>\u003C\u002Fa>\n\n## Pre-Trained Model Checkpoint\n\nUnlike prior approaches, our method is a learning-based approach, meaning that\nit becomes better and faster as it sees and solves more instances of the chip\nplacement problem. This pre-training step significantly improves its speed,\nreliability, and placement quality, as discussed in the original Nature article\nand a follow-up study at ISPD 2022 ([Summer Yue, Ebrahim Songhori, Joe Jiang,\nToby Boyd, Anna Goldie, Azalia Mirhoseini, Sergio Guadarrama. Scalability and\nGeneralization of Circuit Training for Chip Floorplanning. ISPD, 2022.`]\n(https:\u002F\u002Fdl.acm.org\u002Fdoi\u002Fabs\u002F10.1145\u002F3505170.3511478)).\n\nWe release a model checkpoint pre-trained on 20 TPU blocks, which can\nserve as a starting point for model training and fine-tuning purposes. Please\nnote that, like any other deep learning models (such as large language and\nvision models), increasing the number of training examples and using\nin-distribution data during pre-training will improve the quality of results.\nTherefore, for best results, we strongly recommend\n[pre-training on your own chip blocks](.\u002Fdocs\u002FPRETRAINING.md), as these will\nrepresent the most relevant placement experience for the RL agent.\n\nObviously, not performing any pre-training, i.e., training from scratch,\nremoves the RL agent's ability to learn from prior experience.\n\n\n\u003Ca id='HowToUseTheCheckpoint'>\u003C\u002Fa>\n\n### How to use the checkpoint\n\nFirst, download and untar the checkpoint:\n\n```shell\nsudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Ftpu_checkpoint_20240815.tar.gz -o $PWD\u002Ftpu_checkpoint_20240815.tar.gz\ntar -xvf tpu_checkpoint_20240815.tar.gz\nCHECKPOINT_DIR=$PWD\u002Ftpu_checkpoint_20240815\u002F\n```\n\nThen, set the following flags in the train binary to the provided checkpoint\ndirectory:\n\n```shell\npython3.9 -m circuit_training.learning.train_ppo \\\n  ... \\\n  --policy_checkpoint_dir=${CHECKPOINT_DIR} \\\n  --policy_saved_model_dir=${CHECKPOINT_DIR}\n```\n\n\u003Ca id='Results'>\u003C\u002Fa>\n\n## Results\n\nThe results below are reported for training from scratch, since the pre-trained\nmodel cannot be shared at this time.\n\n### Ariane RISC-V CPU\n\nView the full details of the Ariane experiment on our\n[details page](.\u002Fdocs\u002FARIANE.md). Improvements to the code have also resulted\nin 50% less GPU resources needed and a 2x walltime speedup even in training\nfrom scratch. Below are the mean and standard deviation for 3 different seeds\nrun 3 times each. This is slightly different than what was used in the paper\n(8 runs each with a different seed), but better captures the different sources\nof variability.\n\n Metric  | Proxy Wirelength | Proxy Congestion | Proxy Density\n-------- | ---------------- | ---------------- | -------------\n**mean** | 0.1013           | 0.9174           | 0.5502\n**std**  | 0.0036           | 0.0647           | 0.0568\n\nThe table below summarizes the\n[paper](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w.epdf?sharing_token=tYaxh2mR5EozfsSL0WHZLdRgN0jAjWel9jnR3ZoTv0PW0K0NmVrRsFPaMa9Y5We9O4Hqf_liatg-lvhiVcYpHL_YQpqkurA31sxqtmA-E1yNUWVMMVSBxWSp7ZFFIWawYQYnEXoBE4esRDSWqubhDFWUPyI5wK_5B_YIO-D_kS8%3D)\nresult for fine-tuning from a pre-trained model over 8 runs with each one using\na different seed.\n\n Metric  | Proxy Wirelength | Proxy Congestion | Proxy Density\n-------- | ---------------- | ---------------- | -------------\n**mean** | 0.1198           | 0.9718           | 0.5729\n**std**  | 0.0019           | 0.0346           | 0.0086\n\n\u003Ca id='FAQ'>\u003C\u002Fa>\n\n## Frequently Asked Questions\n\nWe wrote this FAQ to answer frequently asked questions about our work. Please\nreach out to us if you have any other questions!\n\n#### What is the goal and philosophy of our team?\n\nOur goal is to help chip designers do their jobs better and faster, and we\nwelcome any method that moves us in that direction. To ensure that we are\nsolving real world problems, we work closely with chip designers to understand\nand address their needs.\n\n#### What is the impact of our work?\n\nTo our knowledge, this is the first deep reinforcement learning (RL) method used\nin production to design hardware products. More specifically, the RL method\ndescribed in the Nature paper generated macro placements that were frozen and\ntaped out in Google’s AI accelerator chip (TPU-v5).\n\nWe are also excited to see that top EDA and chip design companies (e.g.\n[Synopsys](https:\u002F\u002Fwww.forbes.com\u002Fsites\u002Fmoorinsights\u002F2020\u002F04\u002F20\u002Fusing-ai-to-build-better-chips\u002F?sh=63551aef306c),\n[Cadence](https:\u002F\u002Fwww.zdnet.com\u002Farticle\u002Fai-on-the-bench-cadence-offers-machine-learning-to-smooth-chip-design\u002F),\n[NVIDIA](https:\u002F\u002Fresearch.nvidia.com\u002Fpublication\u002F2021-07_NVCell%3A-Standard-Cell),\netc.) have announced initiatives to use similar RL-based methods in their tools\nand chip design efforts.\n\n#### Have we evaluated our method on open-source benchmarks?\n\nWe are focused on modern sub-10nm chips like TPU and Pixel, but we did publish\nan article in MLCAD 2021 led by Prof. David Pan and his student Zixuan Jiang,\nwhere we report results on the open-source ISPD 2015 benchmarks after unfixing\nmacros. In any case, we have open-sourced our method, so the community is free\nto try it out on any benchmark.\n\n#### How do we compare to commercial autoplacers?\n\nDue to licensing agreements, we cannot publish any public comparison with\ncommercial autoplacers. However, we can say that our strongest baseline is the\nphysical design team working directly with the assistance of commercial\nautoplacers, and we outperform this baseline (see “manual” baseline in Table 1\nof our Nature article).\n\n#### How do we perform clustering of standard cells?\n\nIn our Nature paper, we describe how to use hMETIS to cluster standard cells,\nincluding all necessary settings. For detailed settings, please see Extended\nData Table 3 from our [Nature article](http:\u002F\u002Frdcu.be\u002FcmedX). Internally, Google\npays for a commercial license, but non-commercial entities are welcome to use a\nfree open-source license\n\nRegardless, our method runs on unclustered netlists as well, so you can skip the\npreprocessing step if you wish, though we’ve found clustering to benefit both\nour RL method and baseline placers. The complexity of our method scales with the\nnumber of macros, not the number of standard cells, so the runtime will not be\noverly affected.\n\n#### What netlist formats do we support?\n\nOur placer represents netlists in the open-source\n[protocol buffer](https:\u002F\u002Fdevelopers.google.com\u002Fprotocol-buffers) format. You\ncan learn more about the format [here](.\u002Fdocs\u002FNETLIST_FORMAT.md). To run on\nnetlists in other formats (e.g. LEF\u002FDEF or Bookshelf), you can convert to\nprotocol buffer format. Please see our\n[quick start guide](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training#QuickStart)\nfor an example of how to use this format on the open-source RISC-V Ariane CPU.\n\n#### Why do we claim “fast chip design” when RL is slower than analytic solvers?\n\nWhen we say “fast”, we mean that we actually help chip designers do their jobs\nfaster, not that our algorithm runs fast per se. Our method can, in hours, do\nwhat a human chip designer needs weeks or months to perform.\n\nIf an analytic method optimizes for wirelength and produces a result in ~1\nminute, that’s obviously faster than hours of RL optimization; however, if the\nresult does not meet design criteria and therefore physical design experts must\nspend weeks further iterating in the loop with commercial EDA tools, then it’s\nnot faster in any way that matters.\n\n#### In our Nature experiments, why do we report QoR metrics rather than wirelength alone?\n\nOur goal is to develop methods that help chip designers do their job better and\nfaster. We therefore designed the experiments in our paper to mimic the true\nproduction setting as closely as possible, and report QoR (Quality of Result)\nmetrics.\n\nQoR metrics can take up to 72 hours to generate with a commercial EDA tool, but\nare highly accurate measurements of all key metrics, including wirelength,\nhorizontal\u002Fvertical congestion, timing (TNS and WNS), power, and area.\n\nQoR metrics are closest to physical ground truth and are used by production chip\ndesign teams to decide which placements are sent for manufacturing. In contrast,\nproxy costs like approximate wirelength and congestion can be computed cheaply\nand are useful for optimization, but are not used to make real world decisions\nas they can vary significantly from QoR.\n\nIt is also worth noting that metrics like wirelength and routing congestion\ndirectly trade off against each other (e.g. placing nodes close to one another\nincreases congestion, but reduces wirelength), so optimizing or evaluating for\nwirelength alone is unlikely to result in manufacturable chip layouts.\n\n#### In our Nature experiments, do we perform any postprocessing on the RL results?\n\nNo. In our Nature experiments, we do not apply any postprocessing to the RL\nresults.\n\nIn our open-source code, we provide an optional 1-5 minute coordinate descent\npostprocessing step, which we found to slightly improve wirelength. You are\nwelcome to turn it on or off with a flag, and to compare performance with or\nwithout it.\n\n#### What was the process for open-sourcing this code?\n\nOpen-sourcing our code involved partnering with another team at Google\n([TF-Agents](https:\u002F\u002Fwww.tensorflow.org\u002Fagents)). TF-Agents first replicated the\nresults in our Nature article using our codebase, then reimplemented our method\nand replicated our results using their own implementation, and then open-sourced\ntheir implementation as it does not rely on any internal infrastructure.\n\nGetting approval to open-source this code, ensuring compliance with export\ncontrol restrictions, migrating to TensorFlow 2.x, and removing dependencies\nfrom all Google infrastructure was quite time-consuming; but we felt that it was\nworth the effort to be able to share our method with the community.\n\n\u003Ca id='Contributing'>\u003C\u002Fa>\n\n## How to contribute\n\nWe're eager to collaborate with you! See [CONTRIBUTING](CONTRIBUTING.md) for a\nguide on how to contribute. This project adheres to TensorFlow's\n[code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to\nuphold this code of conduct.\n\n\u003Ca id='Principles'>\u003C\u002Fa>\n\n## Principles\n\nThis project adheres to [Google's AI principles](PRINCIPLES.md). By\nparticipating, using or contributing to this project you are expected to adhere\nto these principles.\n\n\u003Ca id='Contributors'>\u003C\u002Fa>\n\n## Main Contributors\n\nWe would like to recognize the following individuals for their code\ncontributions, discussions, and other work to make the release of the AlphaChip\nlibrary possible.\n\n*   Sergio Guadarrama\n*   Summer Yue\n*   Ebrahim Songhori\n*   Joe Jiang\n*   Toby Boyd\n*   Azalia Mirhoseini\n*   Anna Goldie\n*   Mustafa Yazgan\n*   Shen Wang\n*   Terence Tam\n*   Young-Joon Lee\n*   Roger Carpenter\n*   Quoc Le\n*   Ed Chi\n\n\u003Ca id='Citation'>\u003C\u002Fa>\n\n## How to cite\n\nIf you use this code, please cite both:\n\n```\n@article{mirhoseini2021graph,\n  title={A graph placement methodology for fast chip design},\n  author={Mirhoseini*, Azalia and Goldie*, Anna and Yazgan, Mustafa and Jiang, Joe\n  Wenjie and Songhori, Ebrahim and Wang, Shen and Lee, Young-Joon and Johnson,\n  Eric and Pathak, Omkar and Nazi, Azade and Pak, Jiwoo and Tong, Andy and\n  Srinivasa, Kavya and Hang, William and Tuncer, Emre and V. Le, Quoc and\n  Laudon, James and Ho, Richard and Carpenter, Roger and Dean, Jeff},\n  journal={Nature},\n  volume={594},\n  number={7862},\n  pages={207--212},\n  year={2021},\n  publisher={Nature Publishing Group}\n}\n```\n\n```\n@misc{CircuitTraining2021,\n  title = {{Circuit Training}: An open-source framework for generating chip\n  floor plans with distributed deep reinforcement learning.},\n  author = {Guadarrama, Sergio and Yue, Summer and Boyd, Toby and Jiang, Joe\n  Wenjie and Songhori, Ebrahim and Tam, Terence, Goldie, Anna and Mirhoseini,\n  Azalia},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fgoogle_research\u002Fcircuit_training}},\n  url = \"https:\u002F\u002Fgithub.com\u002Fgoogle_research\u002Fcircuit_training\",\n  year = 2021,\n  note = \"[Online; accessed 21-December-2021]\"\n}\n```\n\nIn addition, if you used the open-sourced checkpoint, please also cite:\n\n```\n@misc{AlphaChipCheckpoint2024,\n  title = {A Pre-Trained Checkpoint for {AlphaChip}},\n  author = {Jiang, Joe Wenjie and Songhori, Ebrahim and Mirhoseini, Azalia and\n  Goldie, Anna and Guadarrama, Sergio and Yue, Summer and\n  Boyd, Toby and Tam, Terence, and Wu, Guanhang and Lee, Kuang-Huei and\n  Zhuang, Vincent and Yazgan, Mustafa and and Wang, Shen and Lee, Young-Joon and\n  Johnson, Eric and Pathak, Omkar and Nazi, Azade and Pak, Jiwoo and\n  Tong, Andy and Srinivasa, Kavya and Hang, William and Tuncer, Emre and\n  V. Le, Quoc and Laudon, James and Ho, Richard and Carpenter, Roger and\n  Dean, Jeff},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002F?tab=readme-ov-file#PreTrainedModelCheckpoint}},\n  url = \"https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002F?tab=readme-ov-file#PreTrainedModelCheckpoint\",\n  year = 2024,\n  note = \"[Online; accessed 25-September-2024]\"\n}\n```\n\n\u003Ca id='Disclaimer'>\u003C\u002Fa>\n\n## Disclaimer\n\nThis is not an official Google product.\n","\u003C!--* freshness: {\n  owner: 'wenjiej'\n  owner: 'esonghori'\n  owner: 'sguada'\n  owner: 'morpheus-core'\n  reviewed: '2024-08-14'\n  review_interval: '12 months'\n} *-->\n\n# AlphaChip：一个基于分布式深度强化学习生成芯片版图的开源框架。\n\n*AlphaChip* 是一个开源框架，\n用于通过分布式深度强化学习生成芯片版图。\n该框架复现了 Nature 2021 年论文中发表的方法：\n\n*[一种用于快速芯片设计的图布局方法。](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w)\nAzalia Mirhoseini、Anna Goldie、Mustafa Yazgan、Joe Wenjie Jiang、Ebrahim\nSonghori、Shen Wang、Young-Joon Lee、Eric Johnson、Omkar Pathak、Azade Nazi、\nJiwoo Pak、Andy Tong、Kavya Srinivasa、William Hang、Emre Tuncer、Quoc V. Le、\nJames Laudon、Richard Ho、Roger Carpenter 和 Jeff Dean，2021 年。Nature，594(7862),\n页 207–212。\n[[PDF]](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w.epdf?sharing_token=tYaxh2mR5EozfsSL0WHZLdRgN0jAjWel9jnR3ZoTv0PW0K0NmVrRsFPaMa9Y5We9O4Hqf_liatg-lvhiVcYpHL_YQpqkurA31sxqtmA-E1yNUWVMMVSBxWSp7ZFFIWawYQYnEXoBE4esRDSWqubhDFWUPyI5wK_5B_YIO-D_kS8%3D)*\n\nAlphaChip——最早用于解决实际工程问题的强化学习方法之一——在过去几年里推动了人工智能在芯片设计领域的大量研究。如今，它已被用于设计 Alphabet 内部及外部的芯片布局，并扩展到设计流程的多个阶段，包括逻辑综合、宏单元选择、时序优化等！我们希望研究人员能够继续基于 AlphaChip 的方法论和开源框架进行创新。更多信息请参阅我们的 [博客文章](https:\u002F\u002Fdeepmind.google\u002Fdiscover\u002Fblog\u002Fhow-alphachip-transformed-computer-chip-design\u002F)。\n\nAlphaChip 构建于\n[TF-Agents](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fagents) 和\n[TensorFlow 2.x](https:\u002F\u002Fwww.tensorflow.org\u002F) 之上，支持急切执行模式、跨多 GPU 的分布式训练，以及可扩展至数百个智能体的分布式数据收集。\n\n## 目录\n\n\u003Ca href='#Features'>功能\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Installation'>安装\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#QuickStart'>快速入门\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Testing'>测试\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Releases'>发布\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#PreTrainedModelCheckpoint'>预训练模型检查点\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#HowToUseTheCheckpoint'>如何使用检查点\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Results'>结果\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#FAQ'>常见问题解答\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Contributing'>贡献方式\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Principles'>AI 原则\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Contributors'>贡献者\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Citation'>引用方式\u003C\u002Fa>\u003Cbr>\n\u003Ca href='#Disclaimer'>免责声明\u003C\u002Fa>\u003Cbr>\n\n\u003Ca id='Features'>\u003C\u002Fa>\n\n## 功能\n\n*   可放置包含数百个宏单元和数百万个标准单元的网表（以聚类格式）。\n*   同时计算宏单元的位置与方向（翻转）。\n*   优化多个目标，包括布线长度、拥塞度和密度。\n*   支持将模块对齐到网格，以模拟时钟带或宏单元阻挡。\n*   支持宏单元之间的间距约束以及宏单元与边界之间的间距约束。\n*   支持固定宏单元。\n*   支持将 [DREAMPlace](https:\u002F\u002Fgithub.com\u002Flimbo018\u002FDREAMPlace) 用作标准单元布局器。\n*   允许用户指定自己的工艺参数，例如每微米的布线资源和宏单元的布线分配。\n*   生成\n    [聚类网表](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fmain\u002Fcircuit_training\u002Fgrouping)。\n*   [TILOS-AI-Institute](https:\u002F\u002Fwww.tilos.ai\u002F) 已经创建了一个\n    [脚本](https:\u002F\u002Fgithub.com\u002FTILOS-AI-Institute\u002FMacroPlacement\u002Ftree\u002Fmain\u002FCodeElements\u002FFormatTranslators)\n    用于将 LEF\u002FDEF 和 Bookshelf 格式转换为\n    [Netlist Protocol Buffer](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fblob\u002Fmain\u002Fdocs\u002FNETLIST_FORMAT.md)\n    ，作为 AlphaChip 的输入。\n\n\u003Ca id='Installation'>\u003C\u002Fa>\n\n## 安装\n\n> :warning: AlphaChip 仅支持基于 Linux 的操作系统。\n> :warning: AlphaChip 需要 Python 3.9 或更高版本。\n\n## 稳定性\n\nAlphaChip 是一项研究项目。我们目前尚未创建 PyPI 构建。这里的“稳定”是指相对于 HEAD 提交的状态，意味着代码在此时已被测试并分支出来。由于上游库不断变化，旧分支可能会比预期更快地过时。\n\n以下步骤将安装最新的分支，而归档版本则位于\n[发布部分](#releases)。有两种安装方法；但在开始之前，您需要先完成\n[初步设置](#preliminary-setup)。\n\n*  [使用 Docker](#using-the-docker)（**强烈推荐**）\n*  [本地安装](#install-locally)\n\n\n### 初步设置\n\n在按照说明操作之前，请设置以下变量并克隆仓库：\n\n```shell\n$ export CT_VERSION=0.0.4\n# 目前支持 Python 3.9、Python 3.10 和 Python 3.11\n# Docker 版本仅支持 Python 3.9。\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_20231214_c5a83e5_${PYTHON_VERSION}.tar.gz\n# 如果表格中的 TF-Agents 版本不是最新版本，则需修改此命令，\n# 以匹配所使用的 AlphaChip 分支对应的 TF-Agents 版本。\n$ export TF_AGENTS_PIP_VERSION=tf-agents[reverb]\n\n# 克隆仓库并检出所需分支。\n$  git clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training.git\n$  git -C $(pwd)\u002Fcircuit_training checkout r${CT_VERSION}\n```\n\n### 使用 Docker\n\n请务必先完成 [初步设置](#preliminary-setup)。使用 Docker 是运行 AlphaChip 最简洁的方式，以下命令将创建一个包含所有必要依赖项的 Docker 容器：\n\n```shell\n$ export REPO_ROOT=$(pwd)\u002Fcircuit_training\n\n# 构建 Docker 镜像。\n$ docker build --pull --no-cache --tag circuit_training:core \\\n    --build-arg tf_agents_version=\"${TF_AGENTS_PIP_VERSION}\" \\\n    --build-arg dreamplace_version=\"${DREAMPLACE_PATTERN}\" \\\n    --build-arg placement_cost_binary=\"plc_wrapper_main_${CT_VERSION}\" \\\n    -f \"${REPO_ROOT}\"\u002Ftools\u002Fdocker\u002Fubuntu_circuit_training ${REPO_ROOT}\u002Ftools\u002Fdocker\u002F\n\n# 使用该镜像运行端到端冒烟测试。耗时 10–20 分钟。\n$ mkdir -p ${REPO_ROOT}\u002Flogs\n$ docker run --rm -v ${REPO_ROOT}:\u002Fworkspace --workdir \u002Fworkspace circuit_training:core \\\n    bash tools\u002Fe2e_smoke_test.sh --root_dir \u002Fworkspace\u002Flogs\n```\n\n### 本地安装\n\n请务必先完成 [初步设置](#preliminary-setup)。\n\nAlphaChip 的安装步骤如下：\n\n*   安装我们的 DREAMPlace 二进制文件。\n*   安装 TF-Agents 和布局成本二进制文件。\n*   运行测试\n\n\n#### 安装 DREAMPlace\n\n请按照 [安装说明](#install-dreamplace) 操作 DREAMPlace，但不要更改您之前已导出的环境变量。\n\n\n#### 安装 TF-Agents 和布局成本二进制文件\n\n以下命令将安装 TF-Agents 和布局成本二进制文件。\n\n```shell\n# 安装带有稳定版本 Reverb 和 TensorFlow 2.x 的 TF-Agents。\n$  pip install $TF_AGENTS_PIP_VERSION\n$  pip install tf-keras\n\n# 使用 keras-2\n$ export TF_USE_LEGACY_KERAS=1\n# 将放置成本二进制文件复制到 \u002Fusr\u002Flocal\u002Fbin 并使其可执行。\n$  sudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_${CT_VERSION} \\\n     -o  \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n$  sudo chmod 555 \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n```\n\n#### 运行一个测试。\n\n这些命令运行一个基本的单元测试；如果当前稳定的 tf-agents 不是你安装的版本，那么编辑 tox.ini 文件并将 `tf-agents[reverb]` 改为 `tf-agents[reverb]~=\u003C你想要的版本>`。\n\n```shell\ntox -e py39-stable -- circuit_training\u002Fgrouping\u002Fgrouping_test.py\n```\n\n\n## HEAD\n\n我们建议使用 [stable](#stable) 分支；但我们的团队确实从 `HEAD` 分支进行工作。主要问题是当上游库出现问题时，`HEAD` 分支就会中断，而我们的 `HEAD` 分支还使用了其他夜间构建的库，这增加了不确定性。\n\n下面的步骤会安装最新的分支，其归档位于 [releases 部分](#releases)。有两种安装方法；但在执行任何一种之前，你需要先完成 [初步设置](#preliminary-setup-2)。\n\n*  [使用 docker](#using-the-docker-2) (**强烈推荐**)\n*  [本地安装](#install-locally-2)\n\n\n### 初步设置\n\n在按照说明操作之前，请设置以下变量并克隆仓库：\n\n```shell\n# 目前支持 python3.9、python3.10 和 python3.11\n# Docker 版本仅支持 python3.9。\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_${PYTHON_VERSION}.tar.gz\n\n# 克隆仓库并检出所需分支。\n$  git clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training.git\n```\n\n### 使用 docker\n\n请务必完成 [初步设置](#preliminary-setup)。使用 AlphaChip 最干净的方式是通过 docker，以下命令将创建一个包含所有必要依赖项的镜像：\n\n```shell\n$ export REPO_ROOT=$(pwd)\u002Fcircuit_training\n\n# 构建包含当前 DREAMPlace 和放置成本二进制文件的镜像。\n$ docker build --pull --no-cache --tag circuit_training:core \\\n    --build-arg tf_agents_version=\"tf-agents-nightly[reverb]\" \\\n    -f \"${REPO_ROOT}\"\u002Ftools\u002Fdocker\u002Fubuntu_circuit_training ${REPO_ROOT}\u002Ftools\u002Fdocker\u002F\n\n# 使用该镜像运行端到端烟雾测试。耗时 10-20 分钟。\n$ mkdir -p ${REPO_ROOT}\u002Flogs\n$ docker run --rm -v ${REPO_ROOT}:\u002Fworkspace --workdir \u002Fworkspace circuit_training:core \\\n    bash tools\u002Fe2e_smoke_test.sh --root_dir \u002Fworkspace\u002Flogs\n```\n\n### 本地安装\n\nAlphaChip 的安装步骤如下：\n\n*   安装我们的 DREAMPlace 二进制文件。\n*   安装 TF-Agents 夜间版和放置成本二进制文件。\n*   运行一个测试。\n\n#### 安装 DREAMPlace\n\n请遵循 [安装 DREAMPlace 的说明](#install-dreamplace)，但不要更改你之前已经导出的 ENV VARS。\n\n\n#### 安装 TF-Agents 和放置成本二进制文件\n\n以下命令会安装 TF-Agents 和放置成本二进制文件。\n\n```shell\n# 安装带有稳定版本 Reverb 和 TensorFlow 2.x 的 TF-Agents 夜间版。\n$  pip install tf-agents-nightly[reverb]\n$  pip install tf-keras\n# 使用 keras-2\n$ export TF_USE_LEGACY_KERAS=1\n# 将放置成本二进制文件复制到 \u002Fusr\u002Flocal\u002Fbin 并使其可执行。\n$  sudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main \\\n     -o  \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n$  sudo chmod 555 \u002Fusr\u002Flocal\u002Fbin\u002Fplc_wrapper_main\n```\n\n#### 运行一个测试。\n\n这些命令会运行一个基本的单元测试。\n\n```shell\ntox -e py39-nightly -- circuit_training\u002Fgrouping\u002Fgrouping_test.py\n```\n\n## 安装 DREAMPlace\n\nDREAMPlace **不** 作为 PyPi 包提供，需要自行编译。我们提供了从我们的 [分支](https:\u002F\u002Fgithub.com\u002Fesonghori\u002FDREAMPlace\u002Ftree\u002Fcircuit_training) 中提取的 DREAMPlace 已编译版本，适用于多种 Python 版本，并为我们的 docker 镜像（Ubuntu 20.4）构建。我们也将其用于预提交测试。如果我们的二进制文件与你的操作系统工具链不兼容，你则需要自行编译。我们使用此 [脚本](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fblob\u002Fmain\u002Ftools\u002Fbootstrap_dreamplace_build.sh) 来创建我们的 DREAMPlace 二进制文件。\n\n```shell\n# 这些 ENV VARS 可能已在上面设置，如果已设置则无需再次导出。\n$ export PYTHON_VERSION=python3.9\n$ export DREAMPLACE_PATTERN=dreamplace_${PYTHON_VERSION}.tar.gz\n# 将 DREAMPlace 安装到 `\u002Fdreamplace`。只要正确设置了 PYTHONPATH，任何位置都可以。\n$  mkdir -p \u002Fdreamplace\n# 选择与你的 Python 版本匹配的二进制文件。\n$  curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fdreamplace\u002Fdreamplace_python3.9.tar.gz -o \u002Fdreamplace\u002Fdreamplace.tar.gz\n\n# 解压包。\n$  tar xzf \u002Fdreamplace\u002Fdreamplace.tar.gz -C \u002Fdreamplace\u002F\n\n# 设置 python 路径，以便我们可以用 `import dreamplace.Placer` 找到 Placer。\n# 同时还需要将整个 DREAMPlace 放在根目录下，因为 DREAMPlace 的 python 模块并不是以类似 `dreamplace.Param` 的方式组织导入的。\n$  export PYTHONPATH=\"${PYTHONPATH}:\u002Fdreamplace:\u002Fdreamplace\u002Fdreamplace\"\n\n# DREAMPlace 需要一些额外的系统和 python 库。\n# 系统包\n$  apt-get install -y \\\n      flex \\\n      libcairo2-dev \\\n      libboost-all-dev\n\n# Python 包\n$  python3 -mpip install pyunpack>=0.1.2 \\\n      patool>=1.12 \\\n      timeout-decorator>=0.5.0 \\\n      matplotlib>=2.2.2 \\\n      cairocffi>=0.9.0 \\\n      pkgconfig>=1.4.0 \\\n      setuptools>=39.1.0 \\\n      scipy>=1.1.0 \\\n      numpy>=1.15.4 \\\n      torch==1.13.1 \\\n      shapely>=1.7.0\n\n```\n\n\u003Ca id='QuickStart'>\u003C\u002Fa>\n\n## 快速入门\n\n最好的快速入门方式是运行 [端到端烟雾测试](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fmain\u002Ftools#end-to-end-smoke-test)，然后查看完整的分布式示例 [AlphaChip for Ariane RISC-V](.\u002Fdocs\u002FARIANE.md)。关于多个网表的预训练，请参阅 [预训练说明](.\u002Fdocs\u002FPRETRAINING.md)。\n\n\u003Ca id='Testing'>\u003C\u002Fa>\n\n## 测试\n\n```shell\n# 使用夜间版 TF-Agents 运行测试。\n$  tox -e py39-nightly,py310-nightly,py311-nightly\n# 使用最新稳定版 TF-Agents 运行测试。\n$  tox -e py39-stable,py310-stable,py311-stable\n\n# 使用我们的 Docker 进行 CI。\n## 构建 docker\n$  docker build --tag circuit_training:ci -f tools\u002Fdocker\u002Fubuntu_ci tools\u002Fdocker\u002F\n## 使用夜间版 TF-Agents 运行测试。\n$  docker run -it --rm -v $(pwd):\u002Fworkspace --workdir \u002Fworkspace circuit_training:ci \\\n     tox -e py39-nightly,py310-nightly,py311-nightly\n## 使用最新稳定版 TF-Agents 运行测试。\n$  docker run -it --rm -v $(pwd):\u002Fworkspace --workdir \u002Fworkspace circuit_training:ci \\\n     tox -e py39-stable,py310-stable,py311-stable\n\n```\n\n\u003Ca id='Releases'>\u003C\u002Fa>\n\n## 发布版本\n\n虽然在 `HEAD` 上运行可能有效，但从分支开始工作具有更稳定的优势。我们已对代码库打上标签，以标记与底层库的稳定版本兼容。对于 DREAMPlace，可以使用文件名模式来安装支持的 Python 版本的 DREAMPle。对于 Placement Cost 二进制文件，URL 指向的是在该分支创建时所使用的 PLC 版本。\n\n发布版本 | 分支 \u002F 标签                                                              | TF-Agents                 | DREAMPlace                       | PL\n------- | ------------------------------------------------------------------------- | ------------------------- | -------------------------------- | -------------- |\nHEAD    | [main](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit-training)               | tf-agents-nightly[reverb] |\n0.0.4   | [v0.0.4](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fr0.0.4) | tf-agents[reverb]~=0.19.0 | dreamplace_20231214_c5a83e5_python3.9.tar.gz | [plc_wrapper_main_0.0.4](https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_0.0.4)\n0.0.3   | [v0.0.3](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fr0.0.3) | tf-agents[reverb]~=0.16.0 | dreamplace_20230414_b31e8af_python3.9.tar.gz | [plc_wrapper_main_0.0.3](https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Fplacement_cost\u002Fplc_wrapper_main_0.0.3)\n0.0.2   | [v0.0.2](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Ftree\u002Fv0.0.2) | tf-agents[reverb]~=0.16.0 |\n\n\u003Ca id='PreTrainedModelCheckpoint'>\u003C\u002Fa>\n\n## 预训练模型检查点\n\n与以往的方法不同，我们的方法是一种基于学习的方法，这意味着随着它看到并解决更多芯片布局问题实例，其性能会更好、速度也会更快。正如原始《自然》杂志文章以及 ISPD 2022 的后续研究中所述（Summer Yue, Ebrahim Songhori, Joe Jiang, Toby Boyd, Anna Goldie, Azalia Mirhoseini, Sergio Guadarrama. 芯片平面规划电路训练的可扩展性和泛化能力。ISPD, 2022.`] (https:\u002F\u002Fdl.acm.org\u002Fdoi\u002Fabs\u002F10.1145\u002F3505170.3511478))，这一预训练步骤显著提高了其速度、可靠性和布局质量。\n\n我们发布了一个在 20 个 TPU 块上预训练的模型检查点，它可以作为模型训练和微调的起点。请注意，与其他深度学习模型（如大型语言和视觉模型）一样，在预训练过程中增加训练样本数量并使用分布内数据将提高结果质量。因此，为了获得最佳效果，我们强烈建议您[在自己的芯片块上进行预训练](.\u002Fdocs\u002FPRETRAINING.md)，因为这些将代表 RL 代理最相关的布局经验。\n\n显然，如果不进行任何预训练，即从零开始训练，RL 代理就无法从先前的经验中学习。\n\n\n\u003Ca id='HowToUseTheCheckpoint'>\u003C\u002Fa>\n\n### 如何使用该检查点\n\n首先，下载并解压检查点：\n\n```shell\nsudo curl https:\u002F\u002Fstorage.googleapis.com\u002Frl-infra-public\u002Fcircuit-training\u002Ftpu_checkpoint_20240815.tar.gz -o $PWD\u002Ftpu_checkpoint_20240815.tar.gz\ntar -xvf tpu_checkpoint_20240815.tar.gz\nCHECKPOINT_DIR=$PWD\u002Ftpu_checkpoint_20240815\u002F\n```\n\n然后，在训练二进制文件中将以下标志设置为提供的检查点目录：\n\n```shell\npython3.9 -m circuit_training.learning.train_ppo \\\n  ... \\\n  --policy_checkpoint_dir=${CHECKPOINT_DIR} \\\n  --policy_saved_model_dir=${CHECKPOINT_DIR}\n```\n\n\u003Ca id='Results'>\u003C\u002Fa>\n\n## 结果\n\n以下结果是针对从零开始训练的情况报告的，因为目前无法共享预训练模型。\n\n### Ariane RISC-V CPU\n\n请在我们的[详细信息页面](.\u002Fdocs\u002FARIANE.md)查看 Ariane 实验的完整细节。代码的改进还使得即使是从零开始训练，所需的 GPU 资源减少了 50%，壁时速度提升了两倍。以下是针对 3 个不同种子各运行 3 次的结果的平均值和标准差。这与论文中采用的方式略有不同（每个种子运行 8 次），但更能反映不同的变异来源。\n\n指标  | 代理布线长度 | 代理拥塞度 | 代理密度\n-------- | ---------------- | ---------------- | -------------\n**平均值** | 0.1013           | 0.9174           | 0.5502\n**标准差** | 0.0036           | 0.0647           | 0.0568\n\n下表总结了论文（https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-021-03544-w.epdf?sharing_token=tYaxh2mR5EozfsSL0WHZLdRgN0jAjWel9jnR3ZoTv0PW0K0NmVrRsFPaMa9Y5We9O4Hqf_liatg-lvhiVcYpHL_YQpqkurA31sxqtmA-E1yNUWVMMVSBxWSp7ZFFIWawYQYnEXoBE4esRDSWqubhDFWUPyI5wK_5B_YIO-D_kS8%3D）中关于从预训练模型微调的结果，共进行了 8 次实验，每次使用不同的种子。\n\n指标  | 代理布线长度 | 代理拥塞度 | 代理密度\n-------- | ---------------- | ---------------- | -------------\n**平均值** | 0.1198           | 0.9718           | 0.5729\n**标准差** | 0.0019           | 0.0346           | 0.0086\n\n\u003Ca id='FAQ'>\u003C\u002Fa>\n\n## 常见问题解答\n\n我们编写了这份常见问题解答，旨在回答关于我们工作的常见问题。如果您还有其他问题，请随时联系我们！\n\n#### 我们的团队目标和理念是什么？\n\n我们的目标是帮助芯片设计师更高效、更出色地完成工作，并且我们欢迎任何能够推动我们实现这一目标的方法。为了确保我们解决的是实际问题，我们与芯片设计师紧密合作，深入了解并满足他们的需求。\n\n#### 我们的工作有哪些影响？\n\n据我们所知，这是我们首次在生产环境中使用深度强化学习（RL）方法来设计硬件产品。具体来说，《自然》杂志论文中描述的RL方法生成了宏单元布局，这些布局最终被冻结并用于谷歌的AI加速器芯片（TPU-v5）的流片。\n\n我们也非常高兴地看到，多家顶尖的EDA和芯片设计公司（例如[Synopsys](https:\u002F\u002Fwww.forbes.com\u002Fsites\u002Fmoorinsights\u002F2020\u002F04\u002F20\u002Fusing-ai-to-build-better-chips\u002F?sh=63551aef306c)、[Cadence](https:\u002F\u002Fwww.zdnet.com\u002Farticle\u002Fai-on-the-bench-cadence-offers-machine-learning-to-smooth-chip-design\u002F)、[NVIDIA](https:\u002F\u002Fresearch.nvidia.com\u002Fpublication\u002F2021-07_NVCell%3A-Standard-Cell)等）都已宣布将在其工具和芯片设计工作中采用类似的基于RL的方法。\n\n#### 我们是否在开源基准上评估过我们的方法？\n\n我们主要关注像TPU和Pixel这样的现代10纳米以下芯片，不过我们确实发表了一篇由David Pan教授及其学生Zixuan Jiang主导的MLCAD 2021论文，在该文中我们报告了在解除了宏单元固定后，使用ISPD 2015开源基准的结果。无论如何，我们的方法已经开源，社区可以自由地在任何基准上进行尝试。\n\n#### 我们与商业自动布局工具相比如何？\n\n由于许可协议的限制，我们无法公开与商业自动布局工具的对比结果。不过，我们可以指出，我们的最强基线是由物理设计团队直接在商业自动布局工具的帮助下完成的设计方案，而我们的方法优于这一基线（参见我们《自然》论文中表1中的“手动”基线）。\n\n#### 我们如何对标准单元进行聚类？\n\n在《自然》论文中，我们详细介绍了如何使用hMETIS对标准单元进行聚类，包括所有必要的设置。有关详细设置，请参阅我们《自然》论文中的扩展数据表3（链接：http:\u002F\u002Frdcu.be\u002FcmedX）。在内部，谷歌会购买商业许可证，但非商业机构也可以使用免费的开源许可证。\n\n无论如何，我们的方法同样可以在未聚类的网表上运行，因此如果您愿意，可以跳过预处理步骤。不过，我们发现聚类对我们的RL方法以及基线布局工具都有益处。我们的方法复杂度取决于宏单元的数量，而不是标准单元的数量，因此运行时间不会受到太大影响。\n\n#### 我们支持哪些网表格式？\n\n我们的布局工具以开源的[protocol buffer](https:\u002F\u002Fdevelopers.google.com\u002Fprotocol-buffers)格式表示网表。您可以在此处了解更多关于该格式的信息（链接：.\u002Fdocs\u002FNETLIST_FORMAT.md）。如果需要处理其他格式的网表（如LEF\u002FDEF或Bookshelf），可以先将其转换为protocol buffer格式。请参阅我们的[快速入门指南](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training#QuickStart)，其中提供了一个在开源RISC-V Ariane CPU上使用此格式的示例。\n\n#### 为什么我们声称“快速芯片设计”，而RL却比解析式求解器慢？\n\n当我们说“快速”时，指的是我们的方法确实能帮助芯片设计师更快地完成工作，而不是指我们的算法本身运行得很快。我们的方法可以在数小时内完成人类芯片设计师需要数周甚至数月才能完成的任务。\n\n如果一个解析式方法专注于优化布线长度并在约1分钟内得出结果，显然比数小时的RL优化要快；然而，如果该结果不符合设计规范，导致物理设计专家不得不花费数周时间在循环中使用商业EDA工具进一步迭代，那么从实际意义上看，这并不算更快。\n\n#### 在我们的《自然》实验中，为什么我们报告QoR指标而不是单独的布线长度？\n\n我们的目标是开发能够帮助芯片设计师更好、更快地完成工作的方法。因此，我们在论文中的实验设计尽可能贴近真实的生产环境，并报告QoR（结果质量）指标。\n\n使用商业EDA工具生成QoR指标可能需要长达72小时，但它们是对所有关键指标的高度准确测量，包括布线长度、水平\u002F垂直拥塞、时序（TNS和WNS）、功耗和面积等。QoR指标最接近物理上的真实情况，也是生产芯片设计团队决定将哪些布局送入制造环节的依据。相比之下，诸如近似布线长度和拥塞程度之类的代理成本虽然可以廉价计算，且对优化过程有所帮助，但由于与QoR可能存在较大差异，因此不能用于实际决策。\n\n此外，值得注意的是，布线长度和路由拥塞之间存在直接的权衡关系（例如，将节点彼此靠近放置会增加拥塞，但会减少布线长度），因此仅针对布线长度进行优化或评估，很难得到可制造的芯片布局。\n\n#### 在我们的《自然》实验中，我们是否对RL结果进行了任何后处理？\n\n没有。在《自然》实验中，我们并未对RL结果进行任何后处理。\n\n在我们的开源代码中，我们提供了一个可选的1至5分钟的坐标下降后处理步骤，我们发现这一步骤可以略微改善布线长度。您可以使用标志来选择是否启用此步骤，并比较有无该步骤时的性能差异。\n\n#### 这段代码的开源流程是怎样的？\n\n将代码开源的过程涉及与谷歌内部的另一个团队（[TF-Agents](https:\u002F\u002Fwww.tensorflow.org\u002Fagents)）的合作。TF-Agents首先使用我们的代码库复现了《自然》论文中的结果，随后他们重新实现了我们的方法，并用他们自己的实现再次复现了结果，最后将他们的实现开源，因为该实现不依赖于任何内部基础设施。\n\n获得开源这段代码的批准、确保符合出口管制限制、迁移到TensorFlow 2.x版本，并移除所有对谷歌内部基础设施的依赖，整个过程相当耗时；但我们认为，为了能够与社区分享我们的方法，这一切都是值得的。\n\n\u003Ca id='Contributing'>\u003C\u002Fa>\n\n## 如何贡献\n\n我们非常期待与您的合作！请参阅[CONTRIBUTING](CONTRIBUTING.md)，了解如何参与贡献的指南。本项目遵循TensorFlow的[行为准则](CODE_OF_CONDUCT.md)。参与本项目的人员均应遵守该行为准则。\n\n\u003Ca id='Principles'>\u003C\u002Fa>\n\n## 原则\n\n本项目遵循[谷歌的AI原则](PRINCIPLES.md)。参与、使用或贡献本项目的人士均应遵守这些原则。\n\n\u003Ca id='Contributors'>\u003C\u002Fa>\n\n## 主要贡献者\n\n我们谨向以下各位致以感谢，感谢他们为 AlphaChip 库的发布所作出的代码贡献、讨论及其他工作。\n\n*   塞尔吉奥·瓜达拉马\n*   夏然\n*   埃布拉欣·松戈里\n*   乔·蒋\n*   托比·博伊德\n*   阿扎莉娅·米尔霍赛尼\n*   安娜·戈尔迪\n*   穆斯塔法·亚兹甘\n*   沈王\n*   特伦斯·谭\n*   李荣俊\n*   罗杰·卡彭特\n*   阮秋\n*   埃德·奇\n\n\u003Ca id='Citation'>\u003C\u002Fa>\n\n## 如何引用\n\n如果您使用了本代码，请同时引用以下两篇文献：\n\n```\n@article{mirhoseini2021graph,\n  title={A graph placement methodology for fast chip design},\n  author={Mirhoseini*, Azalia and Goldie*, Anna and Yazgan, Mustafa and Jiang, Joe\n  Wenjie and Songhori, Ebrahim and Wang, Shen and Lee, Young-Joon and Johnson,\n  Eric and Pathak, Omkar and Nazi, Azade and Pak, Jiwoo and Tong, Andy and\n  Srinivasa, Kavya and Hang, William and Tuncer, Emre and V. Le, Quoc and\n  Laudon, James and Ho, Richard and Carpenter, Roger and Dean, Jeff},\n  journal={Nature},\n  volume={594},\n  number={7862},\n  pages={207--212},\n  year={2021},\n  publisher={Nature Publishing Group}\n}\n```\n\n```\n@misc{CircuitTraining2021,\n  title = {{Circuit Training}: An open-source framework for generating chip\n  floor plans with distributed deep reinforcement learning.},\n  author = {Guadarrama, Sergio and Yue, Summer and Boyd, Toby and Jiang, Joe\n  Wenjie and Songhori, Ebrahim and Tam, Terence, Goldie, Anna and Mirhoseini,\n  Azalia},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fgoogle_research\u002Fcircuit_training}},\n  url = \"https:\u002F\u002Fgithub.com\u002Fgoogle_research\u002Fcircuit_training\",\n  year = 2021,\n  note = \"[Online; accessed 21-December-2021]\"\n}\n```\n\n此外，如果您使用了开源检查点，请一并引用：\n\n```\n@misc{AlphaChipCheckpoint2024,\n  title = {A Pre-Trained Checkpoint for {AlphaChip}},\n  author = {Jiang, Joe Wenjie and Songhori, Ebrahim and Mirhoseini, Azalia and\n  Goldie, Anna and Guadarrama, Sergio and Yue, Summer and\n  Boyd, Toby and Tam, Terence, and Wu, Guanhang and Lee, Kuang-Huei and\n  Zhuang, Vincent and Yazgan, Mustafa and and Wang, Shen and Lee, Young-Joon and\n  Johnson, Eric and Pathak, Omkar and Nazi, Azade and Pak, Jiwoo and\n  Tong, Andy and Srinivasa, Kavya and Hang, William and Tuncer, Emre and\n  V. Le, Quoc and Laudon, James and Ho, Richard and Carpenter, Roger and\n  Dean, Jeff},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002F?tab=readme-ov-file#PreTrainedModelCheckpoint}},\n  url = \"https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002F?tab=readme-ov-file#PreTrainedModelCheckpoint\",\n  year = 2024,\n  note = \"[Online; accessed 25-September-2024]\"\n}\n```\n\n\u003Ca id='Disclaimer'>\u003C\u002Fa>\n\n## 免责声明\n\n本项目并非 Google 的官方产品。","# AlphaChip (circuit_training) 快速上手指南\n\nAlphaChip 是一个基于分布式深度强化学习的开源框架，用于生成芯片布局（Floorplanning）。它复现了发表在《Nature》2021 年的研究成果，能够处理包含数百个宏模块和数百万个标准单元的网表。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: 仅支持 **Linux** (推荐 Ubuntu 20.04)。\n*   **Python 版本**: Python 3.9 或更高版本 (Docker 镜像默认使用 Python 3.9)。\n*   **硬件**: 支持多 GPU 分布式训练。\n*   **依赖工具**: Git, Docker (强烈推荐使用 Docker 方式安装), CUDA (如需 GPU 加速)。\n\n> **注意**: 本项目目前不提供 PyPi 安装包，建议通过源码或 Docker 运行。\n\n## 安装步骤\n\n推荐使用 **Docker** 方式进行安装，这是最干净且依赖冲突最少的方法。以下以稳定版（Stable, v0.0.4）为例。\n\n### 1. 克隆代码库并设置环境变量\n\n```bash\nexport CT_VERSION=0.0.4\nexport PYTHON_VERSION=python3.9\nexport DREAMPLACE_PATTERN=dreamplace_20231214_c5a83e5_${PYTHON_VERSION}.tar.gz\nexport TF_AGENTS_PIP_VERSION=tf-agents[reverb]\n\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training.git\ncd circuit_training\ngit checkout r${CT_VERSION}\n```\n\n### 2. 构建 Docker 镜像\n\n在项目根目录下执行以下命令构建包含所有依赖（TF-Agents, DREAMPlace 等）的镜像：\n\n```bash\nexport REPO_ROOT=$(pwd)\n\ndocker build --pull --no-cache --tag circuit_training:core \\\n    --build-arg tf_agents_version=\"${TF_AGENTS_PIP_VERSION}\" \\\n    --build-arg dreamplace_version=\"${DREAMPLACE_PATTERN}\" \\\n    --build-arg placement_cost_binary=\"plc_wrapper_main_${CT_VERSION}\" \\\n    -f \"${REPO_ROOT}\"\u002Ftools\u002Fdocker\u002Fubuntu_circuit_training ${REPO_ROOT}\u002Ftools\u002Fdocker\u002F\n```\n\n### 3. 验证安装 (端到端测试)\n\n运行一个简单的烟雾测试（Smoke Test）来验证环境是否配置正确。该过程大约需要 10-20 分钟。\n\n```bash\nmkdir -p ${REPO_ROOT}\u002Flogs\ndocker run --rm -v ${REPO_ROOT}:\u002Fworkspace --workdir \u002Fworkspace circuit_training:core \\\n    bash tools\u002Fe2e_smoke_test.sh --root_dir \u002Fworkspace\u002Flogs\n```\n\n如果测试成功完成且无报错，说明安装成功。\n\n---\n\n## 基本使用\n\nAlphaChip 的核心流程通常包括：网表预处理（聚类）、强化学习训练、以及布局评估。以下是最简化的使用逻辑示例（需在 Docker 容器内或配置好本地环境变量后执行）。\n\n### 1. 准备网表数据\nAlphaChip 接受特定的 Netlist Protocol Buffer 格式。如果您拥有 LEF\u002FDEF 或 Bookshelf 格式的网表，可以使用 [TILOS-AI-Institute](https:\u002F\u002Fgithub.com\u002FTILOS-AI-Institute\u002FMacroPlacement\u002Ftree\u002Fmain\u002FCodeElements\u002FFormatTranslators) 提供的脚本进行转换。\n\n对于内置的示例网表，框架会自动处理聚类（Grouping）：\n```python\nfrom circuit_training.grouping import grouping_lib\n\n# 示例：对网表进行聚类处理\n# input_netlist: 输入网表路径\n# output_dir: 输出目录\ngrouping_lib.cluster_netlist(input_netlist, output_dir)\n```\n\n### 2. 启动训练\n使用 TF-Agents 启动分布式训练。以下是一个简化的训练启动脚本示例：\n\n```bash\n# 定义根目录和实验名称\nROOT_DIR=\"\u002Fworkspace\u002Flogs\u002Fmy_experiment\"\n\n# 运行训练脚本 (示例命令，具体参数需根据网表调整)\npython circuit_training\u002Flearning\u002Ftrain.py \\\n    --root_dir=${ROOT_DIR} \\\n    --netlist_file=\u002Fpath\u002Fto\u002Fclustered\u002Fnetlist.pb.txt \\\n    --num_iterations=1000 \\\n    --collectors_per_worker=1 \\\n    --eval_steps=10\n```\n\n### 3. 加载预训练模型 (可选)\n如果您希望直接使用预训练权重进行推理或微调，可以下载官方 Checkpoint 并在代码中加载：\n\n```python\nfrom circuit_training.learning import agent\n\n# 初始化 Agent 并加载检查点\ncheckpoint_path = \"\u002Fpath\u002Fto\u002Fpretrained\u002Fcheckpoint\"\nagent.load_checkpoint(checkpoint_path)\n\n# 执行布局生成\nfinal_placement = agent.generate_floorplan(netlist_data)\n```\n\n生成的布局结果通常包含宏模块的位置坐标和方向信息，可进一步转换为 DEF 文件以便在 EDA 工具中查看。","某半导体初创公司的物理设计团队正面临一款新一代 AI 加速器芯片的布局挑战，该芯片包含数百个大型宏模块和数百万个标准单元，需在极短周期内完成高质量版图规划。\n\n### 没有 circuit_training 时\n- 资深工程师需花费数周时间手动调整宏模块位置与方向，反复试错以平衡线长和拥塞度，效率极低且高度依赖个人经验。\n- 传统启发式算法难以同时优化线长、密度和拥塞等多个冲突目标，往往顾此失彼，导致后期时序收敛困难。\n- 面对复杂的宏模块间距约束和固定模块限制，人工规则检查耗时费力，极易遗漏设计规则违规（DRC）风险。\n- 每次设计迭代都需要重新运行耗时的全局布线估算，无法快速反馈不同布局方案对最终性能的影响。\n- 团队缺乏可扩展的分布式训练能力，无法利用多 GPU 集群加速探索更优的布局策略，错失设计窗口期。\n\n### 使用 circuit_training 后\n- circuit_training 利用深度强化学习在数小时内自动生成宏模块的最佳位置和翻转方向，将原本数周的人工迭代压缩至天级别。\n- 框架原生支持多目标联合优化，生成的布局方案在线长、拥塞度和密度指标上均达到帕累托最优，显著提升了时序收敛成功率。\n- 自动处理宏模块间及边界间距约束，内置的网格对齐功能完美模拟时钟带状区域，从源头规避了潜在的物理设计违规。\n- 集成 DREAMPlace 进行标准单元快速放置，结合分布式数据收集，能在分钟级内评估数百种布局变体，实现即时设计反馈。\n- 借助其分布式训练架构，团队轻松调动上百个 Actor 节点并行探索解空间，大幅提升了在复杂网表上的搜索效率和方案质量。\n\ncircuit_training 将芯片布局从依赖专家经验的“手工艺”转变为数据驱动的自动化流程，极大地缩短了高性能芯片的研发周期。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle-research_circuit_training_b1bb790f.png","google-research","Google Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fgoogle-research_c23b2adf.png","","https:\u002F\u002Fresearch.google","https:\u002F\u002Fgithub.com\u002Fgoogle-research",[79,83],{"name":80,"color":81,"percentage":82},"Python","#3572A5",98.4,{"name":84,"color":85,"percentage":86},"Shell","#89e051",1.6,1640,260,"2026-04-16T05:35:04","Apache-2.0",4,"Linux","支持多 GPU 分布式训练（具体型号和显存未说明，但需支持 TensorFlow 2.x 及 CUDA）","未说明",{"notes":96,"python":97,"dependencies":98},"1. 该工具仅支持基于 Linux 的操作系统，不支持 macOS 或 Windows。\n2. 核心依赖 DREAMPlace 未提供 PyPi 包，通常需要从源码编译或使用项目提供的针对 Ubuntu 20.04 构建的预编译二进制文件。\n3. 需要手动下载并配置放置成本二进制文件 (plc_wrapper_main) 到系统路径。\n4. 推荐使用 Docker 进行部署以避免环境依赖问题。\n5. 若使用本地安装，需正确设置 PYTHONPATH 以包含 DREAMPlace 路径。","3.9, 3.10, 3.11 (Docker 镜像仅支持 Python 3.9)",[99,100,101,102,103],"TensorFlow 2.x","TF-Agents (稳定版或 nightly 版)","Reverb","tf-keras","DREAMPlace (需编译或使用预编译二进制)",[14,105],"其他","2026-03-27T02:49:30.150509","2026-04-17T09:53:29.582964",[109,114,119,124,129,133],{"id":110,"question_zh":111,"answer_zh":112,"source_url":113},36589,"如何支持 LEF\u002FDEF 文件格式的输入？","目前项目内部不直接使用 LEF\u002FDEF 格式，而是使用 Netlist Protocol Buffer (protobuf) 格式。TILOS-AI-Institute 提供了一个脚本可以将 LEF\u002FDEF 和 Bookshelf 转换为该项目使用的 protobuf 格式。此外，项目组正在与第三方供应商合作发布用于从内部工具导出到 protobuf 的 TCL 脚本，但尚未公开。用户需要先将网表转换为文档中描述的 protobuf 结构才能进行训练或分组（clustering）。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fissues\u002F3",{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},36590,"运行训练脚本时遇到 'PPOLossInfo' object has no attribute 'clip_fraction' 错误怎么办？","该错误通常是由于 tf-agents 版本不兼容导致的。解决方案是使用 `tf-agents-nightly` 版本而不是稳定的发行版。维护者已更新 Docker 构建说明以包含此依赖项，并修复了相关的类型提示问题。请确保在 Docker 环境或本地环境中安装正确的 nightly 版本。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fissues\u002F31",{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},36591,"Docker 冒烟测试失败，报错 'PlaceDB' object has no attribute 'flatten_nested_map' 如何解决？","这是由于 DREAMPlace 二进制文件版本或集成问题导致的。维护者已经推送了新的 DREAMPlace 二进制文件，并强制在端到端测试中使用 DREAMPlace。同时修复了 `train_ppo` 和 `collect_ppo` 脚本中 DreamPlace 参数未正确传递的问题。用户应拉取最新代码并使用提供的端到端冒烟测试脚本进行验证，或者更新 Docker 镜像以使用正确的分支。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fissues\u002F52",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},36592,"运行 DREAMPlace 时出现 'module 'dreamplace.Params' has no attribute 'get_dreamplace_params'' 错误？","这是因为使用了不兼容的 DREAMPlace 版本。Circuit Training 需要特定修改版的 DREAMPlace。解决方法是克隆 Circuit Training 项目中指定的 DREAMPlace 分支。如果仍然遇到 numpy 浮点类型相关错误，可以尝试修改 `circuit_training\u002Fdreamplace\u002Fplc_converter.py` 第 467 行，将数据类型显式改为 `float64`。另外，有用户反馈注释掉 DREAMPlace 源码 `PlaceDB.py` 中的某行代码（涉及 C++ 数据库更新）也能解决部分运行问题。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fcircuit_training\u002Fissues\u002F46",{"id":130,"question_zh":131,"answer_zh":132,"source_url":113},36593,"Circuit Training 支持的网表输入格式是什么？","主要输入格式是 Netlist Protocol Buffer (protobuf)。文档中详细描述了该格式的结构。虽然社区提供了将 LEF\u002FDEF 和 Bookshelf 格式转换为 protobuf 的工具，但原生流程仅接受 protobuf 格式的网表文件。在进行宏分组（grouping\u002Fclustering）等操作前，必须确保网表已转换为此格式。",{"id":134,"question_zh":135,"answer_zh":136,"source_url":118},36594,"如何在 Docker 容器中调试长时间运行的训练任务？","维护者在 Docker 镜像中添加了 `tmux` 工具（仅增加 1.2MB），以便用户可以在容器内分离会话。这对于调试或在断开 SSH 连接后继续监控训练非常有用。用户可以通过安装包含此更新的 Docker 镜像，并在容器内使用 `tmux` 来管理训练进程。",[]]