asim /awb training

48
Asim/AWB Training Mohit Gambhir Intel Massachusetts Content: Joel Emer, Michael Pellauer, Chris Weaver

Upload: yuki

Post on 15-Feb-2016

167 views

Category:

Documents


2 download

DESCRIPTION

Asim /AWB Training. Mohit Gambhir Intel Massachusetts Content: Joel Emer, Michael Pellauer , Chris Weaver. Agenda. AWB Overview Modular Software Design AWB Abstractions & Terminology AWB Tools Configuration File Formats Asimcore ( libasim ) Overview . AWB . Architects Workbench - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Asim /AWB Training

Asim/AWB Training

Mohit GambhirIntel Massachusetts

Content: Joel Emer, Michael Pellauer, Chris Weaver

Page 2: Asim /AWB Training

Agenda AWB Overview Modular Software Design AWB Abstractions & Terminology AWB Tools Configuration File Formats Asimcore (libasim) Overview

Page 3: Asim /AWB Training

AWB

Architects Workbench Originally written to

create software performance models

Core Principle: Modularity AWB facilitates the

modular plug-n-play style construction of software and hybrid software/hardware projects

Page 4: Asim /AWB Training

AWB (contd.) A suite of tools to support rapid modular

construction and analysis of performance model GUI and command-line based Publically released under the GPL (models are not)

Across Multiple: Code bases:

Different repositories, or even types of repositories Model configurations:

Alternative modules, knobs, levels of accuracy ISA variations Benchmark suites Results from different runs, etc.

Page 5: Asim /AWB Training

Why Modularity Speed of model development Shared components between products Reuse across generations Encourages isomorphism to design Improved fidelity Facilitates speed/fidelity trade-offs Architectural experimentation Factorial development and evaluations Sharing

Page 6: Asim /AWB Training

AWB Abstractions & Terminology Packages (codebases) are stored in repositories Packages can be grouped into related bundles Users check out bundles into local workspaces The set of packages in a workspace is viewed a

Union Dir Bundle packages contain modules (modular source

code) Modules are arranged into models (configurations) Each workspace can contain multiple model build

directories Each build directory can contain multiple

benchmark runs

Page 7: Asim /AWB Training

AWB Abstractions and Terminology Workspace Configure (a model) Repository Bundle Package Model Module Uniondir Search Path

Page 8: Asim /AWB Training

Workspace Directory where one works on the AWB based

project awb commands that need a workspace

context in which to operate search up the directory tree until they find the root of a workspace.

contain a stylized directory structure

Page 9: Asim /AWB Training

Workspace

Page 10: Asim /AWB Training

Configure Collect a set of source files together that can be

built into a specific design or model The specific set of modules (and hence source code)

that comprise a specific model are specified in an .apm file. 

Since a model is created from a pool of modules, the build paradigm adds a new step to “configure” a model source tree from a pool of modules.

Thus given an .apm file, the configure process involves placing copies of the designated source files (via symbolic links) and some automatically created glue files into a model-specific subtree in the build area of the workspace.

Page 11: Asim /AWB Training

Repository A repository is a source code repository

using one of the supported source code management systems.

Supported versioning systems - CVS, SVN, Bitkeeper and git

Repository specification <repository-name>[/<version>]

The set of available repository names are specified in a .pack file. <INSTALLDIR>/etc/respositories/<package-

name>.pack ~/.asim/respositories/<package-name>.pack

Page 12: Asim /AWB Training

Bundle Collection of repositories (with optional

versions) – used to checkout a group of packages together.

Bundle specification <bundle_name>[/<bundle_version>]

Bundles are specified in bundlefiles <INSTALLDIR>/etc/asim/bundles.d/ ~/.asim/bundles.d/

http://asim.csail.mit.edu/redmine/projects/awb/wiki/Bundlefiles

Page 13: Asim /AWB Training

Package

Page 14: Asim /AWB Training

Package Portion of repository that is checked out in the

workspace  the configure/Makefile.in/Makefile files are

optional and do not build a user's model, but simply the tools that might exist in the package

Globally installed packages that can be shared by all users <INSTALLDIR>/share/asim/<package>/<release>

Private packages: <workspace>/src/<package>

Page 15: Asim /AWB Training

Model An AWB model is a hierarchical representation of

a design, where each node of the hierarchy is a module

Each workspace may have multiple models configured/built each constructed plug-n-play style out of the pool of modules available in all packages in a workspace

Represented in .apm file Typically found in config/pm directory inside a package Can be edited by apm-edit

In the AWB editor GUI, models are marked with an icon which looks like a double cog 

Page 16: Asim /AWB Training

Module Modules represent the unit of “swapability” in

source code If two modules provide the same awb type then

this is an assertion that they can be swapped for one another and that the result will be a coherent model that will successfully build

Each module is specified in an .awb file which specifies ‘awb-type’of the module, Awb-types of the children modules that it 'requires' Source files that implement the module.

Page 17: Asim /AWB Training

Uniondir Search Path awb supports a union mount-like directory

structure that overlays the files from a set of packages.

This set of packages is specified as a uniondir search path

