Queue Allocation in Machine Learning Accelerators

JP2023546761A5Active Publication Date: 2024-08-23GOOGLE LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2022553686
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2020-12-29
Filing Date
2021-10-12
Publication Date
2024-08-23
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

In machine learning accelerator communication networks, data communication between computing units is non-deterministic due to variable latencies caused by heterogeneous link media, link lengths, and uneven traffic distribution, leading to communication bottlenecks and inefficiencies.

Method used

A method for memory allocation in machine learning accelerator communication networks that involves accessing metadata to determine expected latencies and packet counts for each port, dynamically allocating shared memory based on these factors, and adjusting queue sizes using application programming interfaces to optimize buffer queue utilization.

Benefits of technology

This approach enhances communication efficiency by avoiding bottlenecks and improving the performance of machine learning accelerators, allowing them to run faster and more efficiently by optimizing message buffer queues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

This disclosure generally provides solutions for improving the performance of custom-built packet-switched TPU accelerator-side communication networks. Specifically, a set of solutions is described for improving flow control behavior by tuning packet buffer queues in on-chip routers within distributed training supercomputer networks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Priority Claim This application claims the benefit of priority of U.S. Provisional Application No. 63 / 091,708, filed on October 14, 2020, under 35 U.S.C. § 119(e).

[0002] Technical Field This disclosure relates to the allocation of shared memory for traffic queuing in a machine learning accelerator communication network.

Background Art

[0003] Background An electronic device can be composed of a plurality of different computing units, and these computing units need to communicate data with each other for the electronic device to operate. The data communication between the computing units can be non-deterministic. For example, the data communication is subject to variable latency between the transmission time in one unit and the reception time in another unit. That is, the time it takes for data to move from one unit to another is not constant but is subject to many different sources of variation in the transmission time.

Summary of the Invention

[0004] Summary Generally, this disclosure includes a method for memory allocation in a machine learning accelerator communication network. Generally, the method includes accessing metadata associated with multiple communication ports of an application-specific integrated circuit (ASIC). The metadata identifies, for each port, whether a particular port is used in the current configuration and the communication medium associated with that particular port. Based on the metadata, an expected latency is determined for each port and a portion of shared memory is allocated to each port. Shared memory is allocated by allocating zero memory to unused ports, determining the memory allocation for each port based on the expected latency, and assigning start and end addresses of the shared memory to each port. Implementations may optionally include one or more of the following features:

[0005] In some implementations, assigning the start and end addresses of shared memory to each port involves calling an application programming interface (API) by a device other than the ASIC.

[0006] In some implementations, the process runs on an ASIC using a machine learning accelerator communication network and allocated shared memory. In some implementations, the process is to train a neural network.

[0007] In some implementations, the ASIC is a Tensor Processing Unit (TPU).

[0008] In some implementations, the communication medium identified in the metadata is a copper cable medium, an optical medium, a printed circuit board (PCB) medium, or any combination thereof.

[0009] In some implementations, memory is expressed as

[0010]

number

[0011] It will be allocated according to this. In an alternative implementation, the method for memory allocation in a machine learning accelerator communication network includes determining the network topology for the network of machine learning accelerator ASICs. Metadata associated with multiple communication ports of each ASIC in the network is accessed. For each of the multiple ports, the metadata identifies whether a particular port is used in the current configuration and the communication medium associated with that particular port. For each port used in the network topology, a round-trip time (RTT) delay is determined. A portion of shared memory is allocated to each of the multiple ports, and this allocation is performed by determining a memory allocation for each port that is proportional to the RTT delay, and assigning start and end addresses of the shared memory to each port for the determined memory allocation. A process of sending profiling traffic to the network for a predetermined duration is performed on the machine learning accelerator. For each port, the number of received traffic packets is determined, and the portion of the shared memory is reallocated to each port of the multiple ports. This reallocation is performed by determining a memory allocation for each port that is proportional to the number of packets received, and by reallocating the start and end addresses for each port in the determined memory allocation.

[0012] In some implementations, assigning and reallocating the start and end addresses of shared memory to each port involves calling an API by a device other than the ASIC.

[0013] In some implementations, the memory allocation, which is proportional to the RTT delay determined for each port, is given by the formula:

[0014]

number

[0015] It is determined according to the following. In some implementations, the memory allocation for each port is proportional to the number of packets received, as expressed by the formula

[0016]

number

[0017] It is determined according to the following. In some implementations, the RTT delay is calculated before execution by sending and receiving one or more timing messages to determine the latency.

[0018] In some implementations, profiling traffic includes all-to-all traffic, nearest neighbor traffic, a composite traffic profile, or any preferred combination thereof.

[0019] In an alternative implementation, the method for allocating memory for a machine learning accelerator communication network involves determining the network topology for the network of machine learning accelerator application-specific integrated circuits (ASICs). Metadata associated with multiple communication ports of each ASIC in the network is accessed. For each of the multiple ports, the metadata identifies whether a particular port is used in the current architecture and communication medium associated with that port. For each of the multiple ports, the metadata identifies whether a particular port is used in the current configuration and the communication medium associated with that port. A round-trip time (RTT) delay is determined for each port used in the network topology. A portion of shared memory is allocated to each of the multiple ports, and this allocation is performed by determining a memory allocation for each port that is proportional to the RTT delay, and then assigning start and end addresses of the shared memory to each port for the determined memory allocation. A process runs on the ASIC, and the process uses the machine learning accelerator communication network along with the allocated shared memory. During process execution, the number of message packets received at each port of the multiple ports is determined over a first period. Based on the number of message packets received at each port, a desired partial size of the shared memory is determined for each port of the multiple ports. During a second period, the process is paused, and it is determined whether the shared memory is clear for pending message packets. If it is determined that the shared memory is clear, the start and end addresses of the shared memory are reallocated for each port according to the desired partial size, and process execution resumes.

[0020] Various implementations provide one or more of the following advantages. For example, in some implementations, a machine learning hardware accelerator can be executed faster by more efficiently allocating a message buffer queue and avoid bottlenecks in the accelerator's on-board communication network.

[0021] Details of one or more implementations of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, the drawings, and the claims.

Brief Description of the Drawings

[0022] [Figure 1] FIG. 1 is a schematic diagram showing an exemplary machine learning accelerator according to an implementation of the present disclosure. [Figure 2] FIG. 2 is a diagram showing an exemplary shared memory having buffer queues allocated for port-to-port traffic. [Figure 3] FIG. 3 is a flowchart of an exemplary process for allocating shared memory based on expected latency according to an implementation of the present disclosure. [Figure 4] FIG. 4 is a flowchart of an exemplary process for allocating shared memory based on profiling traffic execution according to an implementation of the present disclosure. [Figure 5] FIG. 5 is a flowchart of an exemplary process for allocating shared memory based on traffic during execution according to an implementation of the present disclosure. [Figure 6] FIG. 6 is a schematic diagram showing an example of a special-purpose logic chip that can be used in the multi-chip system of FIG. 1. [Figure 7] FIG. 7 is a diagram showing an exemplary neural network (NN) computing tile 700 that can be used in an ASIC.

Mode for Carrying Out the Invention

[0023] Detailed Description Generally, this disclosure relates to allocating shared memory between different channels of communication or ports within a high-speed communication network, such as a communication network of a machine learning accelerator including multiple application-specific integrated circuits (ASICs). Deep learning training requires distributed parallel processing. Distribution can be achieved by partitioning large amounts of training data into different replicas (e.g., data parallelism) or by partitioning very large models into smaller modules (e.g., model parallelism). The partitioned training data and model parameters are placed on different processing units for simultaneous computation.

[0024] Distributed training is performed in synchronous, iterative, and incremental loops. Under data parallelism, each processing unit ingests a mini-batch of data at each step, computes local gradients, and then swaps all local gradients across the entire network of computing units in an all-reduce manner to compute a final, overall consistent gradient, thereby updating the model weights at the end of the step.

[0025] Under model parallelism, each processing unit obtains a model activation input either from its local training data or from the output of another processing unit operating on its preceding hidden layer. The processing unit then computes an activation output that can be the final model output or can serve as the activation input for another processing unit. The gradient is computed on the processing unit containing the final layer and sent back to the previous layer to update the partitioned submodel. This process can be pipelined to operate on successive minibatches. Under this approach, intermediate activation outputs are sent around the network, as are the gradients at the model partition boundaries.

