SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Xingbo Du, Chonghua Wang, Ruizhe Zhong, Junchi Yan*
Dept. of Computer Science and Engineering & MoE Key Lab of AI, Shanghai Jiao Tong University {duxingbo, philipwang, zerzerzerz271828, yanjunchi}@sjtu.edu.cn
Global Routing (GR) is a core yet time-consuming task in VLSI systems. It recently attracted efforts from the machine learning community, especially generative models, but they suffer from the non-connectivity of generated routes. We argue that the inherent non-connectivity can harm the advantage of its one-shot generation and has to be post-processed by traditional approaches. Thus, we propose a novel definition, called hub, which represents the key point in the route. Equipped with hubs, global routing is transferred from a pin-pin connection problem to a hub-pin connection problem. Specifically, to generate definitely-connected routes, this paper proposes a two-phase learning scheme named HubRouter, which includes 1) hub-generation phase: A condition-guided hub generator using deep generative models; 2) pin-hub-connection phase: An RSMT construction module that connects the hubs and pins using an actor-critic model. In the first phase, we incorporate typical generative models into a multi-task learning framework to perform hub generation and address the impact of sensitive noise points with stripe mask learning. During the second phase, HubRouter employs an actor-critic model to finish the routing, which is efficient and has very slight errors. Experiments on simulated and real-world global routing benchmarks are performed to show our approach's efficiency, particularly HubRouter outperforms the state-of-the-art generative global routing methods in wirelength, overflow, and running time. Moreover, HubRouter also shows strength in other applications, such as RSMT construction and interactive path replanning.
As the scale of integrated circuits (ICs) increases rapidly, the quality and efficiency of current Electronic Design Automation (EDA) technologies are being ceaselessly challenged. Among the various tasks from logic synthesis [50] to placement and routing [7], global routing (GR) [8, 24, 36, 43, 31, 35, 6, 48] is one of the complex and time-consuming combinatorial problems in modern Very Large Scale Integration (VLSI) design. As a posterior step of component placement, it generates routing paths to interconnect pins of IC components from a netlist, which are already placed on the physical layout [6]. The objective of global routing is basically to minimize total wirelength while avoiding congestion in the final layout<sup>2</sup>. However, even its simplified 'two-pin' case (see Fig. 8 in Appendix C for illustration) that routes every net with only two pins under design constraints turns out to be an NP-complete problem [27].
*Correspondence author. This work was partly supported by China Key Research and Development Program (2020AAA0107600), NSFC (62222607) and SJTU Scientific and Technological Innovation Funds.
Another routing task called detailed routing [3] is orthogonal to this work. To our knowledge, there is so far no learning-related work on problems whose scale is even much larger than global routing (see example in [6]).
Figure 1: Example of an unconnected route. Up: Original route; Down: Generated route.
Table 1: Characteristics of global routing approaches. Classical and RL-based methods generally transfer routing into 2-pin problems. In particular, [31] is highly sensitive to chip scales. The generative model PRNet can generate each route in one-shot but cannot guarantee connectivity which requires considerable post-processing for failed routes. HubRouter in this paper has all the advantages of PRNet and in particular ensures connectivity.
Model	Type	Multi-pin	Connectivity	Scalability
BoxRouter [8]	Classical	X	✓	X
DRL [31]	RL	X	✓	X
PRNet [6]	Generative	✓	X	Δ*
HubRouter (ours)	Generative	✓	✓	✓
* Scalable for one-shot generation, but not scalable for post-processing.
Traditional works [8, 24, 36, 43] adopt (strong) heuristics to greedily solve global routing. However, the diversity and scale could pose new challenges to classical algorithms, which call for strategy updating and improvement by human experts on a continuous basis. To mitigate the reliance on manual efforts and facilitate the overall design automation and quality, machine learning has been adopted for global routing, as one of its diverse applications in chip design ranging from logic synthesis [40, 39] to placement [32, 28], etc. Specifically, deep reinforcement learning (DRL) [31, 35] and generative models [48] have been adopted to tackle global routing (sometimes also along with other tasks, e.g., placement [6] in the design pipeline). However, DRL methods suffer from large state space and often need to spend enormous time on generating routes as the scale of grids increases on the test instance, i.e., the netlist, which is practically intimidating for real-world global routing. The generative approaches can be more computationally tractable due to the potential one-shot generation capability and train/test the model on different instances. In fact, the generative models have recently been adopted in different design tasks [5, 56] beyond EDA (partly) for its higher efficiency compared with the iterative RL-based decision-making procedure, while a common challenge is how to effectively incorporate the rules and constraints in the generative models. However, though generative global routing approaches [6] inject connectivity constraints into the training objective, they often degenerate to an exhaustive search in post-processing when the generated initial routes fail to satisfy connectivity, as shown in Fig. 1. Our experimental results will show that the routes for difficult nets have a very low average connectivity rate of less than  $20\%$ , which means that over  $80\%$  generated routes for difficult nets require time-consuming post-processing. This greatly harms the inference time and indicates a serious challenge for the routing problem.
To address this intractable issue, our main idea is to propose a novel definition, 'hub', which means the (virtual) key point in the route. By transferring the pin-pin connection problem to the hub-pin connection problem, situations where routes are unconnected in generative approaches can be avoided.
Specifically, we propose a novel two-phase learning scheme for global routing, named HubRouter, which includes 1) hub-generation phase: A condition-guided hub generator using deep generative models under a multi-task learning framework; 2) pin-hub-connection phase: A post-processing rectilinear Steiner minimum tree (RSMT) construction module that links the hubs using an actor-critic model. In the generation phase, hubs, routes, and stripe masks (a practical module as illustrated in Sec. 3.1) are together generated under a multi-task framework by generative models with optional choices, including Generative Adversarial Nets (GAN) [11], Variational Auto-Encoder (VAE) [26], and Diffusion Probabilistic Models (DPM) [16]. Though only hubs are required as outputs in this phase, we find it helpful to simultaneously generate routes and stripe masks together with hubs, where routes are used to obtain the local perception and stripe masks are capable of removing noise points. In the connection phase, we regard the connection of generated hubs as an RSMT construction problem, which is NP-complete [10]. Equipped with an actor-critic model [47], this phase can be conducted in a more scalable way [33] with very slight errors. We also introduce a special case that when hubs in the first phase are correctly generated for an RSMT route, its reconstruction time complexity can be reduced to  $O(n \log n)$ , which shows the scalability potential of HubRouter.
With this two-phase learning scheme, the proposed HubRouter enforces all generated routes to be connected and save the post-processing time in generative approaches [6]. Apart from the strength in global routing, HubRouter is of generality to deal with other applications. We evaluate HubRouter in
(a) Chip Canvas.
(b) Grid Graph.
(c) Condition.
Figure 2: Diagrams of a) chip canvas; b) grid graph; c) condition image, with pin positions and capacity; d) route, and examples of 4 types of hubs; e) all hubs generated from d).
(d) Route.
(e) Hub.
RSMT construction and interactive path replanning. Table 1 compares different routing methods and the highlights of this paper are:
1) We empirically show that the recent generative global routing approaches could suffer from the inherent non-connectivity of generated routes. Inspired by this observation, this paper proposes a new concept, namely hub, which means a key point in the route. With hubs generated for each net, pins can be connected efficiently under connectivity assurance.
2) Equipped with the concept of hubs, we devise HubRouter, which is a novel two-phase learning scheme for global routing, including (virtual) hub generation and pin-hub connection. Compared with generating routes directly, this scheme ensures the connectivity of all generated routes by generating intermediate hubs and then connecting them with pins. The connectivity assurance alleviates the time-consuming post-processing.
3) In the generation phase, we introduce a condition-guided generative framework under the perspective of multi-task learning, where routes and stripe masks are generated together with hubs to improve hubs' generation quality. In the connection phase, we adopt an actor-critic network to effectively simulate the RSMT construction. Moreover, we illustrate that when hubs are correctly generated for an RSMT route, the reconstruction can be optionally performed in  $O(n \log n)$  time complexity.
4) Multiple experiments on simulated and real-world datasets are performed to illustrate the effectiveness of HubRouter. Especially, HubRouter ensures the connectivity of generated routes and outperforms the state-of-the-art generative global routing models in wirelength, overflow, and time. We also introduce two applications other than global routing to show the generality of HubRouter.
Global Routing. In VLSI design, global routing is a stage after placement, which determines the paths for nets and interconnects the pins on a chip layout. Typically, given a physical chip and a netlist, we have a chip canvas and several nets (see Fig. 2(a)), where each net includes some pins on the fixed positions decided by macro/standard cells in the previous placement process. In global routing, the chip canvas is further divided into rectangular tiles, where the tiles are formed into a grid graph  $\mathcal{G}(\mathcal{V},\mathcal{E})$  (see Fig. 2(b)). Nodes  $\mathcal{V} = \{v_{i}\}_{i = 1}^{|\mathcal{V}|}$ , also named global routing cells (GCells), represent the tiles and we need to link all the tiles that contain pins. The nodes containing pins are dyed dark red in Fig. 2(b). Edges  $\mathcal{E}$  represent the paths among adjacent nodes, where each edge  $e_{ij}\in \mathcal{E}$  has its given capacity  $c_{ij}$  and usage  $u_{ij}$ . The main objective of global routing is to connect all the required connections and on this basis, reduce the routing wirelength (WL) and overflow (OF). The overflow here refers to  $o_{ij} = \max (0,u_{ij} - c_{ij})$ , i.e., the exceeded number of routes compared to the given capacity on a tile.
Generative Global Routing. Actually, global routing is a combinatorial problem and can be formulated as a 0-1 integer linear programming (0-1 ILP) problem [4], but it is still NP-complete. Despite that various works [24, 8, 31] denote the layout of global routing as a routing graph, generative models [6] give a novel insight that regards the layout as an image and treats route generation as independent conditional image generation. Specifically, pixels are used to represent tiles in global routing, and a routing output image is generated from a given condition image. The condition image contains three channels, with the first channel being the locations of pins and the other two channels
Figure 3: Pipeline of the proposed two-phase scheme. 1) hub-generation phase: Route, hub, and mask are fed to three optional generative models, i.e., GAN, VAE, and DPM, with condition guided. The generated hub image is further masked by a stripe mask module; 2) pin-hub-connection phase: The hubs generated in the first phase are fed to an actor-critic network to obtain its RSMT construction by learning Rectilinear Edge Sequence (RES), and finally the connected route is obtained.
being the capacity of horizontal/vertical grid edges. The routing image is a grayscale image with a value of 255 representing routed and 0 representing unrouted. Examples of condition and routing images are respectively shown in Fig. 2(c) and 2(d).
Hub. Fig. 2(d) also introduces hubs, the main concept proposed in this paper, with 4 different types, which can be vividly represented as  $\langle +, \top, \bot, \cdot \rangle$ . Formally, we have
Definition 1 (Hub). Given a one-channel image with  $m \times n$  pixels, let  $p_{ij}$  ( $1 \leq i \leq m, 1 \leq j \leq n$ ) denote the pixel in the  $i$ -th row and  $j$ -th column, whose value  $r_{ij} = 1/0$  respectively represent routed/unrouted. Auxiliary denote  $r_{0j} = r_{(m+1)j} = r_{i0} = r_{i(n+1)} = 0$ , then the pixel  $p_{ij}$  is a hub if and only if  $r_{ij} = 1$  and it satisfies any of the following condition:
(1)  $+r_{(i - 1)j} = r_{(i + 1)j} = r_{i(j - 1)} = r_{i(j + 1)} = 1;$
(2)  $\top : r_{(i-1)j} + r_{(i+1)j} + r_{i(j-1)} + r_{i(j+1)} = 3$ ;
(3)  $\begin{array}{r}\sqcup :r_{(i - 1)j} + r_{(i + 1)j} = 1 \end{array}$  and  $r_{i(j - 1)} + r_{i(j + 1)} = 1$
(4)  $\cdot :r_{(i - 1)j} + r_{(i + 1)j} + r_{i(j - 1)} + r_{i(j + 1)} = 1.$
This means that any routed pixel is a hub unless it has exactly two opposite routed neighbor pixels. In Fig. 2(e), we give an example of all the hubs generated from Fig. 2(d).
Difference between Hubs and Steiner Points. The intuition of hubs is similar to the concept of Rectilinear Steiner Point (RSP) [21], but we claim that there are essential differences between them. RSPs are searched for a global minimum total distance, while hubs are used to determine a path. Obviously, RSPs are special cases of hubs, and hubs can generate paths of different shapes at will (not only the shortest). Furthermore, traditional approaches can obtain hubs only after accomplishing the routing, while the characteristics of machine-learning approaches naturally give them the capability of learning such hubs. We envision that HubRouter has more applications compared with RSPs. To show this, we also conduct some applications, including RSMT construction and interactive path replanning in Sec. 4.4. Related works in this work are presented in Appendix A.
3 From Pin-Pin to Hub-Pin Connection: A Two-phase Routing Scheme
Approach Overview. We formulate global routing as a two-phase learning model. The first phase is called the hub-generation phase, where we approximate the conditional distribution  $p_{\theta}(\mathbf{x}|\mathbf{z},\mathbf{c})$  to the prior distribution  $p(\mathbf{x}|\mathbf{c})$  when given  $\mathbf{z}\sim p_{\mathbf{z}}(\mathbf{z})$  and condition  $\mathbf{c}$ . Here  $\mathbf{z}$  is a latent variable from a prior distribution (usually assumed as Gaussian distribution) while  $\mathbf{c}$  and  $\mathbf{x}$  are respectively condition and input images (route, extracted hubs, and stripe mask). The second phase is called the pin-hub-connection phase, where we link the hubs generated in the first phase to obtain the final route.
(a) Route Sample.
(b) Generated Hub.
(c) Bad Connected Route.
(d) Stripe Mask Control.
Figure 4: Illustration of how the stripe mask alleviates the noise impact. (a) A route sample. (b) The generated hubs, where the black/blue points are respectively hubs/noises. The gray stripes are generated masks. (c) Without the stripe mask, the route will be lengthened by some wrong and redundant paths (blue). (d) Two paths with the same length scheduled by the stripe mask.
This process can be treated as RSMT construction, and we follow REST [33] to use an RL-based algorithm to finish the routing. We respectively introduce these two phases in Sec. 3.1 and Sec. 3.2. In the generation phase, we also propose a multi-task learning framework to improve the quality of generated hubs, especially a novel stripe mask learning method is proposed to alleviate the negative effects caused by noise points cases. The overall algorithm is in Appendix B.
3.1 Hub-generation Phase: Multi-task Learning of Hub, Mask, and Unused Pre-Routing
Hub generation can be formulated as an image-to-image task because the prior distribution  $p(\mathbf{x}|\mathbf{c})$  is given from training dataset  $\{\mathbf{x}_i,\mathbf{c}_i\}_{i = 1}^N$  with  $N$  samples, where  $N$  denotes the total number of nets for training. So, it seems that we can learn a distribution  $p_{\psi}(\mathbf{x}|\mathbf{c})$  and can generate  $\mathbf{x}'\sim p_{\psi}(\mathbf{x}|\mathbf{c} = \mathbf{c}')$  given a new condition  $\mathbf{c}'$  out of the training dataset. However, since the results of hub generation are not unique, a generative probabilistic distribution  $p_{\theta}(\mathbf{x}|\mathbf{z},\mathbf{c})$  conditioned on  $\mathbf{c}$  can better describe the routing. The main objective of hub generation is to minimize the difference between probability distributions  $p(\mathbf{x}|\mathbf{c})$  and  $p_{\theta}(\mathbf{x}|\mathbf{z},\mathbf{c})$  while it often differs in expression under different perspectives. With the help of the rapid development of deep generative models, various works give us optional choices to address hub generation. In Appendix B, we respectively introduce how to incorporate GAN [11, 37], VAE [26, 44], and DPM [16, 17] into our generative framework.
Note that PRNet [6] has a similar generation model structure to ours, yet we fall into different plights. PRNet employs a bi-discriminator [54] in CGAN [37] to inject the connectivity constraints into the training objective. This constraint indeed works and increases the correctness (all pins are connected within one route) rate by over  $10\%$ , but it is almost useless for complicated cases, as will further be discussed in Sec. 4.2. Under our two-phase learning scheme, the connectivity can be guaranteed, but the generated noise points have a more negative impact on the final results. Thus, we propose a multi-task learning framework in the following to handle this potential weakness.
We claim that hub generation is highly different from other image generation missions because subtle noises can hardly affect their generation quality. When generating hubs, a noise point, especially the outermost one, can largely harm the wirelength of routing. We show this challenging phenomenon in Fig. 4(b) and 4(c), where two noise points (blue) in Fig. 4(b) lead to a much longer route in Fig. 4(c) since all the generated hubs should be connected within one route in our scheme. As discussed in some other special generation tasks like layout generation [5], high reconstruction accuracy is typically maintained during training to ensure the generation is suitable for its requirement. Following this setting, we further devise a multi-task learning framework, whereby the input in Sec. 3.1 is defined as  $\mathbf{x} = \{\mathbf{x}^{(hub)},\mathbf{x}^{(rt)},\mathbf{x}^{(msk)}\}$  with three components, respectively hub, route, and mask. Note that although the hub generation is the main purpose in the first phase, we still generate routes and masks for auxiliary usages. In particular, the routes  $\mathbf{x}^{(rt)}$  are pre-routing results and are unused in the second phase, which is employed to better obtain the continuous local perception in CNN-based networks. We further propose a novel mask learning module named stripe mask to focus on bad cases for hub generation. Specifically, the stripe mask is defined as a matrix  $\mathbf{x}^{(msk)}\in \{0,1\}^{m\times n}$ , where  $\mathbf{x}_{ij}^{(msk)} = 1$  means there is a hub in the  $i$ -th row or  $j$ -th column; otherwise  $\mathbf{x}_{ij}^{(msk)} = 0$ . At inference
time, the generated hubs are masked by a binarized stripe mask  $\hat{\mathbf{x}}_{ij}^{(hub)} = \mathbf{x}_{ij}^{(hub)} \times \tilde{\mathbf{x}}_{ij}^{(msk)}$  with
$$
\tilde {\mathbf {x}} _ {i j} ^ {(m s k)} = \mathbb {I} \left[ \max  \left(\frac {1}{m} \sum_ {i = 1} ^ {m} \mathbf {x} _ {i j} ^ {(m s k)}, \frac {1}{n} \sum_ {j = 1} ^ {n} \mathbf {x} _ {i j} ^ {(m s k)}\right) > \frac {1}{2} \right], \tag {1}
$$
where  $\mathbb{I}[\cdot ]$  is an indicator function yielding  $1 / 0$  if the input is correct/wrong. Eq. 1 shows that unless the noises in vertical/horizontal lines are dense, the stripe mask will not be formed. Fig. 4(c) shows that, with the help of the stripe mask, the blue noise points can be masked, and the generated route can be shortened by removing the redundant (blue) paths. Empirically, an appropriate stripe mask can eliminate most of these noise points. The reasons why we use the stripe mask rather than other masks [46] are due to the characteristics of global routing: Compared with other generation tasks, 1) Noise points will greatly impact the routing quality, and the stripe mask learning can eliminate most of them; 2) the routing result is not required to be unique while the stripe mask module is capable of providing different choices of routing. As shown in Fig. 4(d), two black hubs can choose an arbitrary yellow point as a turning point to connect each other while the length of paths is the same.
3.2 Pin-hub-connection Phase: RSMT Construction
After the hub-generation phase, the hub points will be sent to the pin-hub-connection phase to link all the generated hubs and obtain the final route. In this phase, the connection process is regarded as a rectilinear Steiner minimum tree (RSMT) construction problem, which is proved to be NP-complete [10]. Note that it seems to be possible to directly use RSMT construction to perform global routing; however, we claim that the hub-generation phase is essential because 1) Without the generated hubs, RSMT construction can only find the shortest route and fail to generate an appropriate route under restriction; 2) A good hub-generation phase for RSMT route reconstruction can be reduced to  $O(n \log n)$ , as stated in the following theorem:
Remark 1. [Reconstruction Bonus] Suppose a set of hubs in an RSMT route is correctly generated, then its RSMT reconstruction can be performed in  $O(n \log n)$  time complexity.
We further illustrate it in Appendix C. Remark 1 introduces the optimal time complexity of the pin-hub-connection phase for the ideal cases. While without this strong assumption, we follow REST [33] to learn the Rectilinear edge sequence (RES) under an actor-critic neural network framework. Given a point set  $\mathcal{P} = \{(x_i,y_i)\}_{i = 1}^{|P|}$ , we want to get the RES, which is a sequence of  $|\mathcal{P}| - 1$  index pairs  $[(v_{1},h_{1}),\ldots ,(v_{|\mathcal{P}| - 1},h_{|\mathcal{P}| - 1})]$  and pair  $(v_{i},h_{i})$  means connecting point  $v_{i}$  and  $h_i$  with rectilinear edges. RES can be modeled as a sequential decision-making problem, so it is advantageous in RL. Note that the validity and existence of RES for the RSMT construction are already proved in REST.
As shown in Fig. 3, the actor network is used to create RES results with given coordinate points, while the critic network sets a baseline to predict the expected length of RSMT constructed by the actor network and guide the actor network to obtain better performance. According to the evaluation of the critic network, the actor network will update the policy to minimize the RSMT length. Specifically, the actor network is devised via an auto-encoder to learn better representations. We draw  $B$  point sets  $\bar{V} = \{V_1, V_2, \dots, V_B\}$ , and construct valid RES sets  $R^{(V_i)}$  for each point set  $V_i$ . The objective is to minimize the expected advantage of the RSMT as follows:
$$
\min  _ {\xi} \mathbb {E} _ {V _ {i} \sim \bar {V}, r _ {i} \sim R (V _ {i})} \left[ b _ {\zeta} \left(V _ {i}\right) - b \left(V _ {i}, r _ {i}\right) \right] p _ {\xi} \left(r _ {i}\right), \tag {2}
$$