File references resolved through search of all package directories in the search path

Packages added to search path at checkout awb-resolver config/pm/simcore/model.apm

/home/mgambhir/asim/src/asim-simcore/config/pm/simcore/model.pm

Page 18: Asim /AWB Training

AWB Operation Example

Repositories Workspace

Page 19: Asim /AWB Training

AWB Tools awb-shell awb apm-edit

Page 20: Asim /AWB Training

Awb-shell This is a program that provides a command

line interface to manipulate various ASIM objects.

Has default values for these Asim objects Can set reset default values through set command

help command displays all possible commands http://asim.csail.mit.edu/redmine/projects/awb/wik

i/Awb-shell awb-shell help quickstart

Page 21: Asim /AWB Training

Awb-shell% awb-shell awb> set model pm/Arana/arana_aint_dev.apm awb> clean model awb> configure model awb> build model awb> run model bm/Micro/maxipc.cfg awb> quit

% awb-shell awb> set model pm/Arana/arana_aint_dev.apm awb> clean model awb> configure model awb> build model awb> run model bm/Micro/maxipc.cfg awb> quit % awb-shell --package=arana commit package % awb-shell help % awb-shell help code

Page 22: Asim /AWB Training

Awb-shell Primer for most commonly used awb-shell

wrapped svn commands awb-shell checkout package <name> awb-shell update package <name> awb-shell commit package <name>

Make sure that environment variable EDITOR is set to your favorite EDITOR

setenv EDITOR vi awb-shell checkout package <name>/<branch>

To checkout a package branch awb-shell checkout package <name>/<rev>

To checkout a particular revision of a package

Page 23: Asim /AWB Training

Awb-shell Bundle commands

awb-shell new bundle <name>[/<tag>] By default takes a snapshot of packages in the current

workspace By default adds the file into ~/.asim/bundles/release Use --head to specify the head version Use --install to publicly install in /p/asim

Requires asimadm permissions awb-shell checkout bundle <name>[/<tag>] awb-shell update bundle <name>[/<tag>] awb-shell show bundle <name>[/<tag>]

Page 24: Asim /AWB Training

Awb cd into your workspace Type: “awb”

Page 25: Asim /AWB Training

Awb

Page 26: Asim /AWB Training

Awb

Lets Select an ape softsdv model

Page 27: Asim /AWB Training

Awb

Nuke

Page 28: Asim /AWB Training

Awb

Configure

Page 29: Asim /AWB Training

Awb

Build

Page 30: Asim /AWB Training

Apm-edit

Page 31: Asim /AWB Training

Apm-edit

Page 32: Asim /AWB Training

Configuration File formats Workspace configuration: awb.config

http://asim.csail.mit.edu/redmine/projects/awb/wiki/Awbconfig

Model description: .apm file http://asim.csail.mit.edu/redmine/projects/awb/wiki/Apm_fi

le

Module description: .awb file http://asim.csail.mit.edu/redmine/projects/awb/wiki/Awb_fi

le Benchmark description: .cfg file http://asim.csail.mit.edu/redmine/projects/awb/wiki/Cfg_file Multiple benchmark description: .cfx file

http://asim.csail.mit.edu/redmine/projects/awb/wiki/Cfx_file

Page 33: Asim /AWB Training

Asimcore (libasim) overview Clocking Ports Stats

Page 34: Asim /AWB Training

Clocking Cycle accurate models:

Hierarchical and explicit time controlvoid ASIM_CPU_CLASS::Clock (UINT64 cycle){ efmmbx.Clock(cycle); mbx.Clock(cycle); qbx.Clock(cycle); ibx.Clock(cycle); …}

Clock Serverbool ASIM_RBOX_CLASS::InitModule (){ ostringstream os; os << "SYSINT_CLOCK_DOMAIN_" << myUniqueRboxId; RegisterClock(os.str());}

Clock techniques can be combined

Page 35: Asim /AWB Training

Clocking Creating Clock domains

void newClockDomain (string name, float freq, INT32 threadId = -1)

void newClockDomain (string name, list<float> freqs, INT32 threadId = -1)

List of valid frequencies

Page 36: Asim /AWB Training

Clocking Set Domain Frequencyvoid setDomainFrequency (string domainName, float freq)

Register Clockvoid RegisterClock (string domainName, UINT32 skew = 0,

INT32 threadId = -1, bool referenceDomain = false)

void RegisterClock (string domainName, CLOCK_CALLBACK_INTERFACE cb, UINT32 skew = 0, INT32 threadId = -1, bool referenceDomain = false)

void RegisterClock (string domainName, CLOCK_CALLBACK_INTERFACE cb, CLK_EDGE ed, UINT32 skew = 0, INT32 threadId = -1, bool referenceDomain = false)

Page 37: Asim /AWB Training

Clockingtemplate<class T> CLOCK_CALLBACK_INTERFACE

newCallback (T *obj, void (T::*meth)(UINT64))

Traditionally all the module work happen in one method:

void Clock(UINT64 cycle)

Callbacks enable: Having more that one clock method in a module Clocking a module at different frequencies

Page 38: Asim /AWB Training