[0026] In practice, data and model parallelism can be combined to achieve the highest possible performance. For an example model with hundreds of billions of weight parameters, a massive amount of computational resources and communication are required to converge the model to the desired level of accuracy.

[0027] To accelerate the training process, ASICs such as custom-built accelerator chips and Tensor Processing Units (TPUs) are designed to function as processing units to speed up deep learning computations. In some implementations, chip types (e.g., FPGA, GPGPU, or CPU) are used. Meanwhile, to speed up communication between processing units, co-designed high-speed communication networks between accelerators are also constructed. Together, the training system can provide exaflop-level computational performance equivalent to current-generation supercomputers.

[0028] The custom-built network of the TPU accelerator is designed for simplification to reduce network processing overhead. Once the basic functions of the interconnected network, such as addressing, error detection and correction, routing, and flow control, are completed, the large amount of network processing is performed on the accelerator chip hardware, accelerating the processing speed.

[0029] This disclosure focuses on improving the performance of custom-built packet-switched TPU accelerator-side communication networks. Specifically, a set of solutions is proposed to improve flow control behavior by tuning packet buffer queues within on-chip routers in a distributed training supercomputer network.

[0030] The solutions disclosed herein are applicable to the synchronous data-parallel and model-parallel training patterns discussed above, and can also generally be applied to asynchronous distributed training in accelerator networks.

[0031] Figure 1 is a schematic diagram showing an exemplary machine learning accelerator 100 according to an implementation of the present disclosure. In this example, a TPU network interconnected through an on-chip network stack processing hardware module is shown. In this example, each TPU 106 has six network ports, which are linked to each other through buffer queues to form an in-chip crossbar. In some implementations, each TPU 106 may have more or fewer than six ports (e.g., 10, 3, or another number). In some implementations, the links between ports may be further divided into multiple virtual channels of communication. Furthermore, which ports are connected may be determined at the software level prior to the execution of jobs within the TPU network. For example, Figure 1 shows a number of TPUs 106 in a two-dimensional configuration, but based on the connections between TPU ports, a three-dimensional (e.g., spherical) configuration or other geometry is possible.

[0032] The accelerator-side network stack of the TPU106 is implemented in an on-chip hardware processing module on each TPU106 or in a router 102. Communication during distributed training is formatted as multiple network packets. In operation, packets between a source TPU chip and a destination TPU chip pair are hopped over one or more TPU chips as intermediate steps before reaching the final destination. At each TPU chip hop, the on-chip network stack interfaces with various network ports on the chip and forwards packets received from one port to another as directed by a routing algorithm specified by the user. Port-to-port transmissions within the chip are carried over in buffer queues. Cross-connected buffer queues within the chip form a crossbar for high-speed chip-level network processing.

[0033] Flow control can be implemented between each pair of directly connected TPUs 106 in a supercomputer network or machine learning accelerator 100, thereby preventing, for example, a faster transmitting TPU 106 accelerator from overwhelming a slower receiving TPU 106 accelerator. As the TPU network begins forwarding activation output and weight gradient traffic across different accelerators, the buffer queues in the on-chip network stack of each chip constantly receive packets from the input port to the output port, and the use of buffer space changes dynamically depending on the traffic ingress and egress rate in the TPU chip 106. When the buffer queue corresponding to a port is fully utilized, there is no buffer space left, so packets cannot be received at that port, and the upstream TPU accelerator should stop sending messages. The sender is regulated by sending flow control messages in a timely manner that inform the sender of the amount of buffer queue space available at the receiving port, which will be referred to below as "credits". The sender should not send messages that are larger than the available credits to be received. In some implementations, the link between any two connected TPU accelerators 106 is bidirectional, and credit messages are also sent bidirectionally.

[0034] The TPU accelerator's communication network can be a heterogeneous network environment. In other words, communication times between ports can vary from port to port and from TPU106 to TPU106. In addition, the amount of traffic distributed across ports may not be uniform, and therefore, intelligent and dynamic message queuing can significantly improve communication in the TPU communication network.

[0035] This heterogeneity can be caused by several different factors. For example, in the case of a large-scale deep learning training supercomputer that scales to thousands of TPU accelerators 106, various link media may be used to wire the entire network. Illustrative media used in links include, but are not limited to, PCB traces utilized for TPU accelerators 106 soldered on the same tray for data exchange, copper cables used for lower-cost short-distance communication, and optical cables used for long-distance communication. Different media materials represent heterogeneous link performance in terms of throughput and capacity, which affects queue utilization at the router.

[0036] In addition, large-scale supercomputer networks inevitably involve links of varying lengths. Thousands of TPU accelerators span at least multiple racks, connecting in-rack cables with shorter distances and lower latency, as well as inter-rack cables with longer distances, higher latency, and greater variation between different links. Latency impacts buffer queue utilization. These cable links have varying quality levels after use, measured by bit-error rate (BER). Varying BERs result in packet transmission retry behavior differing across all links, leading to heterogeneous link pressure and queue saturation.

[0037] TPU network ports are often not used uniformly, depending on the topology of the distributed training job. For example, if a user training job requests TPU resources in a 2D mesh topology from all the TPU resources available on a supercomputer, TPUs on the edges of the mesh will not use all of their ports, and ports that are not facing inward in the mesh will be connected to adjacent accelerators but will not receive traffic compared to other actively transmitting ports.

[0038] Large-scale supercomputer networks can inherently provide fault tolerance by routing around a faulty chip, a faulty host, or a faulty inter-TPU link medium. Fault-tolerant routing can lead to unbalanced link traffic pressure, even if the fault-free topology is originally of the same type. TPU106, where all ports are actively used and connected to medium of the same type, distance, and quality, can receive highly heterogeneous traffic because some ports are on more critical routes that pass around the faulty site. Furthermore, accelerators adjacent to the faulty site exacerbate the unbalanced use of ports if ports directly connected to the faulty chip or link do not receive traffic.

[0039] Distributed training approaches inherently introduce heterogeneity. In data-parallel models, all TPUs exchange the same amount of local gradients with each other, but more advanced techniques such as model partitioning and model parallelism make the gradients and activation outputs exchanged on the network inherently heterogeneous across partition boundaries. Since inference on partitioned models often depends on outputs from other partitions, communication latency, rather than throughput, also becomes more important in model parallelism. In addition, reinforcement learning training also heterogeneizes TPU network traffic, with groups of TPU workers existing as agents performing inference and another group of TPU workers running classical iterative learning loops. Traffic within and between these groups is inherently different. Therefore, dynamic queue allocation is desirable to address this heterogeneity.

[0040] Each TPU 106 includes multiple communication ports, channels, and an on-chip hardware processing module (router 102), as well as a shared programmable buffer queue storage structure 104. The buffer queue for each port may be software-controlled to different depths and stored in shared random access memory (RAM), such as static RAM (SRAM) or dynamic RAM (DRAM). In some implementations, each port of the TPU 106 is assigned a start address and an end address in the shared RAM 104 to identify the queue area for that particular port within the shared memory space.

[0041] The sizing of the buffer queues associated with the various network ports of the TPU accelerator 106 is critical in tuning the overall training communication throughput. For a given link receiving a large amount of traffic, allocating too small a buffer queue space to that port on the receiving TPU 106 can lead to the transmitting TPU 106 frequently ceasing to send its packets, slowing down traffic and potentially becoming a bottleneck in synchronous training communication. Each queue can be further divided into several virtual channels for per-channel queue allocation. Although the interconnected links are bidirectional, all queues correspond to unidirectional links between the two accelerators.

[0042] Figure 2 shows an exemplary shared memory 200 with a buffer queue allocated for port-to-port traffic. Traffic in the buffer queue can be egress-to-port traffic (e.g., traffic generated from one TPU and outbound to a different TPU), port-to-ingress traffic (e.g., traffic generated outside a particular TPU and ingested by a particular TPU), or port-to-port traffic (e.g., traffic passing through a TPU in a TPU network). Furthermore, each port can be subdivided into multiple virtual channels, each providing its own unique communication path. While Figure 2 shows only port-to-port queues allocated in shared memory, all three types of traffic or any preferred combination thereof may exist and are within the scope of this disclosure. In the example shown, the FIFO (First In, First Out) pointers for each queue use their start and end addresses as criteria for pushing and popping data from the queue. Port-to-ingress and egress-to-port queues follow the same addressing scheme, with fewer queues sharing RAM capacity. The same mechanism applies to accelerators with more or fewer ports than indicated.

