DSA Scheduler API

class Array : public dsa::dfg::Node
#include <array.h>

The base class of an input/output in DFG.

Subclassed by dsa::dfg::DMA, dsa::dfg::Generate, dsa::dfg::Recurrance, dsa::dfg::Register, dsa::dfg::Scratchpad

Public Functions

inline Array()
Array(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
std::vector<double> Consumption(bool checkInput, bool repeat = false, bool reuse = false)

The consumption rate of this array.

inline virtual std::string name() override

The text format name of this array.

inline virtual int bitwidth() override

The scalar bitwidth.

virtual int vectorLanes() = 0
inline int size()

The size of this array.

Protected Attributes

int bitwidth_ = {INT_MAX / 8}
int size_ = {INT_MAX}

Friends

friend class SSDfg
struct ASICResource : public dsa::adg::estimation::Resource

Public Functions

virtual void normalize() override
virtual void scale_cores(int numcores) override
virtual double constrained_resource(int n) override
virtual std::string constrained_resource_name(int n) override
virtual std::vector<double> to_vector() override
virtual std::string dump() override
virtual Resource *clone() const override
inline ASICResource(double p = 0, double o = 0)

Public Members

double power

The estimated power.

double area

The estimated area.

struct Behavior
#include <instruction.h>

The behavior of predicated execution.

Public Functions

inline Behavior(int n)

Public Members

std::vector<bool> backpressure

Back pressure the operand.

bool discard = {false}

Discard the output.

bool reset = {false}

Reset the register file.

bool exec = {true}

Execute the instruction.

struct CandidateRoute

Public Functions

inline void fill_edge(dsa::dfg::Edge *edge, Schedule *sched)
inline void fill_from(dsa::dfg::Node *node, Schedule *sched)
inline void fill_paths_from_undo(CandidateRoute &undo_path, Schedule *sched)
void apply(Schedule *sched)

Public Members

std::unordered_map<dsa::dfg::Edge*, EdgeProp> edges
class Capability
#include <fu_model.h>

The function capability of each processing element.

Public Functions

inline void Add(OpCode op, int count)

Add a FU capability to this PE.

Parameters
  • op – The FU capability.

  • count – The number of FU’s.

inline void Erase(int j)

Erase a FU capability.

Parameters

j – The index of the capability.

inline int get_encoding(OpCode op)
inline bool Capable(OpCode op)
inline Capability()
inline Capability(std::string name)
double area()
double power()
double TotalLut()
double LogicLut()
double RamLut()
double SRL()
double FlipFlop()
double RamB36()
double RamB18()
double URam()
double DSP()

Public Members

std::string name
int max_num_operand = {0}
std::vector<Entry> capability
class CodesignInstance

Public Functions

inline SSModel *ss_model()
inline ~CodesignInstance()
void add_workloads(const std::string &filename, bool is_list)
CodesignInstance(SSModel *model)
void printJson(std::string filename)
inline void printScheduleStats()
inline adg::estimation::Result EstimatePowerArea()
inline void verify()
inline std::string get_changes_log(bool cout = false)
inline std::string get_workload_weights(bool cout = false)
inline std::string get_workload_performances(bool cout = false)
inline std::string get_dfg_performances(bool cout = false)
inline std::string get_spm_performances(bool cout = false)
inline std::string get_l2_performances(bool cout = false)
inline std::string get_dram_performances(bool cout = false)
inline void verify_strong()
inline void add_edges_to_data_node(DataNode *n)
inline void add_random_edges_to_node(ssnode *n, int min_in, int max_in, int min_out, int max_out)
template<typename T>
inline bool delete_nodes(std::function<bool(T*)> f)
inline bool delete_hangers()

Deletes Links and Nodes that can’t be useful.

Returns

true if something is deleted

Returns

false otherwise

inline bool dfg_exceeds_size(SSDfg *dfg, int size)
inline bool all_stated_collapse()

Use Prior to prunning. Will collapse all stated edges that are unused.

Returns

true if a stated edge is collapsed

Returns

false if no stated edge is collapsed

inline void prune_all_unused()
inline void make_random_modification(double temperature)
inline bool add_something(int item_class)

Adds some hardware to the ADG.

65% chance to add a random link 15% chance to add a random switch 10% chance to add a random FU 5% chance to add a random input vport 5% chance to add a random output vport

Parameters

item_class – A random number with the item to modified

Returns

bool whether something was succesfully added in this call.

inline bool remove_something(int item_class)

Removes something from the ADG.

60% Chance to remove a random link 15% Chance to remove a random switch 15% Chance to remove a random FU 5% Chance to remove a random input vector port 5% Chance to remove a random output vector port

Parameters

item_class – A random number with the item to remove

Returns

bool whether something was succesfully removed in this call.

inline bool modify_something(int item_class)

Modifies a node in the ADG.

15% to change flow control 5% to change the utilization of a functional unit 30% chance to change the fifo depth 20% chance to change a functional units fu type 20% chance to change a nodes granularity 5% to change input vport stated 5% to change output vport stated

Parameters

item_class – A random number with the item to modified

Returns

bool whether something was succesfully modified in this call.

inline void for_each_sched(const std::function<void(Schedule&)> &f)

Lambda function to loop through all schedules.

Parameters

f

inline CodesignInstance(const CodesignInstance &c, bool from_scratch)

Construct a new Codesign Instance object.

Parameters
  • c – other codesign instance

  • from_scratch – whether to restart from scratch

Unassigns a link from all schedules.

Parameters

link – the link to unassign

inline void unassign_node(ssnode *node)

Unassigns a node from all schedules.

Parameters

node – the node to unassign

inline void check_stated(ssnode *node)

Checks whether vector port needs to change its stated value.

Parameters
  • node – the node to check

  • deleting – whether a link will be deleted from the schedule

inline sslink *add_link(ssnode *source, ssnode *sink, int souceSlot = -1, int sinkSlot = -1)

Adds a link to the ADG.

inline void delete_link(sslink *link, bool unassign_vport = true)

Delete a link on every schedule.

Parameters

link – link to delete

inline int check_overprovisioning()
inline std::pair<int, std::vector<std::string>> check_schedules()
inline double configuration_performance(int num_cores_local, int num_banks_local, int system_bus_width_local)
inline double dse_sched_obj(Schedule *sched, int cores, int banks, std::string &spm_performance, std::string &l2_performance, std::string &dram_performance)
inline double constrained_system_explore(dsa::adg::estimation::Result prev_estimation, int num_cores, int num_banks, int system_bus_width)
inline void system_bus_explore(int &num_cores, int &num_banks, int &system_bus_width)
inline std::pair<double, double> dse_obj(bool cache_obj = true)
inline std::pair<double, double> weight_obj()
inline std::tuple<float, float, float> utilization()

Gets the utilization ratio of the current codesign instance.

Returns

std::tuple<float, float, float>, the overall, node, and link utilization ratio, respectively of current codesign instance

inline bool stated_mapped(SyncNode *sync)

Checks if a stated Edge is mapped to a vector port.

Parameters

sync – the vector port to check

Returns

true if a stated edge is mapped to this vector port

Returns

false if a stated edge is not mapped to this vector port

inline int countSchedules()
inline void dump_breakdown(bool verbose)
inline bool check_cycle(ssnode *n)

Checks to see if a flip-flop can be removed without causing a cycle in the hardware graph.

Parameters

n – the node to check

Returns

true if there will be no cycle created by removing the node

Returns

false if there will be a cycle created by removing the node

Public Members

std::vector<WorkloadSchedules> workload_array
std::vector<double> weight
std::vector<Schedule*> res
std::pair<double, double> objective = {-1, -1}
int num_cores = 1
int num_banks = 8
int system_bus = 8
std::vector<bool> unused_nodes
std::vector<bool> unused_links
bool sanity_check = {false}
std::string dse_fail_reason = ""
std::string dse_change = "none"
std::vector<std::string> dse_changes_log
double performance = 0
double prior_score = 0
double nodes_score = 0
std::vector<double> workload_performances
std::vector<std::vector<std::pair<std::string, double>>> dfg_performances
std::vector<std::vector<std::pair<std::string, std::string>>> dfg_spm_performances
std::vector<std::vector<std::pair<std::string, std::string>>> dfg_l2_performances
std::vector<std::vector<std::pair<std::string, std::string>>> dfg_dram_performances
std::vector<double> workload_weights
double normalized_resources = 0

Private Functions

inline bool check_cycle_helper(ssnode *n, std::vector<bool> &visited, bool down)

Helper for check_cycle. Will recursively check all nodes to see if there is a cycle.

Parameters
  • n – the node to check

  • visited – the set of nodes that have been visited

  • down – whether to check the upstream or downstream

Returns

true if there is no cycle from removing this node

Returns

false if there is a cycle from removing this node

inline void collapse_vport(SyncNode *vport)

Collapses a vport TODO Fix this.

Parameters

vport – vport to collapse

inline std::unordered_set<sslink*> useful_vport_links(SyncNode *n)
inline void collapse_edge_links(ssnode *n, Schedule::EdgeProp edgeProp, Schedule &sched, std::vector<sslink*> &collapsed_links)

Collapses the links through a node, of a given edge.

Parameters
  • n – node to collapse

  • edge – edge to collapse from

  • sched – currently used schedule

inline void collapse_and_repair(ssnode *n, std::vector<sslink*> &collapsed_links)
inline void stated_collapse(ssnode *n)

Schedule-preserving Transformation for Stated Vector Ports As a stated link must be used as the first link, if we are removing the stated property then we must also remove the first link to preserve the schedule.

Parameters
  • n – the vector port to collapse the stated property

  • preserve_schedule – whether to preserve the schedulability This property is important for prunning which requires schedulability remains

inline void add_fifo_edge(std::unordered_set<ssfu*> &fifos, ssnode *n, Schedule::EdgeProp edge, Schedule &sched)

Adds a fifo depth to all nodes after a given node in the given edge.

TODO: Only Check the last node in an endge

Parameters
  • fifos – set of fu’s that have already have their fifo depth added

  • n – node to collapse

  • edge – edge to check for functional units

  • sched – current schedule to use

inline void delete_node(ssnode *n, bool collapse_links = false, bool forward_vport = false, bool add_fifo = false)

Deletes a node.

When we delete a hardware element, we need to:

  1. deschedule anything that was assigned to that element

  2. remove the concept of that element from the schedule (consistency)

  3. remove the element from the hardware description

Parameters
  • n – node to delete

  • collapse_links – whether to collapse the links of node

  • forward_vport – whether to forward the links of vport

  • add_fifo – whether to add fifo depths to all nodes after

Private Members

SSModel _ssModel
struct CompileMeta : public dsa::dfg::MetaPort

Public Functions

CompileMeta(const MetaPort&, VectorPort*)
inline CompileMeta()

Public Members

VectorPort *parent
VectorPort *destination
struct ConstDataEntry : public dsa::dfg::ParseResult
#include <symbols.h>

Const data, including literal values and literal tuples.

Public Functions

inline ConstDataEntry(uint64_t i)
inline ConstDataEntry(uint64_t i1, uint64_t i2)
inline ConstDataEntry(uint64_t i1, uint64_t i2, uint64_t i3, uint64_t i4)
inline ConstDataEntry(double d)
inline ConstDataEntry(float f0, float f1)

Public Members

float f0
float f1
double d
uint64_t data
union dsa::dfg::ConstDataEntry::[anonymous] [anonymous]
struct ContextFlags

Public Functions

ContextFlags()
void Load(const cxxopts::ParseResult &pr)

Public Members

bool verbose = {false}

If this execution instance is verbose on logs.

int max_iters = {20000}

The max number of iterations of the instruction.

int timeout = {86400}

The max time cutoff of scheduling.

int dse_timeout = {-1}

The max time cutoff of design space exploration.

int num_schedule_workers = {1}

The number of workers on the schedule function.

bool bitstream = {false}

If we want to dump the binary.

bool dummy = {false}

If we only want to schedule the ports to emulate the simulation.

bool tolerate_unuse = {false}

If true, do not throw an error when there are unused values in the DFG.

double route_along = {0.0}

The probability of routing along.

adg::estimation::Hardware dse_target = {adg::estimation::Hardware::ASIC}

The target of design space exploration.

adg::estimation::Resource *budget = {nullptr}

The budget of design space exploration.

adg::estimation::Resource *core_resources = {nullptr}

Resources occupied by the host core.

bool adg_compat = {false}

Parse the adg in compatible mode.

Public Static Functions

static ContextFlags &Global()
static EnvCache &CachedEnv()
struct ControlEntry : public dsa::dfg::ParseResult
#include <symbols.h>

The converted predication A = F(B, C, ctrl=D{0:b0, 1:b1}) Here ctrl=xx will be parsed as control entry.

Public Functions

ControlEntry(const std::string &s, ParseResult *controller_)
ControlEntry(const std::string &s, std::map<int, std::vector<std::string>> &bits_, ParseResult *controller_, int bmss = -1)

Public Members

int bmss
OperandType flag
ParseResult *controller
std::map<int, std::vector<std::string>> raw
struct ConvergeEntry : public dsa::dfg::ParseResult
#include <symbols.h>

Value concatnation A = B:0:7 C:0:7 Here B:0:7 and C:0:7 are concatenated and bind to A.

Public Members

std::vector<ValueEntry*> entries
struct CtrlBits
#include <instruction.h>

The control predication LUT. In the MICRO architecture, it is a \lfloor 64 / Total \rfloor-LUT, each the result is a Total-bit vector.

Public Types

enum Control

The predicated behaviors.

Values:

Public Functions

CtrlBits(const std::map<int, std::vector<std::string>> &raw, int bmss)

Construct a new CtrlBits with a parsed raw map.

Parameters

raw – The parsed raw map from the control list.

CtrlBits(const std::vector<int> &v)

Decode the format from json serialization.

inline CtrlBits &operator=(const CtrlBits &b)

Assignment constructor.

std::string toString() const

Dump textformat for debugging.

std::vector<int> encode()

Encode this map lut in a vector for serialization.

inline CtrlBits()

Construct an empty CtrlBits object.

void test(uint64_t val, Behavior &b)

Look up the control table and update the behavior.

Parameters
  • val – The key to index the lut.

  • b – The behavior.

int entryIdx2lutIdx(int entryIdx)

Convert entry index to LUT index.

Parameters

entryIdx

Returns

int

Public Members

int bmss = {-1}

The subset of the bitmask for lut.

const bool is_dynamic = {false}
std::map<int, std::vector<Control>> lut

Private Static Functions

static inline Control str_to_enum(const std::string &s)
class DataNode : public dsa::ssnode

Subclassed by dsa::ssdma, dsa::ssgenerate, dsa::ssrecurrence, dsa::ssregister, dsa::ssscratchpad

Public Functions

inline DataNode(NodeType type)
inline DataNode()
virtual std::string name() const = 0

The textformat of this node for the purpose of logging.

virtual void Accept(adg::Visitor *visitor) = 0

The entrance for visitor pattern.

virtual void dumpIdentifier(ostream &os) = 0
virtual void dumpFeatures(ostream &os) = 0
inline virtual ~DataNode()
DEF_ATTR(numWrite)
DEF_ATTR(memUnitBits)
DEF_ATTR(numRead)
DEF_ATTR(maxLength1D)
DEF_ATTR(maxLength3D)
DEF_ATTR(capacity)
DEF_ATTR(linearLength1DStream)
DEF_ATTR(numGenDataType)
DEF_ATTR(linearPadding)
DEF_ATTR(maxAbsStretch3D2D)
DEF_ATTR(numPendingRequest)
DEF_ATTR(numLength1DUnitBitsExp)
DEF_ATTR(maxAbsStride3D)
DEF_ATTR(maxAbsStride1D)
DEF_ATTR(indirectStride2DStream)
DEF_ATTR(numIdxUnitBitsExp)
DEF_ATTR(maxAbsDeltaStride2D)
DEF_ATTR(linearStride2DStream)
DEF_ATTR(maxLength2D)
DEF_ATTR(maxAbsStretch2D)
DEF_ATTR(numMemUnitBitsExp)
DEF_ATTR(maxAbsStretch3D1D)
DEF_ATTR(indirectIndexStream)
DEF_ATTR(numStride2DUnitBitsExp)
DEF_ATTR(writeWidth)
DEF_ATTR(maxAbsStride2D)
DEF_ATTR(readWidth)
DEF_ATTR(streamStated)
DEF_ATTR(numSpmBank)
DEF_ATTR(indirectLength1DStream)
DEF_ATTR(maxAbsDeltaStretch2D)
DEF_ATTR(atomicOperations)

Protected Attributes

int numWrite_ = {1}
int memUnitBits_ = {8}
int numRead_ = {1}
int maxLength1D_ = {2147483646}
int maxLength3D_ = {2147483646}
int64_t capacity_ = {1024}
bool linearLength1DStream_ = {true}
int numGenDataType_ = {1}
bool linearPadding_ = {true}
int maxAbsStretch3D2D_ = {1073741822}
int numPendingRequest_ = {16}
int numLength1DUnitBitsExp_ = {4}
int maxAbsStride3D_ = {1073741822}
int maxAbsStride1D_ = {1073741824}
bool indirectStride2DStream_ = {true}
int numIdxUnitBitsExp_ = {4}
int maxAbsDeltaStride2D_ = {1073741822}
bool linearStride2DStream_ = {true}
int maxLength2D_ = {2147483646}
int maxAbsStretch2D_ = {1073741822}
int numMemUnitBitsExp_ = {4}
int maxAbsStretch3D1D_ = {1073741822}
bool indirectIndexStream_ = {true}
int numStride2DUnitBitsExp_ = {4}
int writeWidth_ = {32}
int maxAbsStride2D_ = {1073741822}
int readWidth_ = {32}
bool streamStated_ = {true}
int numSpmBank_ = {4}
bool indirectLength1DStream_ = {true}
int maxAbsDeltaStretch2D_ = {1073741822}
std::vector<std::string> atomicOperations_ = {}
template<typename T>
struct DFGSlice
#include <schedule.h>

The struct of slicing DFG components.

Public Members

int l

The range of slicing.

int r
T ref

The DFG node to be sliced.

class DMA : public dsa::dfg::Array

Public Functions

inline DMA()
DMA(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override
bool recurrant()
double reuse()
inline virtual void forward() override

Public Members

int current_ = {0}
struct Edge

Public Functions

inline Edge()

A default constructor for serialized load.

Edge(SSDfg *parent, int sid, int vid, int uid, int oid, int l = 0, int r = 63, int outl = 0, int outr = 63)

Construct a new edge object.

Parameters
  • sid – The id of the source node.

  • vid – The value index of the source node.

  • uid – The id of the consumer node.

  • parent – The DFG this belongs to.

  • l – The left slicing.

  • r – The right slicing.

Node *def() const

Helper function to get the source node.

Value *val() const

Helper function to get the source value.

Node *use() const

Helper function to get the consumer node.

Node *get(int) const

Helper function to get either source or consumer.

std::string name() const

For debug. The text representative of this edge.

inline int bitwidth()

The bitwidth of this data path.

bool sourceStated()

Helper function to check whether an edge is stated as defined by source node.

bool sinkStated()

Helper function to check whether an edge is stated as defined by sink node.

bool memory()

Helper function to see if this edge is in the memory or spatial architecture.

Public Members

int id = {-1}

The index of the edge in the parent’s edge list.

SSDfg *parent = {nullptr}

The DFG this edge belongs to.

int sid = {-1}

The node produces the source value. sid: The id of source node to this edge vid: The output index of this edge to its source node.

int vid = {-1}
int uid = {-1}

The consumer of this edge. uid: The node id of sink node to this edge oid: The output index of this edge to its sink node.

int oid = {-1}
int l = {-1}

The slicing applied on the source value.

int r = {-1}
int outl = {-1}

The slicing applied on the sink value.

int outr = {-1}
int buf_len = {9}

Size of the FIFO buffer.

int delay = {0}

The delay of the FIFO buffer.

bool _memory = {false}
struct EdgeProp

Public Members

std::vector<std::pair<int, ssnode*>> thrus
std::vector<std::pair<int, sslink*>> links
struct EdgeProp

Public Functions

inline void reset()

Public Members

int extra_lat = 0
int source_bit = 0
int vio = 0
std::vector<std::pair<int, sslink*>> links

Links used to route this edge, from source to destination.

std::vector<std::pair<int, ssnode*>> passthroughs
struct EdgeSlice

Public Functions

inline EdgeSlice(int eid, int l, int r)
inline bool operator==(const EdgeSlice &b)

Public Members

int eid

The identifier of the edge to be sliced.

int l

The absolute slicing of the edge. By absolute, we mean if a edge is a.1[16:31], and we want to extract [16:23], the value of l,and r should be 16,23 respectively, instead of implicitly adding the 16 offset.

int r
struct Entry
#include <fu_model.h>

Each FU entry of the capability.

Public Functions

inline Entry(OpCode op, int count)

Public Members

OpCode op

The opcode of the instruction capability.

int count

The number of this kind of.

class EnvCache

Public Functions

inline const bool &get_env(const std::string &key)
inline void clear()
inline EnvCache()
inline ~EnvCache()

Private Members

std::map<std::string, bool> cache_entries
struct FPGAResource : public dsa::adg::estimation::Resource

Public Functions

FPGAResource(const std::vector<double> &v = {0, 0, 0, 0, 0, 0, 0, 0, 0})
virtual void scale_cores(int numcores) override
virtual void normalize() override
virtual double constrained_resource(int n) override
virtual Resource *clone() const override
virtual std::string constrained_resource_name(int n) override
virtual std::vector<double> to_vector() override
virtual std::string dump() override

Public Members

double total_lut

The estimated resource.

double logic_lut
double ram_lut
double srl
double ff
double ramb36
double ramb18
double uram
double dsp
class Generate : public dsa::dfg::Array

Public Functions

inline Generate()
Generate(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override
inline virtual void forward() override

Public Members

int current_ = {0}
struct GraphVisitor : public dsa::adg::Visitor
#include <visitor.h>

A vistor for ADG nodes, which traverses all the nodes by DFS.

Public Functions

GraphVisitor(SpatialFabric *fabric)
virtual void Visit(ssfu *node)
virtual void Visit(ssswitch *node)
virtual void Visit(ssivport *node)
virtual void Visit(ssovport *node)
virtual void Visit(ssdma *node)
virtual void Visit(ssscratchpad *node)
virtual void Visit(ssrecurrence *node)
virtual void Visit(ssgenerate *node)
virtual void Visit(ssregister *node)

Public Members

std::vector<bool> visited

Private Functions

virtual void Visit(ssnode *node)
class IDAble
#include <idable.h>

The very base class that every object has an ID.

Private Functions

inline IDAble(int i)
class InputPort : public dsa::dfg::VectorPort

Public Functions

virtual void Accept(Visitor*) final
inline InputPort()
InputPort(int len, int width, const std::string &name, SSDfg *ssdfg, const MetaPort &meta, bool stated)
inline virtual int vectorLanes() override

The vector lanes of this i/o.

virtual void forward() override
bool can_push()

Public Members

bool stated
int stationary_shift = {-1}
int current_ = {0}

Public Static Functions

static inline std::string Suffix()
static inline bool IsInput()

Public Static Attributes

static const int KindValue = V_INPUT
class Instruction : public dsa::dfg::Node
#include <instruction.h>

IR node for the instructions in the DFG.

Public Functions

virtual void Accept(dsa::dfg::Visitor*) final

The entrance function for the visitor pattern.

inline Instruction()

The default constructor.

Instruction(SSDfg *ssdfg, dsa::OpCode inst = dsa::SS_NONE)

The constructor with instruction opcode.

Parameters
  • ssdfg – The DFG this instruciton belongs to.

  • inst – The instruction opcode.

inline virtual int lat_of_inst() override

The latency of the instruction execution.

Returns

The latency of the instruction execution.

inline dsa::OpCode inst()

The instruction opcode.

Returns

The instruction opcode.

virtual std::string name() override

The name of this instruction.

int lane()

Guess the lane of this instruction. If it is unable to guess, return -1 or -2.

virtual int bitwidth() override

The bitwidth of the instruction.

virtual void forward() override
uint64_t do_compute(bool &discard, std::vector<bool> &backpressure)

Public Members

CtrlBits predicate

The predication affected by an upstream operand.

CtrlBits self_predicate

The predication affected by itself.

int last_execution = {-1}

Public Static Attributes

static const int KindValue = V_INST

Private Members

int lane_ = {-1}

Remember the result of lane information. -1 is uninitialized, -2 is initialized but still unable to guess.

std::vector<uint64_t> _input_vals
std::vector<uint64_t> _output_vals
std::vector<uint64_t> _reg
dsa::OpCode opcode = {dsa::OpCode::SS_NONE}
struct LinkProp

Public Members

std::vector<LinkSlot> slots

The mapping information of each lane hardware lane.

struct LinkSlot

Public Members

int lat = 0
int order = -1
std::vector<EdgeSlice> edges
class LOGGER

Public Functions

inline LOGGER(std::string reason, std::string file, int lineno, bool abort_)
inline ~LOGGER() noexcept(false)
template<typename T>
inline LOGGER &operator<<(T &&x)

Private Members

bool abort_
std::ostringstream message
struct MapSpot
#include <schedule.h>

The spot of candidate mapping.

Public Functions

inline MapSpot(bool r, const Slot<ssnode*> &s)
inline ssnode *node() const

The helper of accessing the ADG node.

inline int lane() const

The helper of accessing the lane in the ADG node.

Public Members

bool routing_along

If we want to routing along with this lane.

Slot<ssnode*> slot

The candidate slot.

struct MetaDfg
#include <ssdfg.h>

The metadata of a sub-DFG.

Public Functions

inline MetaDfg(bool temporal = false, int64_t freq = 1, int64_t u = 1)

Public Members

bool is_temporal = {false}

If this sub DFG is temporal.

int64_t frequency = {1}

The relative execution frequency.

int64_t unroll = {1}

The unrolling degree of this block.

struct MetaPort

Subclassed by dsa::dfg::CompileMeta

Public Types

enum class Data

Values:

enumerator Memory
enumerator SPad
enumerator LocalPort
enumerator RemotePort
enumerator Unknown
enum class Operation

Values:

enumerator Read
enumerator Write
enumerator IndRead
enumerator IndWrite
enumerator Atomic
enumerator Unknown

Public Functions

inline MetaPort()
inline void clear()
inline void set(const std::string &key, const std::string &val)
inline void to_pragma(std::ostream &os) const

Public Members

Data source
Data dest
int op
int conc
double cmd = {1.0}
double repeat = {1.0}
double reuse = {0.0}
std::string dest_port
class Node
#include <node.h>

The abstract class for all DFG nodes.

Subclassed by dsa::dfg::Array, dsa::dfg::Instruction, dsa::dfg::Operation, dsa::dfg::VectorPort

Public Types

enum V_TYPE

Values:

enumerator V_INVALID
enumerator V_INPUT
enumerator V_OUTPUT
enumerator V_INST
enumerator V_ARRAY
enumerator V_NUM_TYPES
enum NodeType

Values:

enumerator DMA
enumerator SPAD
enumerator REC
enumerator REG
enumerator GEN
enumerator INPUT
enumerator OUTPUT
enumerator INST
enumerator OPER
enumerator NUM_TYPES
enumerator INVALID

Public Functions

inline virtual ~Node()
virtual void Accept(dsa::dfg::Visitor*)
inline Node()
virtual int slot_for_use(dsa::dfg::Edge *edge, int node_slot)
inline virtual int slot_for_op(dsa::dfg::Edge *edge, int node_slot)
Node(SSDfg *ssdfg, V_TYPE v, const std::string &name = "")
inline virtual int lat_of_inst()
virtual std::string name() = 0
dsa::dfg::Edge *getLinkTowards(Node *to)
inline bool has_name()
inline void set_name(std::string name)
inline std::vector<dsa::dfg::Operand> &ops()
inline int id()
virtual void forward() = 0
int sourceEdgeIdx(dsa::dfg::Edge *sourceEdge)
bool is_temporal()
virtual int bitwidth() = 0
inline V_TYPE type()
inline NodeType node_type()
inline int group_id()
inline void set_group_id(int id)
inline SSDfg *&ssdfg()

Public Members

std::vector<dsa::dfg::Value> values

The values produced by this node.

Protected Attributes

SSDfg *_ssdfg = 0
int _ID
std::string _name
std::vector<dsa::dfg::Operand> _ops
int _min_lat = 0
int _max_thr = 0
int _group_id = 0
V_TYPE _vtype
NodeType _ntype = NodeType::INVALID
struct NodeEntry : public dsa::dfg::ParseResult
#include <symbols.h>

A node (?vertex) of the DFG.

Example 1: A = F(B, C) F(B, C) the whole is the node entry.

Example 2: A, B = F<Add:1, Sub:1>(C, D) F<Add:1, Sub:1>(C, D) the whole is the node entry

Public Functions

inline NodeEntry(int nid_)

Public Members

int nid
struct NodeProp

Public Members

std::vector<NodeSlot> slots

The mapping information of each lane hardware lane.

struct NodeSlot
#include <schedule.h>

To support the decomposability, we break a whole ssnode into slots.

Public Members

std::vector<std::pair<dsa::dfg::Edge*, int>> passthrus

Edges pass through this node slot to route.

std::vector<std::pair<dsa::dfg::Node*, int>> vertices

bit slot of the dfg node (inst/vec) that is mapped to this node slot.

struct Operand

Public Functions

Operand(SSDfg *parent, const std::vector<int> &es, OperandType type)

Connect this operand to an list of edges and concatenate their values.

Operand(SSDfg *parent, int dtype, int idx)

Construct a register operand.

Operand(SSDfg *parent, uint64_t)

The constant constructor.

Operand(SSDfg *parent, OperandType type, uint64_t)

Constructor for imm or register.

bool isImm()

If this operand is a constant.

bool isReg()

If this operand is a register.

inline int regIdx()
inline int regDtype()
bool empty()
bool ready()
uint64_t poll()
bool predicate()
void pop()

Public Members

SSDfg *parent = {nullptr}

The DFG this edge belongs to.

std::vector<int> edges

The edges from upstream values.

uint64_t imm = 0

The constant operand.

OperandType type

The type of this operand.

std::vector<std::queue<sim::SpatialPacket>> fifos
class Operation : public dsa::dfg::Node
#include <instruction.h>

IR node for the instructions occupies multiple compute resources.

Public Functions

virtual void Accept(dsa::dfg::Visitor*) final

The entrance function for the visitor pattern.

inline Operation()

The default constructor.

inline Operation(SSDfg *ssdfg, const std::vector<OpCode> &ops_, const std::vector<int> &cnt_)

Construct a new Operation object.

Parameters
  • ssdfg – The parent dfg.

  • ops – The compute resources required.

  • cnt – The number of each compute resource.

virtual std::string name() override

The name of this instruction.

virtual int bitwidth() override
inline virtual void forward() override

Public Members

int latency = {-1}

Since it is no longer a single instruction, we allow users to customize the latency.

std::vector<OpCode> opcodes

The compute resources required.

std::vector<int> cnt

The number of compute resources required.

Public Static Attributes

static const int KindValue = V_INST
class OutputPort : public dsa::dfg::VectorPort

Public Functions

inline OutputPort()
inline OutputPort(int len, int width, const std::string &name, SSDfg *ssdfg, const MetaPort &meta, int sid)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override

The vector lanes of this i/o.

virtual int slot_for_op(Edge *edge, int node_slot) override
inline virtual void forward() override
bool can_pop()
void pop(std::vector<uint64_t> &data, std::vector<bool> &data_valid)

Public Members

int penetrated_state = {-1}

If this port should penetrate the state.

Public Static Functions

static inline std::string Suffix()
static inline bool IsInput()

Public Static Attributes

static const int KindValue = V_OUTPUT
struct ParseResult

Subclassed by dsa::dfg::ConstDataEntry, dsa::dfg::ControlEntry, dsa::dfg::ConvergeEntry, dsa::dfg::NodeEntry, dsa::dfg::RegisterEntry, dsa::dfg::TaskMapEntry, dsa::dfg::ValueEntry

Public Functions

inline virtual ~ParseResult()
struct Range
#include <schedule.h>

The range silcing struct. Left close, right close. Use const for left and right because I do not expect users change it.

Public Functions

inline Range(int l_, int r_)
bool operator==(const Range&)

Public Members

const int l

The left point of slicing.

const int r

The right point of slicing.

class Recurrance : public dsa::dfg::Array

Public Functions

inline Recurrance()
Recurrance(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override
inline virtual void forward() override

Public Members

int current_ = {0}
class Register : public dsa::dfg::Array

Public Functions

inline Register()
Register(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override
inline virtual void forward() override

Public Members

int current_ = {0}
struct RegisterEntry : public dsa::dfg::ParseResult
#include <symbols.h>

A = Add(Reg0, B). The local register in a PE.

Public Functions

inline RegisterEntry(int i)

Public Members

int idx = {-1}

The index of the register.

struct Resource

Subclassed by dsa::adg::estimation::ASICResource, dsa::adg::estimation::FPGAResource

Public Functions

inline virtual ~Resource()
virtual Resource *clone() const = 0
virtual void normalize() = 0
virtual void scale_cores(int numcores) = 0
virtual double constrained_resource(int n) = 0
virtual std::string constrained_resource_name(int n) = 0
virtual std::vector<double> to_vector() = 0
virtual std::string dump() = 0
struct Result
#include <estimation.h>

The result of power/area estimation.

Public Functions

Result()
Result(const Result &other)
~Result()
void Dump(std::ostream&)

Print the breakdowns.

void Dump_all_resources(std::ostream &os)
void scale_cores(int numcores)
Resource *sum()
Resource *resource_bd(int breakdown)
void add(Breakdown k, double power, double area)
void add(Breakdown k, const std::vector<double> &v)
void add_core_overhead()
void add_system_bus_overhead(int num_cores, int banks, int system_bus_width)
void add_dma_overhead(int links, int system_bus_width)

Public Static Attributes

static std::map<Hardware, std::function<Resource*()>> RESOURCE_CONSTRUCTOR

Private Members

std::vector<Resource*> brkd
class SchedStats

Public Members

int64_t lat = std::numeric_limits<int64_t>::max()
int64_t latmis = std::numeric_limits<int64_t>::max()
int64_t agg_ovr = std::numeric_limits<int64_t>::max()
int64_t ovr = std::numeric_limits<int64_t>::max()
int64_t max_util = std::numeric_limits<int64_t>::max()
class Schedule

Public Functions

Schedule(SSModel *model, SSDfg *dfg)

Constructor for the hardware/software pair.

Parameters
  • model – The hardware.

  • dfg – The software DFG.

Schedule()
~Schedule()
Schedule(const Schedule &c, bool dup_dfg)

Deep copy a schedule.

Schedule(const Schedule &c, SSModel *model)
void printGraphviz(const char *name)
void printEdge()
void DumpMappingInJson(const std::string &mapping_filename)
void LoadMappingInJson(const std::string &mapping_filename)
void printConfigHeader(std::ostream &os, std::string cfg_name, bool cheat = true)
void printConfigCheat(std::ostream &os, std::string cfg_name)
void printConfigVerif(std::ostream &os)
inline SSDfg *ssdfg() const

The software to be mapped.

inline void assign_lat(dsa::dfg::Node *node, int lat)

Assign latency to the given node.

Parameters
  • node – The node to be assigned.

  • lat – The latency to assign.

inline int latOf(dsa::dfg::Node *n)

Return the latency of the given node in DFG.

Parameters

n – The DFG node to query.

int unrollDegree()

Return the unroll degree of the schedule.

Returns

int the unroll degree

inline void assign_lat_bounds(dsa::dfg::Node *n, int min, int max)

Assign the bound of DFG latency for the purpose of timing.

Parameters
  • n – The DFG node to update.

  • min – The lower bound.

  • max – The upper bound.

inline std::pair<int, int> lat_bounds(dsa::dfg::Node *n)

Return the latency bound of the given DFG node.

Parameters

n – The node to query.

inline bool isPassthrough(int slot, ssnode *node)
inline void assign_edge_pt(dsa::dfg::Edge *edge, std::pair<int, ssnode*> pt)
inline int groupMismatch(int g)
inline int violation()
inline void add_violation(int violation)
inline int vioOf(dsa::dfg::Node *n)
inline void record_violation(dsa::dfg::Node *n, int violation)
inline int vioOf(dsa::dfg::Edge *e)
inline void record_violation(dsa::dfg::Edge *e, int violation)
inline int vecPortOf(dsa::dfg::VectorPort *vec)
inline int startSlot(ssnode *assigned, dfg::Node *dfgnode)
inline int startSlot(std::pair<int, sslink*> edgelink)
inline int endSlot(ssnode *assigned, dfg::Node *dfgnode)
inline int endSlot(std::pair<int, sslink*> edgelink, dfg::Edge *edge)
inline void assign_node(dsa::dfg::Node *dfgnode, std::pair<int, ssnode*> assigned)

Assign the given DFG node to the hardware resource.

Parameters
  • dfgnode – The DFG node.

  • assigned – The hardware resource.

inline void remove_passthrough_from_edge(dsa::dfg::Edge *edge, std::pair<int, ssnode*> pt)
inline void unassign_edge(dsa::dfg::Edge *edge)
inline void unassign_dfgnode(dsa::dfg::Node *dfgnode)
inline void print_all_mapped()
inline void assign_edgelink(dsa::dfg::Edge *dfgedge, int bit, sslink *link, std::vector<std::pair<int, sslink*>>::iterator it)
inline void assign_edgelink(dsa::dfg::Edge *dfgedge, int bit, sslink *link, int offset)
inline int edge_latency(dsa::dfg::Edge *pdgedge)
inline int max_edge_delay(dsa::dfg::Edge *pdgedge)
inline std::vector<std::pair<int, ssnode*>> &thrus_of(dsa::dfg::Edge *edge)
inline void setLatOfLink(std::pair<int, sslink*> link, int l)
inline int latOfLink(std::pair<int, sslink*> link)
inline dsa::dfg::Edge *alt_edge_for_link(std::pair<int, sslink*> link, dsa::dfg::Edge *e)
inline int routing_cost(std::pair<int, sslink*> link, dsa::dfg::Edge *edge)
inline int routing_cost_temporal_in(sslink *link, dsa::dfg::InputPort *in_v)
inline int routing_cost_temporal_out(std::pair<int, sslink*> link, dsa::dfg::Node *node, dsa::dfg::OutputPort *out_v)
inline dsa::dfg::Node *dfgNodeOf(int slot, ssnode *node)
inline std::vector<dsa::dfg::Node*> dfgNodesOf(ssnode *node)
inline dsa::dfg::Node *dfgNodeOf(ssnode *node)
inline std::vector<std::pair<dsa::dfg::Node*, int>> &dfg_nodes_of(int slot, ssnode *node)
inline std::vector<std::pair<dsa::dfg::Edge*, int>> &dfg_passthroughs_of(int slot, ssnode *node)

Gets all the edges for a particular slot/link pair.

Parameters
  • slot – the given slot

  • link – the given link

Returns

std::vector<EdgeSlice>& the set of edges for the given slot/link pair

inline int num_slots(ssnode *node)

Get the Number of Slots for a Node.

Parameters

node – the node to get the slots of

Returns

int the slots for the given node

Get the Number of Slots for a given Link.

Parameters

link – the link to get the slots of

Returns

int the slots for the given link

inline const mapper::VertexProp &locationOf(dsa::dfg::Node *dfgnode)
inline bool is_scheduled(dsa::dfg::Node *dfgnode)

Gets if a dfgnode is currently schedule.

Parameters

dfgnode – the dfgnode to check

Returns

bool if the given dfgnode is scheduled

void stat_printOutputLatency()
inline void set_model(SSModel *model)
inline SSModel *ssModel()
void validate()
bool fixLatency(int64_t &lat, int64_t &latmis, std::pair<int, int> &delay_violation)
double spmPerformance()
inline void clearAll()
inline void print_bit_loc()
inline void set_edge_delay(int i, dsa::dfg::Edge *e)
inline int edge_delay(dsa::dfg::Edge *e)
inline std::vector<EdgeProp> &edge_prop()
inline size_t num_passthroughs(dsa::dfg::Edge *e)
inline int max_lat()
inline int max_lat_mis()
inline void reset_lat_bounds()
template<typename T>
inline bool is_complete()
template<typename T>
inline int num_mapped()
inline unsigned num_left()
inline void allocate_space()
int colorOf(dsa::dfg::Value *v)
void get_overprov(int64_t &ovr, int64_t &agg_ovr, int64_t &max_util)
int get_instruction_overprov(dfg::Instruction *inst)
inline void swap_model(SpatialFabric *copy_sub)
inline void verify_vertices()
inline void verify_links()
inline void verify_passthroughs()
inline void verify()
inline void remove_link(int link_deleted_id)
inline void ensure_node_delete(int node_id)
inline void remove_node(int node_deleted_id)
inline std::vector<NodeProp> &node_prop()
inline std::vector<mapper::VertexProp> &vex_prop()
double estimated_performance(std::string &spm_performance, std::string &l2_performance, std::string &dram_performance, int num_cores = 1, int num_banks = 1, bool debug = false)

Estimate the performance of this mapping.

Returns

The estimated instruction level parallelism on the fabric.

void normalize()

It normalizes the results of passes, and sync the DFG with the schedule.

Public Members

double scheduled_seconds = -1
std::vector<bool> needs_dynamic

If each nodes in the DFG requires dynamic control in the hardware.

std::vector<dsa::dfg::Node*> reversed_topo

DFG is always a DAG. It stores its reversed topological order.

std::vector<std::vector<dsa::dfg::Edge*>> operands

The gathered redundant operand edges of each node in the DFG.

std::vector<std::vector<dsa::dfg::Edge*>> users

The gathered redundant user edges of each node in the DFG.

std::vector<std::vector<int>> distances

The distances among the nodes in the spatial hardware.

std::vector<int> group_throughput

The data issue throughput of each sub-DFG. Used by simulation.

std::vector<int> candidate_cnt

The number of candidate spots of each DFG nodes.

int total_passthrough = {0}

The total number of pass-through routings.

std::pair<int, int> violation_penalty

The throughput penalty of violation.

Public Static Attributes

static constexpr const float gvsf = 4.0f

Private Members

SSModel *_ssModel

The pointer to the spatial architecture.

SSDfg *_ssDFG

The pointer to the DFG.

int64_t _totalViolation = 0

The gatherd sum of timing mismatch.

int _max_lat = -1

The max latency of the DFG, and the max timing mismatch.

int _max_lat_mis = -1
unsigned _num_mapped[dsa::dfg::Node::V_NUM_TYPES] = {0}

The number mapped nodes in each data type.

Links occupied by edges. The edges mapped onto links.

std::vector<int> _groupMismatch

The timing mismatch of each sub-DFG.

std::vector<mapper::VertexProp> _vertexProp

The hardware information of each mapped DFG node.

std::vector<EdgeProp> _edgeProp

The hardware information of each mapped DFG edge.

std::vector<NodeProp> _nodeProp

The software information of each occupied spatial hardware node.

std::vector<LinkProp> _linkProp

The software information of each occupied spatial hardware link.

int _min_expected_route_latency = 2

Expected edge latency used by timing.

int _max_expected_route_latency = 6
class Scheduler

Subclassed by SchedulerSimulatedAnnealing

Public Functions

inline Scheduler(dsa::SSModel *ssModel)
bool check_feasible(SSDfg *ssDFG, SSModel *ssmodel)
virtual bool schedule(SSDfg *ssDFG, Schedule *&schedule, int stopping = -1) = 0
inline virtual bool incrementalSchedule(CodesignInstance &incr_table, int stopping = -1)
inline std::string AUX(int x)
inline double total_msec()
inline void set_start_time()
inline virtual bool schedule_timed(SSDfg *ssDFG, Schedule *&sched)
inline bool running()
inline void stop()
int invoke(SSModel *model, SSDfg *dfg)
Returns

0: done, 1: count failed, 2: routing failed

Public Members

bool suppress_timing_print = false

Protected Functions

inline dsa::SSModel *getSSModel()

Protected Attributes

dsa::SSModel *_ssModel
bool _should_stop = {false}
std::string mapping_file = {""}
bool dump_mapping_if_improved = {false}
std::chrono::time_point<std::chrono::steady_clock> _start
class SchedulerSimulatedAnnealing : public Scheduler

Public Functions

void initialize(SSDfg*, Schedule*&)
inline SchedulerSimulatedAnnealing(dsa::SSModel *ssModel, std::string mapping_file_ = "", bool dump_mapping_if_improved_ = false, bool deterministic_ = false, bool allow_overprov_ = true)
virtual bool schedule(SSDfg*, Schedule*&, int stopping = -1) override
virtual bool incrementalSchedule(CodesignInstance &incr_table, int stopping = -1) override
int schedule_internal(SSDfg *ssDFG, Schedule *&sched)
bool scheduleHere(Schedule*, dsa::dfg::Node*, mapper::Slot<ssnode*>)

Public Members

bool is_dse = {false}
int routing_times = {0}

Protected Functions

std::pair<int64_t, int64_t> obj(Schedule *&sched, SchedStats &s)
std::pair<int64_t, int64_t> obj_creep(Schedule *&sched, SchedStats &s, CandidateRoute &undo_path)
bool length_creep(Schedule *sched, dsa::dfg::Edge *edge, int &num, CandidateRoute &cand)
template<typename T>
inline bool scheduleHere(Schedule *sched, const std::vector<T> &nodes, const std::vector<mapper::Slot<ssnode*>> &cand)
int route(Schedule *sched, dsa::dfg::Edge *dfgnode, mapper::VertexProp &vps, mapper::VertexProp &vpd, int insert_position, int max_path_lengthen)
int routing_cost(dsa::dfg::Edge*, int, int, sslink*, Schedule*, const std::pair<int, ssnode*>&)
int map_to_completion(SSDfg *ssDFG, Schedule *sched)
inline int try_candidates(const std::vector<mapper::MapSpot> &candidates, Schedule*, dsa::dfg::Node *node)
void unmap_some(SSDfg *ssDFG, Schedule *sched)

Protected Attributes

bool _integrate_timing = true
bool _strict_timing = true
std::string mapping_file = {""}
bool dump_mapping_if_improved = {false}
int max_iters
bool deterministic = {false}
bool allow_overprov = {true}
std::unordered_map<std::string, std::pair<int, ssnode*>> indirect_map_to_index
struct ScratchMemory

Public Functions

ScratchMemory(int line_size_, int num_banks_, int num_bytes_)

Public Members

int num_bytes
int num_banks
int bank_width
class Scratchpad : public dsa::dfg::Array

Public Functions

inline Scratchpad()
Scratchpad(int size, const std::string &name, SSDfg *ssdfg)
virtual void Accept(Visitor*) override
inline virtual int vectorLanes() override
inline virtual void forward() override

Public Members

int current_ = {0}
template<typename T>
struct Slot
#include <schedule.h>

The struct of decomposable mapping.

Public Functions

inline Slot(int l, T r)

Public Members

int lane_no

The number of lane.

T ref

The component to be decomposed.

class SpatialFabric

Public Types

enum class PortType

Values:

enumerator opensp
enumerator everysw
enumerator threein
enumerator threetwo

Public Functions

inline SpatialFabric()
SpatialFabric(const SpatialFabric &c)
SpatialFabric(std::istream &istream, const std::vector<Capability*>&)
SpatialFabric(int x, int y, PortType pt = PortType::opensp, int ips = 2, int ops = 2)
void Apply(adg::Visitor*)
void PrintGraphviz(const std::string &name)
void DumpHwInJson(const char *name)
inline int sizex()
inline int sizey()
template<typename T>
inline std::vector<T> nodes()
template<typename T>
inline T *random(std::function<bool(T*)> condition)
template<typename T>
inline std::vector<T> node_filter()
inline std::vector<ssfu*> fu_list()
inline std::vector<ssswitch*> switch_list()
inline size_t num_fu()
void parse_io(std::istream &istream)
inline ssio_interface &io_interf()
inline const std::vector<ssnode*> &node_list()
inline std::vector<SyncNode*> vport_list()
inline std::vector<DataNode*> data_list()
inline std::vector<ssgenerate*> gen_list()
inline std::vector<ssregister*> reg_list()
inline std::vector<ssscratchpad*> scratch_list()
inline std::vector<ssrecurrence*> recur_list()
inline std::vector<ssdma*> dma_list()
inline std::vector<ssivport*> input_list()
inline std::vector<ssovport*> output_list()
inline void add_input(int i, ssnode *n)
inline void add_output(int i, ssnode *n)
inline ssfu *add_fu()
inline ssfu *add_fu(int x, int y)
inline ssscratchpad *add_scratchpad()
inline ssswitch *add_switch()
inline ssswitch *add_switch(int x, int y)
inline ssivport *add_input_vport()
inline ssovport *add_output_vport()
inline SyncNode *add_vport(bool is_input)
inline SyncNode *add_vport(bool is_input, int port_num)
inline SpatialFabric *copy()
template<typename T>
inline void bulk_vec_delete(std::vector<T> &vec, std::vector<int> &indices)
inline void delete_node(int node_index)
inline void delete_link(int link_index)
inline sslink *add_link(ssnode *src, ssnode *dst, int source_position = -1, int sink_position = -1)

Adds a link to the spatial fabric. Adds the link from the source node to the sink node.

Parameters
  • src – node that represents the source

  • dst – node that represents the sink

  • source_position – position to add the link to source node, by default -1

  • sink_position – position to add the link to sink node, by default -1

Returns

sslink* the created link between the source and destination nodes

inline void add_node(ssnode *n)
inline virtual ~SpatialFabric()
void post_process()
template<>
inline std::vector<ssfu*> nodes()

Private Functions

void build_substrate(int x, int y)
void connect_substrate(int x, int y, PortType pt, int ips, int ops, int temp_x, int temp_y, int temp_width, int temp_height)

Private Members

std::vector<ssnode*> _node_list
int _sizex
int _sizey
std::map<int, ssnode*> _io_map[2]
ssio_interface _ssio_interf
class SpatialNode : public dsa::ssnode

Subclassed by dsa::ssconverge, dsa::ssdiverge, dsa::ssfu, dsa::ssswitch

Public Functions

inline SpatialNode(NodeType type)
inline SpatialNode()
virtual std::string name() const = 0

The textformat of this node for the purpose of logging.

virtual void Accept(adg::Visitor *visitor) = 0

The entrance for visitor pattern.

virtual void dumpIdentifier(ostream &os) = 0
virtual void dumpFeatures(ostream &os) = 0
inline virtual ~SpatialNode()
struct SpatialPacket

Public Functions

inline SpatialPacket(uint64_t aa, uint64_t value, bool valid)

Public Members

uint64_t available_at

The latency of this cycle to be produced.

uint64_t value

The payload of this packet.

bool valid

The data predicate of this packet.

class ssconverge : public dsa::SpatialNode

Public Functions

inline ssconverge()
virtual void Accept(adg::Visitor *visitor) override

The entrance for visitor pattern.

inline virtual ssnode *copy() override
inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssconverge()
class SSDfg
#include <ssdfg.h>

The data structure for the dataflow graph.

Public Functions

SSDfg()

The default consturctor.

~SSDfg()
SSDfg(const SSDfg&)

Copy the given DFG.

SSDfg &operator=(const SSDfg&)
SSDfg(std::string filename)

Parse a DFG from the given file.

void Apply(dsa::dfg::Visitor*)

The entrance for the visitor pattern.

void create_new_task_type(int id)

Set a new dependence among dfg groups.

void create_new_task_dependence_map(int s, int d)
void add_new_task_property(std::string property, std::string value)
void add_new_task_dependence_characteristic(std::string s, std::string d)
void add_new_task_dependence_map(std::vector<std::string> producer, std::vector<std::string> consumer)
task_def_t producer_consumer_map(int src_group, int dst_group)
std::vector<std::pair<std::string, std::string>> coalescer_input_output_map(int src_group, int dst_group)
std::pair<std::string, std::string> streaming_input_output_map(int src_group, int dst_group)
std::unordered_map<std::string, std::string> task_type_characteristics(int task_type)
inline std::unordered_map<std::string, std::string> coalescer_dependence_characteristics(int src_group, int dst_group)
inline std::unordered_map<std::string, std::string> argument_dependence_characteristics(int src_group, int dst_group)
inline std::unordered_map<std::string, std::string> streaming_dependence_characteristics(int src_group, int dst_group)
void set_pragma(const std::string &c, const std::string &s)
template<typename T, typename ...Args>
inline T &emplace_back(Args&&... args)
template<typename T>
inline std::vector<T> &type_filter()
int forward(bool asap)
void check_for_errors()
void print_graphviz(std::string output_filename)
inline void inc_total_dyn_insts(bool is_temporal)
inline int total_dyn_insts(bool is_temporal)
inline void clear_issued()
inline uint64_t cur_cycle()
inline std::string get_task_dep_charac(int i)
inline std::string get_task_type_charac(int i)
inline void add_total_task_types()
inline int get_total_task_types()
template<>
inline std::vector<dsa::dfg::Node> &type_filter()

Public Members

const std::string filename

The file name this DFG is loaded.

int _total_task_types = 0
std::vector<dsa::dfg::Instruction> instructions

The instances of the instructions.

std::vector<dsa::dfg::Operation> operations

The instances of the FU-occupy instructions.

std::vector<dsa::dfg::InputPort> vins

The instances of the vector inputs.

std::vector<dsa::dfg::OutputPort> vouts

The instances of the vector outputs.

std::vector<dsa::dfg::DMA> dmas

The instances of the DMAs.

std::vector<dsa::dfg::Scratchpad> spms

The instances of the Scratchpads.

std::vector<dsa::dfg::Recurrance> recs

The instances of the Recturrance.

std::vector<dsa::dfg::Generate> gens

The instances of the Generates.

std::vector<dsa::dfg::Register> regs

The instances of the Registers.

std::vector<dsa::dfg::Node*> nodes

The summary vector of all the nodes above.

std::vector<dsa::dfg::Edge> edges

The instances of all the edges.

std::vector<dsa::MetaDfg> meta

The property information of each sub DFG.

int dyn_issued[2] = {0, 0}
task_def_t _dependence_maps[NUM_GROUPS][NUM_GROUPS]

Mapping informtion for dependencies among taskflow.

std::vector<std::pair<std::string, std::string>> _coalescer_dependence_maps[NUM_GROUPS][NUM_GROUPS]

Mapping informtion via coalescing buffer.

std::pair<std::string, std::string> _streaming_dependence_maps[NUM_GROUPS][NUM_GROUPS]

Mapping informtion for recurrence stream.

std::unordered_map<std::string, std::string> _task_type_characteristics[NUM_GROUPS]

Mapping characteristics for dependencies among taskflow.

std::unordered_map<std::string, std::string> _dependence_characteristics[NUM_GROUPS][NUM_GROUPS]
std::unordered_map<std::string, std::string> _coalescer_dependence_characteristics[NUM_GROUPS][NUM_GROUPS]
std::unordered_map<std::string, std::string> _streaming_dependence_characteristics[NUM_GROUPS][NUM_GROUPS]
std::pair<std::string, std::string> _default_task_type_characs[NUM_TASK_TYPE_CHARAC] = {{"coreMask", "1000"}, {"remote", "-1"}, {"prio", "fifo"}, {"gran", "1"}}

Default mapping characteristics for dependencies among taskflow.

std::pair<std::string, std::string> _default_task_dep_characs[NUM_TASK_DEP_CHARAC] = {{"aaa", "argument"}, {"id", "-1"}, {"bytes", "-1"}, {"init_order", "-1"}, {"index", "-1"}, {"ack", "-1"}}

Private Functions

void normalize()

Private Members

uint64_t _cur_cycle = 0
int _current_task_type = -1

The property information of each sub DFG.

int _current_src_grp = -1
int _current_dst_grp = -1
std::string _current_dependence_type = "unknown"
class ssdiverge : public dsa::SpatialNode

Public Functions

inline ssdiverge()
virtual void Accept(adg::Visitor *visitor) override

The entrance for visitor pattern.

inline virtual ssnode *copy() override
inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssdiverge()
class ssdma : public dsa::DataNode

Public Functions

inline virtual ssnode *copy() override
inline ssdma()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssdma()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

class ssfu : public dsa::SpatialNode

Public Functions

inline ssfu()
inline virtual SpatialNode *copy() override
virtual void Accept(adg::Visitor *visitor) override

The entrance for visitor pattern.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline double *collect_features()
inline virtual ~ssfu()
inline void print_features()
inline void dump_features()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

DEF_ATTR(fu_type)
DEF_ATTR(maxOpRepeat)
DEF_ATTR(definedLatency)
DEF_ATTR(instSlotSize)
DEF_ATTR(regFileSize)
DEF_ATTR(asyncReg)
DEF_ATTR(updReg)
DEF_ATTR(resettableRegIdx)
DEF_ATTR(inputCtrl)
DEF_ATTR(outputCtrl)
DEF_ATTR(ctrlLUTSize)
DEF_ATTR(operandReuse)
DEF_ATTR(resultDiscard)
DEF_ATTR(registerReset)
DEF_ATTR(abstain)

Protected Attributes

Capability fu_type_
int maxOpRepeat_ = {1}
int definedLatency_ = {1}
int instSlotSize_ = {1}
int regFileSize_ = {0}
bool asyncReg_ = {false}
bool updReg_ = {false}
std::vector<int> resettableRegIdx_ = {0}
bool inputCtrl_ = {false}
bool outputCtrl_ = {false}
int ctrlLUTSize_ = {0}
bool operandReuse_ = {false}
bool resultDiscard_ = {false}
bool registerReset_ = {false}
bool abstain_ = {false}
double features[12]

Friends

friend class SpatialFabric
class ssgenerate : public dsa::DataNode

Public Functions

inline virtual ssnode *copy() override
inline ssgenerate()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssgenerate()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

class ssio_interface

Public Types

using EntryType = std::pair<int, SyncNode*>

Public Functions

inline std::map<int, SyncNode*> &vports(bool is_input)
inline SyncNode *get(bool is_input, int id)
void fill_vec()

Public Members

std::map<int, SyncNode*> vports_map[2]
std::vector<EntryType> vports_vec[2]
class ssivport : public dsa::SyncNode

Public Functions

inline virtual ssnode *copy() override
inline ssivport()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual bool isInputPort() override
inline virtual bool isOutputPort() override
inline virtual int busWidth() override
inline virtual bool padded() override
inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual int bitwidth_capability() override
inline virtual ~ssivport()
inline virtual bool isHanger() override
DEF_ATTR(repeatIVP)
DEF_ATTR(broadcastIVP)

Protected Attributes

bool repeatIVP_ = {false}
bool broadcastIVP_ = {false}
class sslink
#include <sub_model.h>

The struct of component connection. NOTE: This is not actually a hardware component. Just a set of helpers.

Public Functions

inline sslink()
~sslink()
inline sslink(ssnode *source, ssnode *sink)

Construct a link with a pair of source and sink.

std::string name() const

The text format of this link for the purpose of logging.

bool flow_control()

If the timing of this link is dynamic.

int bitwidth()

The bandwith of this connection.

int granularity()
inline int lanes()

Protected Attributes

int id_ = {-1}
int max_util_ = {1}
ssnode *source_ = {nullptr}
ssnode *sink_ = {nullptr}

Friends

friend class SpatialFabric
class SSModel

Public Functions

SSModel(const char *filename)
SSModel(SpatialFabric *sub)
inline SpatialFabric *subModel()
void extract_llvm_flags()
inline void set_dispatch_inorder(bool d)
inline bool dispatch_inorder()
inline void set_dispatch_width(int w)
inline int dispatch_width()
void setMaxEdgeDelay(int d)
inline void setCtrl(bool ctrl)
inline int indirect(int v = -1)
inline SSModel(const SSModel &m)
inline ~SSModel()
void parse_exec(std::istream &istream)

Public Members

const std::string filename
std::vector<Capability*> fu_types
int memory_size = {4096}
int io_ports = {1}
SpatialFabric *_subModel = {nullptr}
bool _dispatch_inorder = {false}
int _dispatch_width = {2}
int _maxEdgeDelay = {15}
int ind_memory = {1}
class ssnode

Subclassed by dsa::DataNode, dsa::SpatialNode, dsa::SyncNode

Public Types

enum NodeType

Values:

enumerator FunctionUnit
enumerator Switch
enumerator InputVectorPort
enumerator OutputVectorPort
enumerator Scratchpad
enumerator DirectMemoryAccess
enumerator Register
enumerator Generate
enumerator Recurrance
enumerator None

Public Functions

inline ssnode()
inline ssnode(NodeType type)
virtual ssnode *copy() = 0
inline bool operator==(const ssnode &other)

Overload Equality operators.

inline bool operator!=(const ssnode &other)
inline bool spatial()
inline bool sync()
inline bool data()
virtual void Accept(adg::Visitor *visitor) = 0

The entrance for visitor pattern.

sslink *add_link(ssnode *node, int source_position = -1, int sink_position = -1, bool insert = true)

Connect this and the given node with a link.

void add_empty_link(ssnode *node)

Add Empty Link to fill link slot. Used during ADG Construction.

virtual std::string name() const = 0

The textformat of this node for the purpose of logging.

inline int delay_fifo_depth()

The size of the timing delay buffer.

inline std::vector<sslink*> &in_links()

In degrees of this node.

inline std::vector<sslink*> &out_links()

Out degrees of this node.

inline void shuffle_links(bool in_links)

Index of a link.

inline virtual bool is_hanger()

The method of checking hanger node in the ADG used by DSE.

inline int lanes()

The number of lanes available in this node.

virtual void dumpIdentifier(ostream &os) = 0
virtual void dumpFeatures(ostream &os) = 0
inline bool is_shared()
inline virtual ~ssnode()
inline void setRoutingTableSize()
inline std::vector<uint64_t> createRoutingTableEntry(int i, int j)
inline void resetAllRoutingTables()
inline void resetNodeTable(ssnode *node)
inline std::vector<std::vector<std::bitset<1>>> printableRoutingTable(int i, int j)
inline uint64_t slots(sslink *first, sslink *second, int slot, int width)
inline uint64_t slots(int x, int y, int slot, int width)
DEF_ATTR(type)

Get set/attributes.

inline const std::vector<sslink*> &links(int x)
inline const std::vector<uint64_t> &routing_table(int x, int y)

Public Members

SpatialFabric *parent = {nullptr}

The spatial fabric to which this node belongs to.

Protected Attributes

int id_ = {-1}

The identifier of this node.

int localId_ = {-1}

Local Node Id, ID per node type.

int x_ = {-1}

The coordination of this node in a mesh. If the topology is irregular, these two numbers are set to -1.

int y_ = {-1}
int datawidth_ = {64}

The width of the datapath of this node.

int granularity_ = {8}

The bit width of the decomposability.

int max_util_ = {1}

=1 indicates dedicated, and >1 means shared.

bool flow_control_ = {true}

If the timing of execution is determined when compilation.

int max_delay_ = {15}

The size of the local FIFO buffer to delay the timing.

The output, and input of this node.

std::vector<std::vector<std::vector<uint64_t>>> routing_table_
NodeType type_ = {None}

Friends

friend class SpatialFabric
friend class sslink
friend class CodesignInstance
class ssovport : public dsa::SyncNode

Public Functions

inline virtual ssnode *copy() override
inline ssovport()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual bool isInputPort() override
inline virtual bool isOutputPort() override
inline virtual int busWidth() override
inline virtual bool padded() override
inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual int bitwidth_capability() override
inline virtual ~ssovport()
inline virtual bool isHanger() override
DEF_ATTR(taskOVP)
DEF_ATTR(discardOVP)

Protected Attributes

bool taskOVP_ = {false}
bool discardOVP_ = {false}
class ssrecurrence : public dsa::DataNode

Public Functions

inline virtual ssnode *copy() override
inline ssrecurrence()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssrecurrence()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

class ssregister : public dsa::DataNode

Public Functions

inline virtual ssnode *copy() override
inline ssregister()
virtual void Accept(adg::Visitor *vistor) override

The entrance for visitor pattern.

inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssregister()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

class ssscratchpad : public dsa::DataNode

Public Functions

inline ssscratchpad()
virtual void Accept(adg::Visitor *visitor) override

The entrance for visitor pattern.

inline virtual ssnode *copy() override
inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline virtual ~ssscratchpad()
inline virtual bool is_hanger() override

The method of checking hanger node in the ADG used by DSE.

inline bool indirect()
class ssswitch : public dsa::SpatialNode

Public Functions

inline ssswitch()
virtual void Accept(adg::Visitor *visitor) override

The entrance for visitor pattern.

inline virtual ssnode *copy() override
inline virtual std::string name() const override

The textformat of this node for the purpose of logging.

inline virtual void dumpIdentifier(ostream &os) override
inline virtual void dumpFeatures(ostream &os) override
inline void collect_features()
inline virtual ~ssswitch()
inline void print_features()
inline void dump_features()

Protected Attributes

double features[9]
class SymbolTable
#include <symbols.h>

The symbol table of the parsed DFG.

Public Functions

SymbolTable()
inline void Set(const std::string &s, ParseResult *pr)
inline bool Has(const std::string &s)
inline ParseResult *Get(const std::string &s)

Public Static Functions

static RegisterEntry isLocalRegister(const std::string &s)

Check if this symbol is a local register. If so, return the index of the register. If not, return -1.

Private Members

std::unordered_map<std::string, ParseResult*> table_
class SyncNode : public dsa::ssnode

Subclassed by dsa::ssivport, dsa::ssovport

Public Functions

inline SyncNode(NodeType type)
inline SyncNode()
virtual std::string name() const = 0

The textformat of this node for the purpose of logging.

virtual void Accept(adg::Visitor *visitor) = 0

The entrance for visitor pattern.

virtual void dumpIdentifier(ostream &os) = 0
virtual void dumpFeatures(ostream &os) = 0
virtual bool isInputPort() = 0
virtual bool isOutputPort() = 0
virtual int bitwidth_capability() = 0
virtual bool isHanger() = 0
virtual int busWidth() = 0
virtual bool padded() = 0
inline virtual ~SyncNode()
inline std::vector<int> &port_vec()
inline void set_port_vec(std::vector<int> p)
inline void set_port2node(std::string portname, ssnode *node)
inline ssnode *convert_port2node(std::string portname)
inline size_t size()
DEF_ATTR(port)
DEF_ATTR(vp_impl)
DEF_ATTR(vp_stated)

Protected Attributes

int port_ = -1
std::vector<int> _port_vec
std::string io_type
int channel_buffer
std::map<std::string, ssnode*> port2node
int vp_impl_ = {2}
bool vp_stated_ = {true}
struct TaskMapEntry : public dsa::dfg::ParseResult
#include <symbols.h>

The converted task mapping TaskDep: (A:C, B:D) Here (A:C, B:D) will be parsed as control entry @vidushi: I am not sure why is this here compared to in ssdfg.h (just copies?) actually this is not required…was just required for ControlEntry for some reason…

Public Functions

TaskMapEntry(ParseResult *controller_)
TaskMapEntry(std::unordered_map<std::string, std::string> &port_map_, ParseResult *controller_)

Public Members

ParseResult *controller
std::unordered_map<std::string, std::string> port_map
struct Value
#include <node.h>

The data structure of the values produced by a node.

Public Functions

inline Value()

The default constructor.

inline Value(SSDfg *parent, int nid, int index)

Construct a value instance.

The value index in the node to which this value belongs.

Parameters
  • parent – The DFG it belongs to.

  • nid – The IR node it belongs to.

Node *node() const

The helper function translates the node id to node pointer. We adopt this design for the purpose of shallow copy.

void push(uint64_t value, bool valid, int delay)
bool forward(bool attempt)
std::string name()

The text representative of this node for logging.

Public Members

std::queue<dsa::sim::SpatialPacket> fifo
SSDfg *parent

The DFG this value belongs to.

int nid = {-1}

The IR node this value belongs to.

int index = {0}

The value index in the node to which this value belongs.

std::vector<int> uses

The id’s of the out going edges.

int reg = {-1}

The register index this value should be written to. If no, -1.

std::string symbol

Symbol name in DFG format.

struct ValueEntry : public dsa::dfg::ParseResult
#include <symbols.h>

A value of computation or input vector with slices Example 1: A,B = F(C,D) A and B are values.

Example 2: A = C:0:63 Here C:0:63 is a sliced value

Public Functions

inline ValueEntry(int nid_, int vid_, int l_ = 0, int r_ = 63)

Public Members

int nid
int vid
int l
int r
class VectorPort : public dsa::dfg::Node
#include <port.h>

The base class of an input/output in DFG.

Subclassed by dsa::dfg::InputPort, dsa::dfg::OutputPort

Public Functions

inline VectorPort()
VectorPort(V_TYPE v, int len, int bitwidth_, const std::string &name, SSDfg *ssdfg, const MetaPort &meta)
virtual void Accept(Visitor*) override
virtual int vectorLanes() = 0

The vector lanes of this i/o.

inline bool indirect()

If this port is an indirect port.

inline virtual std::string name() override

The text format name of this port.

inline virtual int bitwidth() override

The scalar bitwidth.

inline int bandwidth()

The bandwidth of this port.

Public Members

CompileMeta meta

Protected Attributes

int bitwidth_ = {INT_MAX / 8}
bool _indirect = false

Friends

friend class SSDfg
struct VertexProp
#include <schedule.h>

\brif The properties of DFG node mapping.

Public Functions

inline ssnode *node() const

The helper of accessing the ADG node.

inline int lane() const

The helper of accessing the lane in the ADG node.

Public Members

int min_lat = {INT_MAX}

The bound of data timing.

int max_lat = {INT_MIN}
int lat = {0}

The latency assigned to this node.

int vio = {0}

The timing violation of this node.

mapper::Slot<ssnode*> slot = {-1, nullptr}

The ADG decomposable slot mapped to.

struct Visitor
#include <visitor.h>

A linear vistor for ADG nodes.

Subclassed by dsa::adg::GraphVisitor

Public Functions

virtual void Visit(ssnode *node)
virtual void Visit(ssfu *node)
virtual void Visit(ssswitch *node)
virtual void Visit(ssivport *node)
virtual void Visit(ssovport *node)
virtual void Visit(ssdma *node)
virtual void Visit(ssscratchpad *node)
virtual void Visit(ssrecurrence *node)
virtual void Visit(ssgenerate *node)
virtual void Visit(ssregister *node)
struct Visitor

Public Functions

virtual void Visit(Node*)
virtual void Visit(Instruction*)
virtual void Visit(Operation*)
virtual void Visit(VectorPort*)
virtual void Visit(InputPort*)
virtual void Visit(OutputPort*)
virtual void Visit(Array*)
virtual void Visit(DMA*)
virtual void Visit(Scratchpad*)
virtual void Visit(Recurrance*)
virtual void Visit(Register*)
virtual void Visit(Generate*)
class WorkloadSchedules

Public Functions

inline float estimate_performance()

Public Members

std::vector<Schedule> sched_array
namespace cxxopts
namespace dsa

Functions

template<typename T>
T get_prop_attr(Json::Value &prop, const std::string &name, T dft)
template<typename T>
void fix_id(std::vector<T> &vec)
template<typename T>
void fix_local_id(std::vector<T> vec)
template<typename T>
void delete_by_id(std::vector<T> &vec, int index)
void DesignSpaceExploration(CodesignInstance *cur_ci)

Variables

const int MAX_SUBNETS = 8
namespace adg

Enums

enum ADGKEY

Values:

Functions

SpatialFabric *Import(std::string filename)

Load a JSON file and parse it to architecture description.

Parameters

filename – The name of the JSON file.

Returns

SpatialFabric* The parsed spatial architecture.

Variables

const char *const ADGKEY_NAMES [] {#define MACRO(x, y)# 28 "/home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/arch/utils.h" 2}

This is the set for the name of the key in Architecture Description Graph.

namespace estimation

Enums

enum class Hardware

Values:

enumerator ASIC
enumerator FPGA
enum class Metric

Values:

enumerator Power
enumerator Area
enumerator Total
enum class Breakdown

Values:

enumerator FU
enumerator Switch
enumerator IVPort
enumerator OVPort
enumerator Scratchpad
enumerator DMA
enumerator Recurrance
enumerator Generate
enumerator Register
enumerator Core
enumerator System_Bus
enumerator Total

Functions

Result EstimatePowerAera(SSModel*)

Estimating the power/area breakdown of the given hardware.

namespace core
namespace utils

Functions

Json::Value LoadJsonFromFile(const std::string &fname)

A helper wrapper for jsoncpp interfaces.

Parameters

fname – The file to be opened and loaded.

namespace dfg

Enums

enum class OperandType

Values:

enumerator data
enumerator ctrl
enumerator self
enumerator ctrl_true
enumerator ctrl_false
enumerator local_reg
enumerator unknown

Functions

OperandType Str2Flag(const std::string &s)
void UpdateNodeByArgs(Node *node, std::vector<ParseResult*> &args)

Update the properties of a DFG node by the arguments.

Parameters
  • node – The DFG node to be updated

  • args – The arguments of the instruction or operation

void Export(SSDfg *dfg, const std::string &fname)

Dump the DFG in json format for simulation.

Parameters
  • dfg – The DFG to dump.

  • fname – The json filename.

SSDfg Import(const std::string &fname)

Load the json into DFG data structure.

Parameters

fname – The filename to load

Returns

The DFG loaded.

Variables

constexpr char const *OPERAND_TYPE[] = {"data", "ctrl", "self", "pred", "inv_pred", "register", "<unknown>"}
constexpr char const *MetaDataText[] = {"memory", "spad", "localport", "remoteport"}
constexpr char const *MetaOperationText[] = {"read", "write", "indread", "indwrite", "atomic"}
namespace mapper
namespace sim
file estimation.h
#include <functional>
#include <iostream>
#include <vector>
#include <map>
file fabric.h
#include <iostream>
#include “dsa/arch/sub_model.h
#include “dsa/core/singleton.h
file fu_model.h
#include <assert.h>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include “dsa/arch/ssinst.h”
#include “dsa/debug.h
file model.h
#include <iostream>
#include <cstdio>
#include <map>
#include <ostream>
#include <set>
#include <string>
#include <vector>
#include “dsa/arch/utils.h
#include “dsa/arch/fabric.h
#include “dsa/arch/fu_model.h
#include “dsa/arch/sub_model.h
file predict.h
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <vector>

Functions

double pe_area_predict(const double x1[12])
std::vector<float> pe_area_predict_fpga(const std::vector<float> parameters)
double pe_power_predict(const double x1[12])
double router_area_predict(const double x1[9])
std::vector<float> switch_area_predict_fpga(const std::vector<float> parameters)
std::vector<float> router_area_predict_fpga(const std::vector<float> parameters)
double router_power_predict(const double x1[9])
double pred_dedi_router_area(const double x1[5])
double pred_dedi_router_power(const double x1[5])
std::vector<float> input_vport_area_predict_fpga(const float in_links)
std::vector<float> output_vport_area_predict_fpga(const float in_links)
std::vector<float> vport_area_predict_fpga(const std::vector<float> parameters)
std::vector<double> spm_area_predict_fpga(const std::vector<double> parameters)
std::vector<double> dma_area_predict_fpga(const std::vector<double> parameters)
std::vector<double> system_bus_area_predict_fpga(const std::vector<double> parameters)
double pred_vport_area(const double x1[3])
double pred_vport_power(const double x1[3])
file spad.h
#include <cstdint>
file sub_model.h
#include <algorithm>
#include <bitset>
#include <climits>
#include <fstream>
#include <functional>
#include <map>
#include <sstream>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include “dsa/core/singleton.h
#include “dsa/debug.h
#include “fu_model.h
#include “json/value.h”

Defines

DEF_ATTR(attr)
file utils.h
#include <string>
#include “dsa/arch/fabric.h
#include “./adg.ref”

Defines

MACRO(x, y)
MACRO(x, y)
file utils.h
#include <string>
#include “json/json.h”
file utils.h
#include <string>
#include “dsa/dfg/ssdfg.h
#include “dsa/mapper/schedule.h
file visitor.h
#include “dsa/arch/sub_model.h
file visitor.h
file idable.h

Defines

DEFATTR(ty, name, value)
file singleton.h
#include <cstdint>
#include “dsa/arch/estimation.h
file debug.h
#include <cassert>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <utility>

Defines

DSA_OSTREAM
DSA_NEWLINE
DSA_CHECK(COND)
DSA_WARNING
DSA_INFO
DSA_LOG(S)
ENFORCED_SYSTEM(CMD)
file array.h
#include <climits>
#include “dsa/dfg/metadata.h
#include “dsa/dfg/node.h
file instruction.h
#include <map>
#include “dsa/dfg/node.h
#include “dsa/dfg/visitor.h
#include “dsa/dfg/control.def”

Defines

MACRO(ENUM, STR)
file metadata.h
#include <cassert>
#include <iostream>
#include <sstream>
#include “dsa/debug.h
file node.h
#include <queue>
#include “dsa/debug.h
#include “dsa/dfg/metadata.h
#include “dsa/dfg/visitor.h
#include “dsa/simulation/data.h
file port.h
#include <climits>
#include “dsa/dfg/metadata.h
#include “dsa/dfg/node.h
file ssdfg.h
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include “dsa/arch/model.h
#include “dsa/arch/ssinst.h”
#include “dsa/dfg/instruction.h
#include “dsa/dfg/metadata.h
#include “dsa/dfg/node.h
#include “dsa/dfg/port.h
#include “dsa/dfg/array.h
#include “dsa/dfg/symbols.h
#include “dsa/simulation/data.h
#include “dsa-ext/spec.h”

Typedefs

typedef std::pair<std::vector<std::string>, std::vector<std::string>> string_pair
typedef std::vector<string_pair> task_def_t
typedef std::vector<std::string> string_vec_t
typedef std::map<int, string_vec_t> ctrl_def_t
file symbols.h
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include “dsa/debug.h
#include “dsa/dfg/metadata.h
#include “dsa/dfg/node.h
file config_defs.h

Defines

IN_ACT_SLICE
OUT_ACT_SLICE
VP_MAP_SLICE_1
VP_MAP_SLICE_2
VP_MAP_SLICE_OUT
NUM_DFG_GROUPS
IN_ACT_GROUP12
IN_ACT_GROUP34
IN_ACT_GROUP56
OUT_ACT_GROUP12
OUT_ACT_GROUP34
OUT_ACT_GROUP56
SWITCH_SLICE
NUM_IN_DIRS
NUM_OUT_DIRS
NUM_IN_FU_DIRS
BITS_PER_DIR
BITS_PER_FU_DIR
ROW_LOC
ROW_BITS
SWITCH_LOC
SWITCH_BITS
FU_DIR_LOC
FU_DIR_BITS
FU_PRED_INV_LOC
FU_PRED_INV_BITS
OPCODE_LOC
OPCODE_BITS
IN_DELAY_LOC
BITS_PER_DELAY
NUM_DELAY
IN_DELAY_BITS
COL_LOC
COL_BITS
IS_IMM_LOC
IS_IMM_BITS
CTRL_LOC
CTRL_BITS
file dse.h
#include <string>
#include <limits>
#include <torch/script.h>
#include “dsa/arch/estimation.h
#include “dsa/arch/model.h
#include “schedule.h
#include “scheduler.h
#include “dsa/core/singleton.h

Functions

static unsigned int log2(unsigned int val)
inline int next_power_of_two(int n)
template<typename T>
inline int non_uniform_random(const std::vector<T> &nodes, const std::vector<bool> &vec)
file schedule.h
#include <algorithm>
#include <climits>
#include <fstream>
#include <iostream>
#include <map>
#include <unordered_set>
#include “dsa/arch/model.h
#include “dsa/arch/sub_model.h
#include “dsa/dfg/ssdfg.h
#include “dsa/dfg/visitor.h
#include “dsa/mapper/config_defs.h

Defines

MAX_SCHED_LAT

Functions

template<>
inline int num_mapped<dsa::dfg::Node*>()
file scheduler.h
#include <stdlib.h>
#include <chrono>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
#include “dsa/arch/model.h
#include “dsa/core/singleton.h
#include “dsa/dfg/ssdfg.h
#include “dsa/mapper/schedule.h

Defines

MAX_ROUTE

Typedefs

using usec = std::chrono::microseconds
using get_time = std::chrono::steady_clock

Functions

std::string basename(const std::string &filename)
template<typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r)
template<typename T, typename U>
std::pair<T, U> operator-(const std::pair<T, U> &l, const std::pair<T, U> &r)
void make_directories(const std::string &s)
file scheduler_sa.h
#include <iostream>
#include <map>
#include <utility>
#include <unordered_map>
#include “dsa/mapper/schedule.h
#include “dse.h
#include “scheduler.h

Defines

DEBUG_SCHED
file data.h
#include <cstdint>
#include <utility>
#include <vector>
#include “dsa/arch/ssinst.h”
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/arch
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/core
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/dfg
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/mapper
dir /home/docs/checkouts/readthedocs.org/user_builds/dsa-framework/checkouts/latest/dsa-scheduler/include/dsa/simulation