Clockingbool ASIM_CBOX_CLASS::InitModule (){

…ostringstream os;os.str(""); os << "RING_CLOCK_DOMAIN_" << myChipNum;RegisterClock(os.str()); os.str(""); os << "CBOX_CLOCK_DOMAIN_" << myChipNum;RegisterClock(os.str(), newCallback(this, &ASIM_CBOX_CLASS::ClockCBOX));…

}

void ASIM_CBOX_CLASS::ClockCBOX (const UINT64 cycle){ // Clocked at CBOX frequency … }

void ASIM_CBOX_CLASS::Clock (const UINT64 cycle){ // Clocked at Ring frequency … }

Page 39: Asim /AWB Training

Ports

In an Asim model, time only passes when messages flow through ports

Activity within each module is instantaneously fastEach port defines a latency and a bandwidth

BW: Number of abstract objects that can enter/exit in a cycle LAT: Number of cycles that objects travel through port Sender defines BW and receiver defines LAT

Benefits: LAT and BW are often useful knobs for architectural exploration Separates functionality from timing

Encourages reuse Can ease burden of coding

“NetworkInUse” “NetworkInUse”

2

Page 40: Asim /AWB Training

Ports Connect modules Read port and write port make a

connection BW set by writer Latency set be reader What gets passed through ports?

Pointers to objects allows for generic interfaces between modules does make it easier to “cheat” by accessing info that

shouldn’t be available to certain modules Bools & integers

Page 41: Asim /AWB Training

Ports

WritePort<CPU_INST> var1_WPort; var1_WPort.Init("Unique_String"); var1_WPort.SetBandwidth(bandwidth);

ReadPort<CPU_INST> var1_RPort; var1_RPort.Init("Unique_String"); var1_RPort.SetLatency(latency);

Page 42: Asim /AWB Training

Ports

// Write data into the port in cycle CCPU_INST inst;var1_WPort.Write(inst1, cycle);  

// Read data in cycle C + latencyCPU_INST inst2;var2_RPort.Read(inst2, cycle);

Page 43: Asim /AWB Training

Ports

WritePort<CPU_INST, 3> var1_WPort;var1_WPort.Init("Unique_String");var1_WPort.Config(bandwidth);

ReadPort<CPU_INST> var2_RPortvar2_RPort.Init("Unique_String");var2_RPort.Config(latency);

ReadPort<CPU_INST> var3_RPortvar3_RPort.Init("Unique_String");var3_RPort.Config(latency + 1);

ReadPort<CPU_INST> var4_RPortvar4_RPort.Init("Unique_String");var4_RPort.Config(latency +2);

Page 44: Asim /AWB Training

Ports Other Kinds of Ports

Stall Ports Enable reader to stall the port to disable write from

writing Rate Matcher Ports

To connect modules in different frequency domains Skid Ports

Allow lazy reading of data

Page 45: Asim /AWB Training

StatsStat Types

Scalar Stats that comprise of one value collected over the

entire simulation run. For eg. DCacheMisses

Multidimensional (Histograms) These stats show the number of times particular

clusters of events occur. For eg, the number of times N instructions were issued

in a cycle where N for an 8 way processor varies from 0 to 8.

Per Instructions Stats Global Per instruction type Per instruction

Page 46: Asim /AWB Training

Stats Declare the stats data member of a class as a

UINT64, Double, UINT64* or a Double* UINT64 dstreamFull; UINT64 instsRetired[CPU_THREADS];

Register the stats variable with StatsRegistry class RegisterState(dstreamFull, "PremafDstreamFull", "Number of dstream full events");

RegisterState(instsRetired, CPU_THREADS, "RetiredInstructions", "Retired Instructions");

Accumulate Stats dstreamFull++; instRetired[tpu]++;

Page 47: Asim /AWB Training

Stats Histograms Stats

Declaration HISTOGRAM_TEMPLATE<ENABLE_QBOX_STATS> instrIssuedPerCycle

Initilization HISTOGRAM_TEMPLATE (UINT32 num_rows, UINT32 num_cols = 1, UINT32

row_size = 1, BOOL row_flex_cap = FALSE, UINT32 col_size = 1, BOOL col_flex_cap = FALSE)

Register RegisterState(&instrIssuedPerCycle,

"instrIssuedPerCycle", "Number of instructions issued from the IQ per cycle");

Accumulate Stats AddEvent(UINT32 row_val, UINT32 col_val = 0, UINT64 value = 1) AddEventWideBins(UINT32 row_val, UINT32 col_val = 0,

UINT64 value = 1)

Page 48: Asim /AWB Training

Stats Command line switches

-sc <n> Emit stats file every <n> cycles -sn <n> Emit stats file every <n> nanoseconds -si <n> Emit stats file every <n> instructions

-sm <n> Emit stats file every <n> macro instructions

-rsc <n> Reset stats on cycle <n> -rsi <n> Reset stats on instruction <n> -rsm <n> Reset stats on macro instruction <n> -rsn <n> Reset stats on nanosecond <n>

Adding a p after the previous flags (for instance -rscp) will reset stats periodically after <n> events