[0043] These start and end addresses (for example, addresses 0 and 1 as shown) can be controlled or assigned via software. A set of application programming interfaces (APIs) are exposed through the TPU accelerator's device driver to write to PCIe config space registers that specify the size of each buffer queue. The APIs translate the queue size to the start and end addresses of each queue for hardware operation. The disclosed solution may call these APIs to dynamically configure and allocate queue sizes for all ports in the TPU communication network.

[0044] Figure 3 is a flowchart of an exemplary process for allocating shared memory based on expected latency, according to an implementation of this disclosure. The buffer queue allocation process examines the ports actively used in the (sub)network participating in the training process and allocates queue sizes (credits) based on the upstream round-trip latency weights of each port. This scheme takes into account link medium heterogeneity, inactive ports in heteromorphic networks, and inactive ports directly connected to a faulty link or a faulty TPU accelerator chip. This scheme is divided into two steps: offline link calibration and online credit allocation.

[0045] During offline link calibration, the average round-trip time (RTT) for different link media used in the TPU communication network is determined (302). This may be determined based on historical values, ping operations, or other methods, and provides a general expected latency for a given link based on the medium of that link. For example, PCT traces may have a lower expected latency than optical cables.

[0046] During the online credit allocation phase, topology discovery may be performed to determine the network topology of the TPU communication network required or requested for a particular job to run (304). Topology discovery may identify which TPUs will participate in the next job and which ports are available on each TPU.

[0047] After the network topology is determined, metadata providing information about the communication ports to be used in the TPU communication network for the job may be accessed (306). For example, each TPU may maintain metadata in on-chip memory that identifies the port ID of each port, whether the port is in use in the current topology, the medium associated with each port (e.g., copper, optical, PCB, etc.), and the cable length associated with the port.

[0048] The accessed metadata may be used in combination with the expected latency determined during offline calibration to determine the expected or anticipated RTT delay for each port, which may then be used to allocate a queue buffer in shared memory for each port according to the expected RTT delay or latency (308). The queue size is calculated by the TPU itself for each port on each TPU. The TPU first allocates a queue size of zero to any unused ports, and then allocates the remaining queue size for each port. In some implementations, the queue size calculation process is performed independently and simultaneously for all TPUs for pending jobs in the TPU communication network. It indexes the offline-calibrated link latency table and calculates the queue size for each port in proportion to the round-trip time of the input ports. In some implementations, the queue size is calculated via the following formula, where p is the port being calculated and N is the total number of actively used ports on the chip.

[0049]

number

[0050] Once the queue size for each port and channel is determined, the start and end addresses of the shared memory can be allocated to each port according to the size allocation (310). In some implementations, this is achieved using one or more APIs provided by the TPU architecture. For example, an API may write to a PCIe config space register that specifies the size of each buffer queue. The API translates the queue size to the start and end addresses of each queue for hardware operation. The disclosed solution may call these APIs to dynamically configure and allocate queue sizes for all ports in a TPU communication network.

[0051] Once the allocation of addresses to shared memory is complete, the TPU communication network may be enabled, and the inference process or training run may begin (312). The inference process may be a long-running process intended to train or weight a neural network for future machine learning outputs.

[0052] Figure 4 is a flowchart of an exemplary process for allocating shared memory based on profiling traffic execution, according to an implementation of this disclosure. By performing profiling traffic execution, a more authentic representation of traffic demand during job execution can be determined. In some implementations, the process for allocating shared memory based on profiling traffic execution begins by completing the process as described with respect to Figure 3 (e.g., 302-310), which provides an initial allocation to the traffic queue.

[0053] Once the initial buffer queue is allocated, one or more message traffic profiles may be selected for profiling on the network (402). Exemplary profiles may include, but are not limited to, all-to-all, nearest-neighbor traffic, or other composite patterns generated by machine learning models (e.g., model-partitioned ResNet-50 or bidirectional encoder representation from transformer (BERT) models). In some implementations, all or a combination of previous traffic profiles are combined for profiling. Before starting profiling, the software clears the hardware performance counter registers within each TPU, resetting them to virtually zero. The hardware TPU performance counter registers record the number of packets successfully received on each channel of each port of the TPU. The profiling traffic is injected into the TPU communication network, and the number of packets successfully received on each port of the TPU is counted by the hardware registers (404). A separate software system reads counter registers (e.g., via an API) to determine the total number of packets received for each port (and channel) during the profiling run. In some implementations, profiling runs are significantly shorter than the actual training runs performed. For example, a profiling run might be on the order of minutes or hours, while a training job could take days or weeks.

[0054] Once profiling is complete, the number of packets received on each channel of a port may be used to determine the queue size for that port (406). In some implementations, the queue size is determined using the following formula, where p is the port, N is the total number of ports on the ASIC, and packet_num is the number of packets received during profiling. Note that the following formula calculates a value of zero for unused ports, and therefore unused ports are allocated a queue size of zero.

[0055]

number

[0056] Once the queue size for each port and channel is determined, the start and end addresses of the shared memory can be allocated to each port according to the size allocation (310). In some implementations, this is achieved using one or more APIs provided by the TPU architecture. For example, an API may write to a PCIe config space register that specifies the size of each buffer queue. The API translates the queue size to the start and end addresses of each queue for hardware operation. The disclosed solution may call these APIs to dynamically configure and allocate queue sizes for all ports in a TPU communication network.

[0057] Once the allocation of addresses to shared memory is complete, the TPU communication network may be enabled, and the inference process or training run may begin (312). The inference process may be a long-running process intended to train or weight a neural network for future machine learning outputs.

[0058] Profile-guided queue adjustments can reflect packet retransmissions caused by poor link quality, unbalanced link traffic caused by routing algorithms, or faulty chips / links. Therefore, it may be a more optimal scheme to allocate more credit to ports / links that receive more traffic and require more buffer space to forward messages from one port to another.

[0059] Figure 5 is a flowchart of an exemplary process for allocating shared memory based on traffic during execution, according to an implementation of the present disclosure. The process described in Figure 5 may be initiated in the same way as the processes in Figures 4 and 3 (e.g., 302 to 312). In some implementations, some or all of the processes are performed sequentially. For example, the system may first allocate memory based on predicted latency as described with respect to Figure 3, then perform a profiling run and reallocate memory based on the profiling run as described with respect to Figure 4, and finally, during the execution of a training run, further reallocate memory according to the process described below with reference to Figure 5. Any preferred combination of these processes is contemplated by the present disclosure.

[0060] Once initial queue allocation is achieved (via either or both of the processes described in Figure 3 or Figure 4), the training job can begin execution. During execution, the controller can monitor the packet count for each port, which is recorded by the hardware TPU performance counter register as described above. Initially, at the start of execution, the packet statistics and hardware counters for each port may be cleared (502). The training job may run for a predetermined amount of time, and the queue may then be adjusted based on the packet count for each port during job execution. In some implementations, the message queue is reallocated periodically during execution or a set number of times (e.g., once every hour for the first 5 hours of execution). In some implementations, the message queue is reallocated more frequently at the start of the training job and less frequently as execution progresses (e.g., every 10 minutes for the first hour, then every hour for the next 5 hours, and then once a day thereafter). In some implementations, the duration is configured by the user on a case-by-case basis.

[0061] If the queue should be reallocated after a predetermined time has elapsed, packet statistics for each port are read from the hardware TPU performance counter register (504). The desired queue size is calculated (506). In some implementations, the desired queue size is calculated using a formula as shown in Figure 4.

[0062] Once the queue size is determined, the execution of the training job may be paused, allowing the TPU to fully ingest and process any pending message traffic and clear those queues (508). In some implementations, the controller verifies that the queues are clear (e.g., shared RAM has no pending messages for each TPU) before proceeding (510). In some implementations, the pause lasts for a predetermined amount of time, and if the shared RAM is not clear (512), the execution of the training job resumes (516). In these implementations, the controller may retry the reallocation at a later point. If it is determined that the shared RAM is clear, each queue in the shared RAM is assigned a new start address and stop address (e.g., via the API discussed above) (514). The controller may then clear the per-port packet statistics stored in the hardware TPU performance counter registers, and then the training job resumes execution (502). This process may be repeated as needed during the execution of the training job.

