BookSim 2.0 Interconnection Network Simulator

repository·master·Indexed 19 days ago

https://github.com/booksim/booksim2

A cycle-accurate interconnection network simulator used to model and evaluate network topologies, routing algorithms, and router microarchitectures. It supports mesh, torus, and flattened butterfly structures, as well as arbitrary topologies via the anynet option. Key components include the Allocator for managing connection requests (DenseAllocator and SparseAllocator), BufferPolicy for managing router buffer occupancy (including private and shared policies), and FlitChannel for modeling multi-cycle transmission delays.

Tokens
5.5K
Snippets
15
Records
29
Agent score
65%

What's inside BookSim 2.0

  1. Overview of BookSim Interconnection Network Simulator

    master

    BookSim is a cycle-accurate interconnection network simulator. It is designed to simulate various network topologies, routing algorithms, and router microarchitectures.

    Key features of BookSim 2.0 include:

    • Topology Support: Supports mesh, torus, flattened butterfly, and other network structures.
    • Routing: Provides diverse routing algorithms.
    • Customization: Offers numerous options for customizing router microarchitecture.

    This tool is commonly used in research for evaluating interconnection networks.

  2. Use the Tree4 network topology

    master

    The Tree4 class implements a network topology consisting of 64 terminal nodes arranged in a tree structure with 4 routers at the root. It is a subclass of Network and can be instantiated using a Configuration object and a name string. This topology provides utility methods to map node IDs to their specific height and position within the tree, which is useful for custom routing or analysis.

    // Example instantiation (conceptual)
    Tree4 my_tree(config, "my_tree_network");
  3. Configure CMesh topology

    master

    The CMesh class implements a Mesh topology that supports concentration and express links along the network edges. It is initialized via the CMesh constructor, which requires a Configuration object and a name string. The topology's dimensions and features (like express channels) are determined by the parameters provided in the Configuration object.

    CMesh my_network(config, "my_cmesh_network");
  4. Compare DenseAllocator and SparseAllocator

    master

    BookSim provides two primary implementations of the Allocator interface, which can be selected via the alloc_type string in NewAllocator:

    1. DenseAllocator: Stores the entire request matrix. This is useful for smaller port counts where the overhead of a full matrix is negligible or when specific matrix-based access patterns are required.
    2. SparseAllocator: Uses sets and maps to store only active requests. This implementation is more memory-efficient for large-scale networks where the number of concurrent requests is much smaller than the total possible input-output combinations.
  5. Configure a FatTree topology

    master
    The FatTree class implements a FatTree interconnection network topology. It is instantiated by passing a Configuration object and a name string to its constructor. The topology is built internally based on the parameters provided in the Configuration object via the _ComputeSize and _BuildNet methods.
  6. Use FlitChannel to model multi-cycle transmission delays

    master

    The FlitChannel class is used to model a communication channel between routers that transmits Flit objects. It supports a multi-cycle transmission delay, where the latency can be specified as an integer number of simulator cycles.

    To use a FlitChannel, you must define its source and sink routers and their respective ports using SetSource and SetSink.

    // Conceptual usage pattern for setting up a channel between routers
    FlitChannel* channel = new FlitChannel(parent_module, "my_channel", num_classes);
    channel->SetSource(source_router, source_port);
    channel->SetSink(sink_router, sink_port);
  7. Implement buffer management policies with BufferPolicy

    master

    BookSim2 uses a policy-based design for managing router buffers. The BufferPolicy class is an abstract base class that defines how buffer space is allocated, tracked, and limited across different Virtual Channels (VCs). Developers can implement or use various subclasses to change how the simulator handles buffer occupancy and flow control.

    Key methods in BufferPolicy include:

    • IsFullFor(int vc): Checks if the buffer is full for a specific VC.
    • AvailableFor(int vc): Returns the number of available slots for a specific VC.
    • LimitFor(int vc): Returns the maximum allowed occupancy for a specific VC.
    • TakeBuffer(int vc): Reserves buffer space.
    • SendingFlit(Flit const * const f): Updates policy state when a flit is sent.
    • FreeSlotFor(int vc): Releases buffer space.

    Policies are instantiated via the static New method, which uses the provided Configuration to determine the correct policy type.

    // Example of how a policy might be instantiated via the factory method
    BufferPolicy * policy = BufferPolicy::New(config, buffer_state_ptr, "my_policy_name");
  8. Configure arbitrary topologies using the anynet option

    master

    The anynet option in BookSim 2.0 allows for the setup of arbitrary network topologies using a listing file. This file describes the connections between modules (routers and nodes) in the network.

    Listing File Syntax

    Each line in the listing file describes the connections for a specific module.

    Router Connections: A line starting with router followed by an ID defines its neighbors. For example: router 0 node 0 node 1 node 2 router 1 This indicates that router 0 is connected to node 0, node 1, node 2, and router 1.

    Implicit Connectivity: Connections are bidirectional. If router 0 is connected to router 1, you do not need to explicitly list router 0 in the connection list for router 1.

    Constraints:

    • Router and node IDs must be unique.
    • A node can only be connected to a single router.

    The updated anynet parser supports link weights to specify channel latency. The format is: [Module ID] [Module ID] [Weight] ...

    Example: Router 0 Router 1 10 Router 2 5 This means Router 0 is connected to Router 1 with a 10-cycle channel and to Router 2 with a 5-cycle channel. If a weight is not provided, it defaults to a single-cycle channel.

    Note on Directionality: Channel latency specifications between routers are not bi-directional. In the example Router 0 Router 1 10, the channel from Router 1 back to Router 0 remains a single-cycle channel unless explicitly specified in the line describing Router 1's connections.

    Routing Behavior

    By default, after parsing the listing file, BookSim builds a routing table in each router describing the minimal path between any two nodes. This results in no path diversity (only a single path exists between any two nodes). To enable path diversity, you must implement a custom routing function.

  9. Configure FeedbackSharedBufferPolicy parameters

    master

    The FeedbackSharedBufferPolicy is a sophisticated policy that adjusts buffer limits based on network latency. It uses the following internal parameters (set via Configuration during construction):

    • _min_latency: The minimum expected latency used in RTT calculations.
    • _aging_scale: Scaling factor for aging/feedback logic.
    • _offset: An offset used in limit calculations.
    • _total_mapped_size: The total buffer capacity available to the policy.

    You can explicitly set the minimum latency using the SetMinLatency(int min_latency) method on the BufferState object, which propagates the call to the underlying policy.

  10. Configure simulation parameters

    master

    BookSim uses a BookSimConfig object to manage simulation settings. Parameters can be provided via a configuration file or as command-line arguments.

    Key configuration keys identified in the entrypoint include:

    • subnets: Integer specifying the number of networks to initialize.
    • sim_power: Integer used to trigger power analysis (if > 0).
    • print_activity: Boolean/Integer to enable activity printing.
    • viewer_trace: Boolean/Integer to enable NoCViewer trace generation.
    • watch_out: String specifying the output file for the watch stream. Use "-" to redirect to stdout or leave empty for no output.
  11. Cite BookSim in research publications

    master

    If you use BookSim in your research, please cite the following paper in your publications:

    Nan Jiang, Daniel U. Becker, George Michelogiannakis, James Balfour, Brian Towles, John Kim and William J. Dally. A Detailed and Flexible Cycle-Accurate Network-on-Chip Simulator. In Proceedings of the 2013 IEEE International Symposium on Performance Analysis of Systems and Software, 2013.

  12. Implement a QTree topology

    master

    The QTree class provides an implementation of a Quad-Tree indirect network. It inherits from the Network base class and is initialized using a Configuration object and a name string. The topology is defined by its height and position within the tree structure, which can be derived from a unique node ID using static helper methods.

    // Example instantiation of a QTree network
    QTree my_qtree(config, "my_qtree_name");