はじめに
Google が AlphaChip! を発表しました。
Welcome, AlphaChip!
— Jeff Dean (@🏡) (@JeffDean) 2024年9月26日
Today, we are sharing some exciting updates on our work published in @Nature in 2021 on using reinforcement learning for ASIC chip floorplanning and layout. We’re also naming this work AlphaChip.
Since we first published this work, our use of this approach… https://t.co/PwIJQMA68P pic.twitter.com/aHrkzxGXwt
2021年に nature にて発表した
のアップグレードのようです。
ソースコードも公開されたので、ちょっと覗いてみました。。。
AlphaChip!
Nature の論文
Google Blog
checkpoint
dreamplace
ソースコードの中の、「dreamplace」なるものを見つけました。
SoftMacroPlacer クラスがあって、
class SoftMacroPlacer: """A soft macro placer using Dreamplace."""
optimize_using_dreamplace 関数の中で、SoftMacroPlacer クラスを読んでいます。
def optimize_using_dreamplace( plc, params, output_dir=None, hard_macro_movable=False ): """Optimzes using Dreamplace.""" # Initialization, slow but only happens once. start_init_time = time.time() placer = SoftMacroPlacer(plc, params, enable_timeout=False) if hard_macro_movable: placer.placedb_plc.update_num_non_movable_macros( plc, num_non_movable_macros=0 )
SoftPlacer の place 関数を呼んでいます。
# Dreamplace optimzation. start_opt_time = time.time() placer.place() logging.info( 'Dreamplace optimization took %g seconds.', time.time() - start_opt_time )
結果の書き出し。
# Write the optimized stdcell location back to the plc. This step may be # omitted if the Dreamplace reported density can be used in our cost function # directly. start_write_time = time.time() placer.placedb_plc.write_movable_locations_to_plc(plc)
optimize_using_dreamplace 関数は、dreamplace_main.py の main 関数で呼ばれています。
def main(argv): if len(argv) > 1: raise app.UsageError('Too many command-line arguments.') random.seed(_SEED.value) np.random.seed(_SEED.value) torch.manual_seed(_SEED.value) # NOTE(hqzhu): pass args of netlist info to load_plc instead of using flags. plc = dreamplace_util.load_plc( netlist_file=_NETLIST_FILE.value, output_dir=_OUTPUT_DIR.value, init_placement=_INIT_PLACEMENT.value, ) canvas_width, canvas_height = plc.get_canvas_width_height() regioning = plc.has_area_constraint() dp_params = dreamplace_util.get_dreamplace_params( canvas_width=canvas_width, canvas_height=canvas_height, regioning=regioning, gpu=_DP_GPU.value, ) if _DP_GPU.value: torch.cuda.init() dreamplace_core.optimize_using_dreamplace( plc, dp_params, _OUTPUT_DIR.value, _DP_HARD_MACRO_MOVABLE.value )
下記の部分でネットリストを読み込んでいます。
plc = dreamplace_util.load_plc(
netlist_file=_NETLIST_FILE.value,
output_dir=_OUTPUT_DIR.value,
init_placement=_INIT_PLACEMENT.value,
)
load_plc 関数は、下記のようになっています。
def load_plc(netlist_file, output_dir, init_placement=None): """Loads the netlist and initial plc.""" t = time.time() plc = util.create_placement_cost( netlist_file=netlist_file, init_placement=init_placement ) duration = time.time() - t print_and_save_result( plc, duration, 'Loading initial PLC', 'dreamplace_initial', output_dir ) return plc
create_placement_cost 関数の中で、ネットリストからコストモデルを生成していますね。
# The routing capacities are calculated based on the public information about # 7nm technology (https://en.wikichip.org/wiki/7_nm_lithography_process) # with an arbitrary, yet reasonable, assumption of 18% of the tracks for # the power grids. @gin.configurable def create_placement_cost(
Circuit Training Netlist Representation
Netlist の表現としては、
というドキュメントがあります。
おわりに
AlphaChip!
ソースコードが公開されているので、もうちょっと追い込むと何かが分かるかもしれませんね。