[0063] Figure 6 is a schematic diagram showing an example of a special-purpose logic chip that may be used in the machine learning accelerator of Figure 1. Figure 6 shows a block diagram of an ASIC used in a machine learning hardware accelerator as an exemplary computing system 600 for accelerating tensor computations associated with deep neural networks (DNNs). System 600 may be, for example, ASIC 102 as described with reference to Figure 1. System 600 generally includes a controller 602, a host interface 608, an input / output (I / O) link 610, a plurality of tiles including a first tile set 612 and a second tile set 614, a classifier section 616, and a data bus identified in a bus map 618 (shown for clarity but not included in System 600). Controller 602 generally includes a data memory 604, an instruction memory 606, and at least one processor configured to execute one or more instructions encoded in a computer-readable storage medium. The instruction memory 606 may store one or more machine-readable instructions that can be executed by one or more processors of the controller 602. The data memory 604 may be one of various data storage media for storing and subsequently accessing various data relating to calculations that occur within the system 600.

[0064] The controller 602 is configured to execute one or more instructions relating to tensor computations within the system 600, including instructions stored in the instruction memory 606. In some implementations, the data memory 604 and instruction memory 606 are volatile memory units. In some other implementations, the data memory 604 and instruction memory 606 are non-volatile memory units. The data memory 604 and instruction memory 606 may further be other forms of computer-readable media, such as floppy disk devices, hard disk devices, optical disk devices, tape devices, flash memory or other similar solid-state memory devices, or arrays of devices including devices in a storage area network or other configuration. In various implementations, the controller 602 may be referred to as the core manager 602.

[0065] As shown, the host interface 608 is coupled to the I / O link 610, the controller 602, and the classifier section 616. The host interface 608 receives instructions and data parameters from the I / O link 610 and provides the instructions and parameters to the controller 602. Generally, instructions may be provided to one or more devices in the system 600 via the instruction bus 624 (described later), and parameters may be provided to one or more devices in the system 600 via the ring bus 628 (described later). In some implementations, instructions are received by the controller 602 from the host interface 618 in initial time and stored in the instruction memory 606 for execution by the controller 602 in subsequent time.

[0066] The classifier unit 616 is similarly coupled to the controller 602 and tile 7 of the second tile set 614. In some implementations, the classifier unit 616 is implemented as a separate tile in the system 600. In alternative implementations, the classifier unit 616 is located or installed within the controller 602 as a subcircuit or subdevice of the controller 602. The classifier unit 616 is typically configured to perform one or more functions on the accumulated pre-activation values ​​received as the output of the fully connected layer. The fully connected layer may be partitioned across tiles in tile sets 612 and 614. Thus, each tile is configured to generate a subset of pre-activation values ​​(i.e., linear outputs) that can be stored in the tile's memory unit. The classification result bus 620 provides a data path from the classifier unit 616 to the controller 602. Data containing post-function values ​​(i.e., results) is provided from the classifier unit 616 to the controller 602 via the classification result bus 620.

[0067] Bus map 618 shows data buses that provide one or more interconnected data communication paths between tiles of the first tile set 612 and the second tile set 614. Bus map 618 provides a legend for identifying the classification result bus 620, CSR / master bus 622, instruction bus 624, mesh bus 626, and ring bus 628, as shown in Figure 6. Generally, tiles are core components within the accelerator architecture of system 600 and are the focus of tensor computations occurring in the system. Each tile is an individual computing unit that works with other tiles in the system to accelerate computations across one or more layers of a multilayer neural network. While tiles in tile sets 612,614 may share the execution of tensor computations associated with a given instruction, individual computing units are self-contained computing components configured to independently execute a subset of tensor computations for other corresponding tiles in tile sets 612,614.

[0068] The CSR bus 622 is a single master multiple slave bus that enables the controller 602 to send one or more instructions to set the program configuration and read the status registers associated with one or more tiles. The CSR bus 622 can be connected in a single daisy chain configuration having one master bus segment and multiple slave bus segments. As shown in Figure 6, the CSR bus 622 provides communication coupling through a bus data path connecting the tilesets 612, 614 in the ring to the host interface 610 and the tiles in the controller 602. In some implementations, the host interface 610 is the single master of the CSR bus ring, and the entire CSR bus address space is memory mapped to a memory space in the host interface 610.

[0069] The CSR bus 622 may be used by the host interface 610 to perform one or more operations, which include, for example, programming a memory buffer pointer in the controller 602 to allow the controller 602 to begin fetching instructions from the instruction memory 606, updating / programming various tile settings (e.g., coefficient tables for polynomial approximation calculations) that remain static during one or more calculations, and / or loading / reloading firmware into the classifier unit 616. In one example, a firmware reload may include a new function to be applied to linear output (i.e., pre-activation values). Thus, all slaves having access to the CSR bus 622 will have a distinct node identifier (node ​​ID) that is associated with and identifies the slave. The node ID is part of the instruction address and will be used by the CSR slave (i.e., the controller 602, tiles 612, 614, and classifier 616) to determine whether a CSR packet is addressed to the slave, and will be checked or otherwise investigated.

[0070] In some implementations, one or more instructions may be transmitted by the host interface 602 through the controller 602. The instructions may be, for example, 32 bits wide, and the first 7 bits contain header information indicating the instruction address / destination to receive and execute the instruction. The first 7 bits of the header may contain data parameters representing a specific node ID. Thus, a slave on the CSR bus ring (e.g., each tile) can examine the instruction header to determine whether the request by the master (host interface 610) is addressed to the tile whose header is being examined. If the node ID in the header does not indicate that the destination is the tile being examined, the examining tile copies the incoming CSR instruction packet to the CSR bus input connected to the next tile for examination by the next tile.

[0071] The instruction bus 624, originating from the controller 602 and similar to the CSR bus 622, further provides communication coupling through a bus data path that connects to return tiles in the tile sets 612,614 in the ring back to the controller 602. In one implementation, the controller 602 broadcasts one or more instructions over the instruction bus 624. Instructions broadcast by the controller 602 may differ from instructions provided over the CSR bus 622. However, the manner in which a tile receives and / or consumes or executes instructions received over the bus 624 may be similar to the process for executing instructions received over the CSR bus 622.

[0072] In one example, the instruction header (i.e., bitmap) indicates to the receiving tile that it needs to consume a particular instruction based on the bitmap associated with that instruction. The bitmap may have a specific width defined in terms of bits. Instructions are typically transferred from one tile to the next based on the instruction's parameters. In one implementation, the width of the instruction bus 624 may be configured to be smaller than the size / width of the instruction. Thus, in such a configuration, instruction transmission takes several cycles, and bus stops on the instruction bus 624 cause the decoder to place the instruction received in the tile into the appropriate target instruction buffer associated with that tile.

[0073] As further described below, tiles in tilesets 612,614 are generally configured to support two broad categories of instructions. These two broad categories may also be referred to as instruction types. Instruction types include tensor operation (TensorOp) instructions and direct memory access (DMAOp) instructions. In some implementations, a DMAOp instruction has one or more specializations that are allowed to be concurrent. One or more specializations may be referred to as DMAOp instruction subtypes or opcodes. In some cases, each unique and / or valid DMAOp instruction type / subtype tuple will have a separate instruction buffer within a particular tile.

[0074] For specific tiles 612 and 614, a bus stop associated with instruction bus 624 examines the header bitmap to determine the instruction type / subtype. Instructions are received by a tile and may then be written to the tile's instruction buffer prior to the tile's execution of the instruction. The instruction buffer of a tile to which an instruction is written may be determined by the instruction type and subtype indicator / field. The instruction buffer may include a first-in, first-out (FIFO) control scheme that prioritizes the consumption of one or more related instructions. Thus, under this FIFO control scheme, instructions of the same type / subtype are always executed in the order in which they arrived on the instruction bus.

