1. Technical Field
Generally, the disclosed embodiments relate to integrated circuits, and, more particularly, to timestamp counters used in integrated circuits.
2. Description of the Related Art
Integrated circuit devices, such as computer processors, may make use of timestamps to provide a time context to various elements of the integrated circuit and/or software being executed by one or more elements of the integrated circuit. Timestamps may be generated by timestamp counters (TSCs). TSCs generally supply software with a time context necessary for many software-based decisions. TSCs are also helpful in providing debug information when included with other debug state in the processor. For example, timestamps may allow a debugging operation to better understand possible causes of various operational errors of the processor.
Different parts of a processor system require access to TSCs. Among the elements requiring such access are one or more compute units, e.g., a CPU, a core of a multi-core CPU, a GPU, a core of a multi-core GPU, an APU, a core of a multi-core APU, etc. To reduce the latency of accesses by a compute unit to a TSC, it may be desirable for each compute unit to have a local TSC, which may be accessed with lower latency than a system-wide, or master TSC.
The presence of multiple TSCs, i.e., a master TSC and at least one local TSC, in a computer system could create a potential problem for system operations. Generally, at any given time, multiple processes are running in a system. Each process may receive timestamps from one or more TSCs, and generally, the entire population of processes will receive timestamps from substantially all of the TSCs in the system. Because desynchronization of the timestamps seen by one or more processes may lead to faulty operation of a process or processes, it is desirable to keep all TSCs synchronized across the system, so that each consumer of a TSC reads a similar timestamp from the TSC at any given time.
Desynchronization of timestamps may arise from the inherent complexity of operations of modern computer systems. Also, certain events can corrupt a local TSC, such as a power event, e.g., clock frequency changes or powering down of a compute unit or a core thereof
Other workers have attempted to prevent desynchronization of, and/or synchronize, master and local TSCs by making use of dedicated hardware between each instantiation of the TSC that forces synchronization between the master and local TSCs. This provides a high level of confidence that the TSCs are synchronized, but requires additional hardware to be designed, fabricated, and operated.
Another possible approach can be attempted if the TSCs are accessible via the memory bus hierarchy, i.e., are in a memory mapped configuration access. Local hardware can then use the existing memory bus hierarchy to read the master TSC copy and write it to the local TSC copy. This avoids the need for additional hardware, but provides little confidence that a good synchronization occurred. Confidence is low because the bus hierarchy can have other traffic that delays the synchronization process. For example, between the master TSC read and the local TSC write, if other bus requests occur that delay the local TSC write, then when the local TSC write finally occurs, the master TSC could have increased substantially and indeterministically.
The apparatuses, systems, and methods in accordance with the embodiments disclosed herein may facilitate synchronization of master and local timestamp counters in a computer system, thereby facilitating the execution by the computer system of software making use of master and local timestamps, and/or debugging operations by the computer system making use of logs timed by master and local timestamps. Mechanisms controlling and implementing such a process may be formed within a microcircuit by any means, such as by growing or deposition.
Some embodiments provide an integrated circuit device that includes a master timestamp counter (TSC) configured to provide a master timestamp; a compute unit comprising a local TSC, wherein the local TSC is configured to provide a local timestamp; a memory, comprising a first memory location to which the master TSC is memory mapped, a second memory location to which the local TSC is memory mapped, and a memory bus configured to allow atomic reading from at least the first memory location and atomic writing to at least the second memory location in response to receiving a bus-lock command; wherein the compute unit is configured to issue the bus-lock command to the memory bus, in response to an event that desynchronizes the master TSC and the local TSC; read the master timestamp from the master TSC via the first memory location; write the local timestamp to the local TSC via the second memory location, to synchronize the local TSC with the master TSC; and issue a bus-unlock command to the memory bus.
Some embodiments provide a method that includes sending, to a memory bus, in response to an event that desynchronizes a master TSC and a local TSC, a bus-lock command to perform atomic reading from a first memory location and atomic writing to a second memory location; reading a master timestamp from the master TSC via the first memory location; writing a local timestamp to the local TSC via the second memory location, to synchronize the local TSC with the master TSC; and sending, to the memory bus, a bus-unlock command, wherein the master TSC is memory mapped to the first memory location and the local TSC is memory mapped to the second memory location.
The embodiments described herein may be used in any type of integrated circuit that comprises a master TSC and a compute unit comprising a local TSC. One example is a general purpose microprocessor.
The disclosed subject matter will hereafter be described with reference to the accompanying drawings, wherein like reference numerals denote like elements, and:
While the disclosed subject matter is susceptible to various modifications and alternative forms, specific embodiments thereof have been shown by way of example in the drawings and are herein described in detail. It should be understood, however, that the description herein of specific embodiments is not intended to limit the disclosed subject matter to the particular forms disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the disclosed subject matter as defined by the appended claims.
Embodiments provide for synchronizing a master timestamp counter and a local timestamp counter in a computer system. Such synchronization may improve the execution of software by the computer system and/or facilitate debugging of operations of the computer system.
Turning now to
The computer system 100 may also comprise a northbridge 145. Among its various components, the northbridge 145 may comprise a master TSC 132 that may provide a master timestamp to other elements of the computer system 100.
The computer system 100 may also comprise a memory 155 (e.g., a DRAM). The memory 155 may comprise a plurality of memory locations, such as a first memory location 158a and a second memory location 158b. The memory 155 may comprise memory controller 157 a memory bus 156 for receiving read and write requests from computer unit 135, northbridge 145, and/or other elements of the processor 110 and/or computer system 100. The memory controller 157 may control various operations of the memory 155.
In some embodiments, the master TSC 132 and the local TSC 140 may be memory mapped. In other words, the compute unit 135 may “see” master TSC 132 as being located at first memory location 158a and local TSC 140 as being located at second memory location 158b. Memory mapping may be affected by memory bus 156. The compute unit 135 may then read from and write to master TSC 132 by reading from and writing to first memory location 158a, and read from and write to local TSC 140 by reading from and writing to second memory location 158b. Memory bus 156 may periodically, and/or in response to a read or write request, ensure the contents of the first memory location 158a match the contents of master TSC 132, and likewise for second memory location 158b and local TSC 140.
Memory bus 156 may also be configured to receive bus-lock and bus-unlock commands. Such commands may be issued or sent by a compute unit 135 or another element of the computer system 100, e.g., a GPU 125 or a southbridge 150, among others. Such commands may refer to one or more memory locations within memory 155, such as first memory location 158a and/or second memory location 158b. A bus-lock command instructs the memory bus 156 to perform atomic reading and writing of the referred memory location(s). “Atomic” is used herein to mean that a series of operations, e.g., reading and writing of the referred memory location(s), is performed such that all the operations are performed in series without any intervening operations.
Upon receipt of a bus-lock command, memory bus 156 may allow existing requests by compute unit 135 and/or referencing location(s) within memory 155, such as first memory location 158a and/or second memory location 158b, to be completed before permitting the atomic reading and writing. In some embodiments, memory bus 156 will allow existing requests to be completed before permitting the atomic reading and writing. In some embodiments, memory bus 156 may terminate existing requests before permitting the atomic reading and writing.
Bus-locking may thus allow, without interruption from other operations, the compute unit 135 to read the master timestamp from master TSC 132 via the memory map of master TSC 132 to first memory location 158a, followed by writing a local timestamp to local TSC 140 via the memory map of local TSC 140 to second memory location 158b. The local timestamp written to local TSC 140 may be the same as the master timestamp read from master TSC 132, or it may differ from the master timestamp by a known, unchanging number of system clock cycles and/or length of time. If either of the foregoing conditions obtain, the local TSC 132 may be considered synchronized with the master TSC 140.
Upon receipt of a bus-unlock command, memory bus 156 may cease to perform atomic reading and writing of the referred memory locations, e.g., first memory location 158a and/or second memory location 158b. The compute unit 135 may issue a bus-unlock command at any time after writing the local timestamp to local TSC 140. In some embodiments, the compute unit 135 may verify the master TSC and the local TSC are synchronized before issuing the bus-unlock command.
The computer system 100 may as a routine matter comprise other known units and/or components, e.g., one or more I/O interfaces 131, a southbridge 150, a data storage unit 160, display unit(s) 170, input device(s) 180, output device(s) 185, and/or peripheral devices 190, among others.
The computer system 100 may also comprise one or more data channels 195 for communication between one or more of the components described above.
Turning now to
Turning now to
The circuits described herein may be formed on a semiconductor material by any known means in the art. Forming can be done, for example, by growing or deposition, or by any other means known in the art. Different kinds of hardware descriptive languages (HDL) may be used in the process of designing and manufacturing the microcircuit devices. Examples include VHDL and Verilog/Verilog-XL. In some embodiments, the HDL code (e.g., register transfer level (RTL) code/data) may be used to generate GDS data, GDSII data and the like. GDSII data, for example, is a descriptive file format and may be used in some embodiments to represent a three-dimensional model of a semiconductor product or device. Such models may be used by semiconductor manufacturing facilities to create semiconductor products and/or devices. The GDSII data may be stored as a database or other program storage structure. This data may also be stored on a computer readable storage device (e.g., data storage units, RAMs, compact discs, DVDs, solid state storage and the like) and, in some embodiments, may be used to configure a manufacturing facility (e.g., through the use of mask works) to create devices capable of embodying various aspects of some embodiments. As understood by one or ordinary skill in the art, this data may be programmed into a computer, processor, or controller, which may then control, in whole or part, the operation of a semiconductor manufacturing facility (or fab) to create semiconductor products and devices. In other words, some embodiments relate to a non-transitory computer-readable medium storing instructions executable by at least one processor to fabricate an integrated circuit. These tools may be used to construct the embodiments described herein.
The method 400 may also comprise reading at 430 a master timestamp from the master TSC via the first memory location and writing at 440 a local timestamp to the local TSC via the second memory location. The reading at 430 and the writing at 440 may synchronize the local TSC with the master TSC.
In some embodiments, the reading at 430 and the writing at 440 may be considered sufficient to synchronize the local TSC and the master TSC. In other embodiments, the method 400 may further comprise verifying at 460 the master TSC and the local TSC are synchronized prior to the sending the bus-unlock command. If their synchronization is verified at 460, the bus-unlock command may be sent at 450 to the memory bus. If the master TSC and the local TSC are not synchronized, flow may return to reading at 430, with rereading the master timestamp from the master TSC via the first memory location; rewriting the local timestamp to the local TSC via the second memory location, to synchronize the local TSC with the master TSC; and reverifying the master TSC and the local TSC are synchronized prior to the sending the bus-unlock command.
The methods illustrated in
The particular embodiments disclosed above are illustrative only, as the disclosed subject matter may be modified and practiced in different but equivalent manners apparent to those skilled in the art having the benefit of the teachings herein. Furthermore, no limitations are intended to the details of construction or design herein shown, other than as described in the claims below. It is therefore evident that the particular embodiments disclosed above may be altered or modified and all such variations are considered within the scope and spirit of the disclosed subject matter. Accordingly, the protection sought herein is as set forth in the claims below.