[0075] The different instruction buffers within a tile are the TensorOp instruction buffer and the DMAOp instruction buffer. As shown above, the instruction types include TensorOp instructions and DMAOp instructions. With respect to DMAOp instructions, the instruction subtypes (indicating “write” buffer locations) include 1) mesh inbound instruction buffers, 2) mesh outbound instruction buffers, 3) narrow-wide DMA instruction buffers, 4) wide-narrow DMA instruction buffers, and 5) ring bus DMA instruction buffers. These buffer locations are described in more detail below with reference to Figure 7. The terms wide and narrow are used throughout this specification and generally refer to the approximate size in width (bits / bytes) of one or more memory units. As used herein, “narrow” may refer to one or more memory units, each having a size or width of less than 16 bits, and “wide” may refer to one or more memory units, each having a size or width of less than 64 bits.

[0076] The mesh bus 626 provides a data communication path distinct from the CSR bus 622, the instruction bus 624, and the ring bus 628 (described later). As shown in Figure 6, the mesh bus 626 provides a communication path that connects or links each tile to its corresponding adjacent tile in both the X and Y dimensions. In various implementations, the mesh bus 626 may be used to transport input activation amounts between one or more narrow memory units in adjacent tiles. As shown, the mesh bus 626 does not allow direct transfer of input activation data to non-adjacent tiles.

[0077] In various implementations, the mesh bus 626 and the various tiles connected via the mesh bus 626 may have the following configurations: The four corner tiles of the mesh have two outbound ports and two inbound ports. The four edge tiles of the mesh have three inbound ports and three outbound ports. All non-edge, non-corner tiles have four inbound ports and four outbound ports. Generally, given an exemplary N×N tile layout, edge tiles are tiles that have only three adjacent tiles, while corner tiles are tiles that have two adjacent tiles. Regarding the data flow method via the mesh bus 626, generally, all input activations arriving via the mesh bus 626 for a particular tile must be committed to one or more narrow memory units of the tile. Furthermore, for tile configurations with fewer than four inbound ports, the DMAOp instruction may write a zero value to a location in the tile's narrow memory instead of waiting for data on an absent input port. Similarly, in the case of a tile configuration with fewer than four outbound ports, the DMAOp instruction does not perform narrow memory reads and port writes related to transfers to any absent ports.

[0078] In some implementations, the location or address of the narrow memory unit to which a particular input activation is written or read is generated by a Tensor Traversal Unit (TTU) based on inbound / outbound DMAOps provided via mesh bus 626. The inbound and outbound DMAOps may run concurrently, and any necessary synchronization is managed through a synchronization flag control scheme managed by controller 602. The TTU is described in more detail below with reference to Figure 7.

[0079] The ring bus 628, starting from the controller 602 and connecting tiles 612,614 back to the controller 602, similar to the CSR bus 622 and instruction bus 624, provides further communication coupling through a bus data path. In various implementations, the ring bus 628 typically connects or couples all wide memory units (described in more detail below with reference to Figure 7) in all tiles 612,614. Thus, the payload width of the ring bus 628 corresponds to the width of the wide memory units located within each tile of the tile set 612,614. As discussed above, the ring bus 628 further includes a bitmap header indicating the tiles that need to consume payload data containing instructions or parameters to be communicated via the ring bus 628.

[0080] With respect to data (i.e., payload) received at a particular tile via the ring bus 628, in response to receiving information, each tile zeros out (i.e., clears) the position data indicated in the bitmap header, which is specific to the receiving tile, before transferring the data to another tile. Therefore, if the header bitmap does not contain the remaining bit set data indicating the particular tile that should receive the payload, the transfer of the payload to the other tile will be stopped. Payload data generally refers to the activations and weights used by one or more tiles during tensor computations performed based on the execution of deeply nested loops.

[0081] In some implementations, controller 602 may be described as part of the ring bus 628. In one example, for a DMAOp instruction executed within a particular tile, controller 602 may be used in the ring to pop data / payload from a ring bus stop and transfer the payload to the ring bus stop in the next tile. Controller 602 may further commit the payload data to one or more wide memory units of the tile if such action is required by an instruction in the bitmap header. The addresses of one or more wide memory units to which the data needs to be written may be generated by the DMAOp instruction within a particular tile.

[0082] In various implementations, each tile in tile sets 612,614 can be either a creator or a consumer of payload data. If a tile is a creator of payload data, it reads data from one or more of its wide memory units and multicasts the data over the ring bus 628 for consumption by one or more other tiles. If a tile is a consumer of payload data, it receives the data, writes it to one or more wide memory units within the tile, and transfers the payload data for consumption by one or more other tiles. With respect to the movement of payload data over the ring bus 628, typically, at any given time, there will be only one creator / master of data on the ring bus 628. The execution order of DMAOp instructions across all tiles (e.g., a FIFO control scheme) ensures that there is only one creator / master of data on the ring bus 628 at any given time.

[0083] In some implementations, controller 602 uses a synchronization flag control architecture to ensure that there is only one creator / master of payload data on the ring bus 628 at a given time. In one example, each write by a tile to the ring output triggers an increment of the corresponding synchronization flag count. Controller 602 may examine the payload data to determine the number of data chunks or segments containing the payload. Controller 602 then monitors execution by the tile to ensure that the expected number of data segments are transferred and / or consumed by the tile before another tile runs in master mode.

[0084] An exception to the guarantee that there is only one data creator / master on the ring bus 628 at a given time arises when there are local multicast groups connected via the ring bus 628 that do not have overlapping areas on the ring bus. For example, tile 0 (master) may multicast (i.e., generate data) to tiles in the tile 0-tile 3 grouping, while tile 4 (master) may do the same to tiles in the tile 4-tile 7 grouping. A key requirement of this dual-master multicast method is that different multicast groups should not be allowed to see each other's data packets, as this could result in packet overlap and lead to one or more data calculation errors.

[0085] As shown in Figure 6, the controller 602 provides a communication data path that connects or links tiles in tile sets 612 and 614 to I / O 610 and includes several core functions. The core functions of the controller 602 generally include supplying one or more I / O input activations to tiles in tile sets 612 and 614, supplying one or more input activations and parameters received from I / O 610 to tiles, supplying one or more instructions received from I / O 610 to tiles, sending I / O output activations to the host interface 608, and acting as a ring stop for the CSR bus 622 and ring bus 628. As will be described in more detail below, the first tile set 612 and the second tile set 614 each include multiple tiles used to perform one or more tensor calculations that are performed based on deep loop nesting consisting of inner and outer loops.

[0086] System 600 generally operates as follows: The host interface 608 will provide the controller 602 with one or more instructions that define the direct memory access operations (DMAOps) that occur for a given computation. The descriptors associated with the instructions supplied to the controller 602 will contain information required by the controller to facilitate large dot product computations associated with multidimensional data arrays (tensors). Generally, the controller 602 receives input activations, tile instructions, and model parameters (i.e., weights) from the host interface 608 to perform tensor computations for a given layer of the neural network. The controller 602 may then multicast the instructions to tiles 612, 614 in a manner defined by the instructions. As discussed above, a tile consuming an instruction may then initiate broadcast transmission of a new / subsequent instruction to another tile based on the bitmap data in the instruction header.

[0087] Regarding data flow, input activations and parameters are sent to tiles in tile sets 612,614 via ring bus 628. Each of tiles 612,614 stores a subset of input activations required to compute a subset of output activations assigned to that particular tile. A DMAOp instruction for a tile moves the input activations from wide memory to narrow memory. Computation within a tile begins when the required input activations, parameters / weights, and computation instructions (TTU operations, memory addresses, etc.) are available in the tile. Computation within a tile ends when the MAC operator (described later) in the tile completes all dot product operations defined by the instruction set and the pre-activation function is applied to the result of the multiplication operation (i.e., the output activations).

[0088] The result of one or more tensor computations involves writing the output activations of the computation layer to the narrow memory unit of the tile on which the computation is performed. In some tensor computations, there is a transfer of output edge activations to adjacent tiles via the mesh bus 626. If the computation spans multiple layers, the transfer of output edge activations to adjacent tiles is required to compute the output activations for subsequent layers. Once computations for all layers are complete, the DMAOp moves the final activation to the classifier tile 616 via the ring bus 628. The controller 602 then reads the final activation from the classifier tile 616 and executes the DMAOp to move the final activation to the host interface 608. In some implementations, the classifier portion 616 performs the computation for the output layer (i.e., the last layer) of the NN. In other implementations, the output layer of the NN is a classifier layer, a regression layer, or one of the other layer types commonly associated with neural networks.

[0089] Figure 7 shows an exemplary neural network (NN) computation tile 700 that may be used in an ASIC (e.g., TPU106) as described with reference to Figure 1. Generally, the exemplary tile 700 may correspond to any of the tiles in the first tile set 612 and the second tile set 614 discussed above with reference to Figure 6. In various implementations, the computation tile 700 may also be referred to as a computation unit 700. Each computation tile 700 is a self-contained computation unit configured to execute instructions independently of other corresponding tiles in tile sets 612,614. As briefly discussed above, each computation tile 700 executes two types of instructions: TensorOp instructions and DMAOp instructions. Generally, each instruction type involves computational operations associated with deep loop nesting, and therefore each instruction type will generally be executed over multiple time epochs to ensure the completion of all loop iterations.

[0090] As will be discussed in more detail below, different instruction types are executed by independent control units within the compute tile 700, synchronized on data through synchronization flag control managed within the compute tile 700. Synchronization flag control manages the simultaneity between the execution of different instruction types within the compute tile 700. Each computation operation associated with each instruction type will be executed in a strict order of issuance (i.e., first-in, first-out). With respect to the two instruction types, TensorOP and DMAOp, there is no guarantee of order between these different instruction types, and each type is treated as a separate thread of control by the compute tile 700.

[0091] Regarding the data flow configuration, the compute tile 700 generally includes data paths 702 and 705, each providing communication paths for data flows entering and leaving the compute tile 700. As described above, the system 600 includes three separate data bus structures laid out in a ring configuration, namely the CSR bus 622, the instruction bus 624, and the ring bus 628. Referring to Figure 7, data path 705 corresponds to the instruction bus 624, and data path 702 generally corresponds to one of the CSR bus 622 and the ring bus 628. As shown, data path 702 includes a ring output 703 that provides an output path for data leaving the compute tile 700 and a ring input 704 that provides an input path for data entering the compute tile 700.

[0092] Computation tile 700 further includes TensorOp control 706, which includes a TensorOp tensor traversal unit (TTU) 726, and DMAOp control 708, which includes a DMAOp TTU 728. TensorOp control 706 generally manages writes to and reads from the TensorOp TTU register 732, and manages traversal operations for execution by TensorOp TTU 726. Similarly, DMAOp control 708 generally manages writes to and reads from the DMAOp TTU register 734, and manages traversal operations for execution by DMAOp TTU 728. The TTU register 732 includes an instruction buffer for storing one or more instructions, which contain operations to be performed by TensorOp TTU 726 when an instruction is executed by TensorOp control 706. Similarly, the TTU register 734 includes an instruction buffer for storing one or more instructions, each containing an operation to be performed by the TTU 708 when an instruction is executed by the DMAOp control 708. As further described below, the TTU is used by the computation tile 700 to traverse array elements of one or more tensors, typically residing in narrow memory 710 and wide memory 712.

[0093] In some implementations, an instruction for execution by the compute tile 700 arrives at the tile via the data path 705 (i.e., a portion of the instruction bus 624). The compute tile 700 examines the header bitmap to determine the instruction type (TensorOp or DMAOp) and instruction subtype (read operation or write operation). Instructions received by the compute tile 700 are then written to a specific instruction buffer, depending on the instruction type. Generally, instructions are received and stored (i.e., written to a buffer) before execution by the components of the compute tile 700. As shown in Figure 7, the instruction buffers (i.e., TensorOp TTU register 732 and DMAOp TTU register 734) may each contain a first-in, first-out (FIFO) control scheme that prioritizes the consumption (execution) of one or more related instructions.

[0094] As briefly discussed above, a tensor is a multidimensional geometric object, and exemplary multidimensional geometric objects include matrices and data arrays. An algorithm involving deeply nested loops may be performed by the computation tile 700 to perform tensor computations by iterating through one or more nested loops to traverse an N-dimensional tensor. In one exemplary computation process, each loop in the loop nest may be responsible for traversing a particular dimension of the N-dimensional tensor. As described herein, the TensorOp control 706 generally manages one or more tensor operations that drive a sequence of accesses to traverse the dimensional elements of a particular tensor construct and complete the computation defined by the deeply nested loops.

[0095] The computation tile 700 further includes narrow memory 710 and wide memory 712. The names narrow and wide generally refer to the size of the memory units in width (bits / bytes) of the narrow memory 710 and wide memory 712. In some implementations, the narrow memory 710 includes memory units, each having a size or width of less than 16 bits, and the wide memory 712 includes memory units, each having a size or width of less than 32 bits. Generally, the computation tile 700 receives input activations via the data path 705, and the DMA control 708 performs an operation to write the input activations to the narrow memory 710. Similarly, the computation tile 700 receives parameters (weights) via the data path 702, and the DMA control 708 performs an operation to write the parameters to the wide memory 712. In some implementations, the narrow memory 710 may include a memory arbiter, as is typical in shared memory systems, to determine which control device (e.g., TensorOp control 706 or DMAOp control 708) is permitted to access its shared memory unit in the narrow memory 710 for each memory cycle.

[0096] The computation tile 700 further includes an input activation bus 716 and a MAC array 714, each containing multiple cells, each containing a MAC operator 715 and a thumb register 720. Generally, the MAC array 714 uses the MAC operators 715 and thumb registers 720 across the multiple cells to perform tensor calculations, including arithmetic operations related to dot product calculations. The input activation bus 716 provides a data path through which input activations are provided by narrow memory 710, one for each access by each MAC operator 715 of the MAC array 714. Thus, based on the broadcast transmission of each input activation, each single MAC operator 715 in a particular cell receives an input activation. Arithmetic operations performed by the MAC operators of the MAC array 714 generally involve multiplying the input activations provided by narrow memory 710 by parameters accessed from wide memory 712 to produce a single output activation value.

[0097] During arithmetic operations, partial sums may be accumulated and stored, for example, in the corresponding sum register 720, or written to wide memory 712 and re-accessed by a specific cell in MAC array 714 to complete subsequent multiplication operations. Tensor calculations may be described as having a first part and a second part. The first part is completed when the multiplication operation generates the output activation by completing the multiplication of, for example, the input activation and the parameters for generating the output activation. The second part involves applying a nonlinear function to the output activation, and the second part is completed when the output activation is written to narrow memory 710 after the application of the function.

[0098] The computation tile 700 further includes an output activation bus 718, a non-linear unit (NLU) 722 including an output activation pipeline 724, an NLU control 738, and a reference map 730 showing the core attributes of the components in the computation tile 700. The reference map 730 is shown for clarity but is not included in the computation tile 700. Core attributes include whether a particular component is a unit, a memory device, an operator, a control device, or a data path. Generally, once the first part of the tensor computation is complete, the output activation is provided from the MAC array 714 to the NLU 722 via the output activation bus 718. After arriving at the NLU 722, data identifying the activation function received via the activation pipeline 724 is applied to the output activation, which is then written to the narrow memory 710. In some implementations, the output activation bus 718 includes at least one pipelined shift register 736, and completing the second part of the tensor computation involves using the shift register 736 of the activation bus 718 to shift the output activation toward narrow memory 710.

[0099] For example, with respect to the dot product calculation of two multidimensional data arrays, for a single computation tile 700, the MAC array 714 provides robust single instruction multiple data (SIMD) functionality. SIMD generally means that all parallel units (multiple MAC operators 715) share the same instruction (based on deep loop nesting), but each MAC operator 715 executes the instruction on different data elements. In one basic example, adding arrays [1,2,3,4] and [5,6,7,8] element by element to obtain array [6,8,10,12] in one cycle would typically require four computation units to perform the operation on each element. By using SIMD, the four units can share the same instruction (e.g., "add") and perform the calculation in parallel. Thus, the system 600 and computation tile 700 provide improved acceleration and parallelism in tensor computation compared to conventional methods.

[0100] In one example, for consumption by multiple MAC arrays 714, as will be described in more detail below, a single instruction may be provided by the controller 602 to multiple computation tiles 700 (see tile sets 612,614 in Figure 6). Generally, a neural network layer may include multiple output neurons, which may be partitioned such that tensor computations associated with subsets of output neurons may be assigned to specific tiles in tile sets 612,614. Each tile in tile sets 612,614 may then perform tensor computations relating to different groups of neurons for a given layer. Thus, the computation tiles 700 may provide at least two forms of parallelism, namely, 1) one form including partitioning output activations (corresponding to subsets of output neurons) among multiple tiles in tile sets 612,614, and 2) another form including simultaneous computation (by a single instruction) of multiple subsets of output neurons based on the partitioning between tiles in tile sets 612,614.

[0101] The disclosed inventive concepts include those defined in the attached claims, but it should be understood that such inventive concepts may be further defined according to the following embodiments.

[0102] Embodiment 1 is a method for memory allocation in a machine learning accelerator communication network. Generally, this method involves accessing metadata associated with multiple communication ports of an application-specific integrated circuit (ASIC). For each port, the metadata identifies whether a particular port is used in the current configuration and the communication medium associated with that port. Based on the metadata, the expected latency is determined for each port, and a portion of shared memory is allocated to each port. Shared memory is allocated by allocating zero memory to unused ports, determining the memory allocation for each port based on the expected latency, and assigning start and end addresses of the shared memory to each port. The implementation may optionally include one or more of the following features.

[0103] Embodiment 2 is the method of Embodiment 1, wherein assigning the start and end addresses of the shared memory to each port involves calling an application programming interface (API) by a device other than the ASIC.

[0104] Embodiment 3 is the method according to Embodiment 1 or 2, wherein the process is executed on an ASIC using a machine learning accelerator communication network and allocated shared memory. In some embodiments, the process is to train a neural network.

[0105] Embodiment 4 is the method according to any one of Embodiments 1 to 3, wherein the ASIC is a tensor processing unit (TPU).

[0106] Embodiment 5 is one of the methods from Embodiments 1 to 4, wherein the communication medium identified in the metadata is a copper cable medium, an optical medium, a printed circuit board (PCB) medium, or any combination thereof.

[0107] Embodiment 6 is a memory that is formula

[0108]

number

[0109] The method according to any one of Embodiments 1 to 5, which is allocated accordingly. Embodiment 7 is a system comprising one or more computers and one or more storage devices for storing instructions, wherein, when executed by one or more computers, the instructions are operable to cause one or more computers to perform the method according to any one of claims 1 to 6.

[0110] Embodiment 8 is a computer storage medium encoded by a computer program, the program including instructions that, when executed by a data processing device, cause the data processing device to perform the method according to any one of claims 1 to 6.

[0111] Embodiment 9 is a method for memory allocation in a machine learning accelerator communication network, the method comprising determining a network topology for a network of machine learning accelerator ASICs. Metadata associated with multiple communication ports of each ASIC in the network is accessed. For each of the multiple ports, the metadata identifies whether a particular port is used in the current configuration and the communication medium associated with that particular port. For each port used in the network topology, a round-trip time (RTT) delay is determined. A portion of shared memory is allocated to each of the multiple ports, the allocation being performed by determining a memory allocation for each port proportional to the RTT delay and assigning a start address and stop address of the shared memory to each port for the determined memory allocation. A process of sending profiling traffic to the network for a predetermined duration is performed on the machine learning accelerator. For each port, the number of received traffic packets is determined, and a portion of the shared memory is reallocated to each port of the multiple ports. This reallocation is performed by determining a memory allocation for each port that is proportional to the number of packets received, and by reallocating a start address and a stop address for each port in the determined memory allocation.

[0112] Embodiment 10 is the method of Embodiment 9, wherein assigning and reallocating the start and end addresses of the shared memory to each port involves calling an API by a device other than the ASIC.

[0113] Embodiment 11 is a memory allocation proportional to the RTT delay determined for each port, expressed by the formula

[0114]

number

[0115] This is the method according to Embodiment 9 or 10, as determined accordingly. Embodiment 12 provides a memory allocation for each port that is proportional to the number of packets received, using the formula:

[0116]

number

[0117] The method is determined according to any one of embodiments 9 to 11. Embodiment 13 is a method according to any one of Embodiments 9 to 12, wherein the RTT delay is calculated before execution by sending and receiving one or more timing messages to determine the latency.

[0118] Embodiment 14 is a method according to any one of Embodiments 9 to 13, wherein the profiling traffic includes all-to-all traffic, nearest neighbor traffic, a composite traffic profile, or any preferred combination thereof.

[0119] Embodiment 15 is a method according to any one of Embodiments 9 to 14, wherein assigning the start and end addresses of the shared memory to each port involves calling an application programming interface (API) by a device other than the ASIC.

[0120] Embodiment 16 is one of the methods of Embodiments 9 to 15, wherein the process is executed on an ASIC using a machine learning accelerator communication network and allocated shared memory. In some embodiments, the process is to train a neural network.

[0121] Embodiment 17 is a method according to any one of Embodiments 9 to 16, wherein the ASIC is a tensor processing unit (TPU).

[0122] Embodiment 18 is a system comprising one or more computers and one or more storage devices for storing instructions, wherein, when executed by one or more computers, the instructions are operable to cause one or more computers to perform the method described in any of claims 9 to 17.

[0123] Embodiment 19 is a computer storage medium encoded by a computer program, which, when executed by a data processing device, includes instructions operable to cause the data processing device to perform the method according to any one of claims 9 to 17.

[0124] Embodiment 20 is a method for allocating memory for a machine learning accelerator communication network, the method comprising determining a network topology for a network of machine learning accelerator application-specific integrated circuits (ASICs). Metadata associated with a plurality of communication ports of each ASIC in the network is accessed. For each of the plurality of ports, the metadata identifies whether a particular port is used in the current architecture and communication medium associated with that port. For each of the plurality of ports, the metadata identifies whether a particular port is used in the current configuration and the communication medium associated with that port. A round-trip time (RTT) delay is determined for each port used in the network topology. A portion of shared memory is allocated to each of the plurality of ports, the allocation being done by determining a memory allocation for each port proportional to the RTT delay and assigning start and end addresses of the shared memory to each port for the determined memory allocation. A process is executed on the ASIC, and the process uses the machine learning accelerator communication network together with the allocated shared memory. During process execution, the number of message packets received at each port of the multiple ports is determined over a first period. Based on the number of message packets received at each port, a desired partial size of the shared memory is determined for each port of the multiple ports. During a second period, the process is paused, and it is determined whether the shared memory is cleared for pending message packets. If the shared memory is cleared, the start and end addresses of the shared memory are reallocated for each port according to the desired partial size, and process execution resumes.

[0125] Embodiment 21 is the method of Embodiment 20, wherein assigning the start and end addresses of the shared memory to each port involves calling an application programming interface (API) by a device other than the ASIC.

[0126] Embodiment 22 is the method according to Embodiment 20 or 21, wherein the process is executed on an ASIC using a machine learning accelerator communication network and allocated shared memory. In some embodiments, the process is to train a neural network.

[0127] Embodiment 23 is the method according to any one of Embodiments 20 to 22, wherein the ASIC is a tensor processing unit (TPU).

[0128] Embodiment 24 is a system comprising one or more computers and one or more storage devices for storing instructions, wherein, when executed by one or more computers, the instructions are operable to cause one or more computers to perform the method according to any one of claims 20 to 23.

[0129] Embodiment 25 is a computer storage medium encoded by a computer program, which, when executed by a data processing device, includes instructions operable to cause the data processing device to perform the method according to any one of claims 20 to 23.

[0130] The descriptions above are provided in the context of one or more specific implementations. Various modifications, alterations, and substitutions of the disclosed implementations are possible without departing from the scope of this disclosure. Accordingly, this disclosure is not intended to be limited to the implementations described or shown, but should be given the broadest scope consistent with the principles and features disclosed herein.

[0131] Specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. For example, while bus lines are described as “controllable,” not all bus lines need to have the same level of control. For example, there can be variations in the degree of controllability, with only some bus lines being controllable, and some bus lines being limited with respect to the number of tiles from which data can be sent, or the number of tiles to which data can be transmitted. In another example, some bus lines may be dedicated to providing data along a single direction, such as north, east, west, or south, as described herein. In some cases, the operations described in the claims may be performed in a different order, and the desired results may still be achieved. As an example, the processes shown in the appended drawings do not necessarily require a specific order or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.

[0132] The subject matter and functional operating embodiments described herein may be implemented in digital electronic circuits, in computer hardware including the structures disclosed herein and their structural equivalents, or in one or more combinations thereof. Embodiments of the subject matter described herein may be implemented as one or more computer programs, that is, as one or more modules of computer program instructions encoded on a tangible, non-temporary program carrier for execution by a data processing device or for control of the operation of a data processing device. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagating signal, which is, for example, a machine-generated electrical signal, optical signal, or electromagnetic signal generated to encode information for transmission to a receiver device suitable for execution by a data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage board, a random or serial access memory device, or one or more combinations thereof.

[0133] The term "data processing device" encompasses all types of devices, machines, and equipment for processing data, including, for example, programmable processors, computers, or multiple processors or computers. Such devices may include special-purpose logic circuits, such as FPGAs (Field-Programmable Gate Arrays) or ASICs. In addition to hardware, such devices may also include code that creates an execution environment for the computer program, such as processor firmware, protocol stacks, database management systems, operating systems, or code that constitutes one or more of these.

[0134] The processes and logic flows described herein may be executed by one or more programmable computers running one or more computer programs to perform functions by acting on input data and generating outputs. The processes and logic flows may further be executed by dedicated logic circuits, such as FPGAs, ASICs, or GPGPUs (general-purpose graphics processing units), and the apparatus may further be implemented as such dedicated logic circuits.

[0135] This specification includes details of many specific examples, which should not be interpreted as limitations on the scope of any invention or claim, but rather as descriptions of features specific to a particular example of a particular invention. Some features described herein in the context of separate examples may be implemented in combination in a single example. Conversely, various features described in the context of a single example may be implemented separately in multiple examples or in any preferred sub-combination. Furthermore, features may be described above as acting in a particular combination, and may even be initially claimed as such; however, in some cases, one or more features of a claimed combination may be removed from that combination, and the claimed combination may be directed towards a sub-combination or a variation of a sub-combination.

[0136] Similarly, while the actions are depicted in a specific order in the diagrams, this should not be interpreted as requiring that such actions be performed in a specific or sequential order, or that all shown actions be performed, in order to achieve the desired result. In some situations, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system components in the implementations described above should not be interpreted as requiring such separation in all implementations, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.

[0137] In addition to the above description, the user may be provided with controls that allow the user to choose whether and when the systems, programs, or features described herein may enable the collection of user information. Furthermore, certain data may be handled in one or more ways before being stored or used so that personally identifiable information is removed. For example, a user's identity may be handled so that personally identifiable information is not determined about the user, or the user's skin data and / or diagnoses may not be identifiable when associated with the user. Thus, the user may have control over what information is collected about them and how that information is used.

[0138] Thus, specific implementations of the subject matter have been described. Other implementations are within the scope of the attached claims. In some cases, the operations enumerated in the claims may be performed in a different order, and the desired results may still be achieved. In addition, the processes shown in the attached drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.

Claims

1. 1. A computer-implemented memory allocation method for a machine learning accelerator communication network, the method comprising: accessing metadata associated with a plurality of communication ports of an application specific integrated circuit (ASIC), the metadata identifying, for each port of the plurality of ports, whether the respective port is used in a current configuration and a communication medium associated with the respective port; The method further comprises: determining an expected latency for each port of the plurality of ports based on the accessed metadata; allocating a portion of the shared memory to each port of the plurality of ports; The allocating step comprises: Allocating zero memory for unused ports; determining a memory allocation for each port based on the expected latency; assigning a start address and a stop address of the shared memory to each port; A method carried out by.

2. 2. The method of claim 1, wherein assigning the starting address and the stopping address of the shared memory to each port comprises invoking an application programming interface (API) by a device different from an ASIC.

3. 3. The method of claim 1 or 2, comprising executing a process on the ASIC, the process using the machine learning accelerator communication network and the allocated shared memory.

4. The method of claim 3 , wherein the process includes training a neural network.

5. The method according to any one of claims 1 to 4, wherein the ASIC is a tensor processing unit (TPU).

6. The communication medium identified in the metadata is: Copper cable medium, Optical media, or Printed Circuit Board (PCB) Media The method according to any one of claims 1 to 5, comprising at least one of:

7. The memory allocation is [0010] The method according to any one of claims 1 to 6, wherein the method is determined based on

8. 1. A computer-implemented memory allocation method for a machine learning accelerator communication network, the method comprising: determining a network topology for a network of machine learning accelerator application specific integrated circuits (ASICs); accessing metadata associated with a plurality of communication ports of each ASIC in the network, the metadata identifying, for each port of the plurality of ports, whether the respective port is used in a current configuration and a communication medium associated with the respective port; The method further comprises: determining a round trip time (RTT) delay for each port used in the network topology; allocating a portion of the shared memory to each port of the plurality of ports; The allocating step comprises: determining a memory allocation for each port proportional to the RTT delay; assigning a start address and a stop address of the shared memory to each port for the determined memory allocation; It is carried out by The method further comprises: executing a process on the machine learning accelerator to transmit profiling traffic to the network for a predetermined duration; determining, for each port, a number of traffic packets received; and reallocating a portion of the shared memory to each port of the plurality of ports; The reallocating step comprises: determining a memory allocation for each port proportional to the number of traffic packets received; reassigning the start address and the stop address of the shared memory to each port for the determined memory allocation; A method carried out by.

9. 9. The method of claim 8, wherein assigning and reassigning the starting and stopping addresses of the shared memory to each port comprises invoking an application programming interface (API) by a device different from an ASIC.

10. 10. The method of claim 8 or 9, comprising executing a process on the ASIC, the process using the machine learning accelerator communication network and the allocated shared memory.

11. The method of claim 10 , wherein the process includes training a neural network.

12. The method according to any one of claims 8 to 11, wherein the ASIC is a tensor processing unit (TPU).

13. The memory allocation proportional to the determined RTT delay is [0025] The method according to any one of claims 8 to 12, wherein the method is determined based on

14. The memory allocation for each port, proportional to the number of packets received, is [0030] The method according to any one of claims 8 to 12, wherein the method is determined based on

15. A method according to any one of claims 8 to 14, wherein the RTT delay is calculated prior to execution by sending and receiving one or more timing messages to determine the latency.

16. The profiling traffic includes: All-to-all traffic, Nearest neighbor traffic, or Synthetic Traffic Profiles The method according to any one of claims 8 to 15, wherein the method is at least one of the following:

17. 1. A computer-implemented memory allocation method for a machine learning accelerator communication network, the method comprising: determining a network topology for a network of machine learning accelerator application specific integrated circuits (ASICs); accessing metadata associated with a plurality of communication ports of each ASIC, the metadata identifying, for each port of the plurality of ports, whether the respective port is used in the current configuration and a communication medium associated with the respective port; The method further comprises: determining a round trip time (RTT) delay for each port used in the network topology; allocating a portion of the shared memory to each port of the plurality of ports; The allocating step comprises: determining a memory allocation for each port proportional to the RTT delay; assigning a start address and a stop address of the shared memory to each port for the determined memory allocation; It is carried out by The method further comprises: executing a process on an ASIC, the process using the machine learning accelerator communication network with the allocated shared memory; The method further comprises: During the execution of said process, determining a number of message packets received at each port of the plurality of ports over a first time period; determining a desired portion size of the shared memory for each port of the plurality of ports based on the number of message packets received at each port; pausing the process for a second period of time; and determining that the shared memory is clear of pending message packets; reassigning the starting address and the stopping address of the shared memory to each port for the desired portion size; resuming execution of said process; A method comprising:

18. 20. The method of claim 17, wherein assigning and reassigning the starting and stopping addresses of the shared memory to each port comprises invoking an application programming interface (API) by a device different from an ASIC.

19. 19. The method of claim 17 or 18, wherein the ASIC is a tensor processing unit (TPU).

20. The method of any one of claims 17 to 19, wherein the process comprises training a neural network.

21. A program that causes a computer to execute the method described in any one of claims 1 to 20.