def configure(self, config):

        self.S = config['shape']['S']  # number of filter cols
        self.R = config['shape']['R']  # number of filter rows
        self.H = config['shape']['H']
        self.W = config['shape']['W']
        self.E = config['shape']['E']  # number of ofmap rows
        self.F = config['shape']['F']  # number of ofmap cols
        self.M = config['shape']['M']  # number of output channels
        self.N = config['shape']['N']  # batch size
        self.C = config['shape']['C']  # number of input channels
        self.U = config['shape']['U']  # stride

        self.N0 = config['mapping'][
            'N0']  # size of the batch gets processed in the tile

        self.e = math.ceil((self.H - self.R + 1) / self.U)
        self.f = math.ceil((self.W - self.S + 1) / self.U)

        self.new_pass_config()

        AG.configure(self)

        self.nrepeat = self.e * self.f * self.N0
        self.params = {'count_max': self.nrepeat - 1}
    def configure(self, config):

        self.S = config['shape']['S']  # number of filter cols
        self.R = config['shape']['R']
        self.M = config['shape']['M']  # number of output channels
        self.N = config['shape']['N']  # number of output images
        self.C = config['shape']['C']

        self.set = False
        self.count = False
        self.attrs = {'count_max': self.S * self.R - 1}
        AG.configure(self)
Exemplo n.º 3
0
    def configure(self, config):
        self.depth = config['logical_depth']
        # 2D shape of the datatype
        self.S = config['shape']['S']  # number of filter cols
        self.W = config['shape']['W']  # number of ifmap cols
        self.F = config['shape']['F']  # number of ofmap cols

        self.R = config['shape']['R']  # number of filter rows
        self.H = config['shape']['H']  # number of ifmap  rows
        self.E = config['shape']['E']  # number of ofmap  rows

        self.N = config['shape']['N']  # total number of ifmaps
        self.M = config['shape']['M']  # total number of filters
        self.C = config['shape']['C']  # total number of input channels

        self.U = config['shape']['U']  # stride size

        # mapping parameters needed
        self.k = config['mapping']['C0']  # number of tile input channels
        self.k_last = self.C % self.k if not self.C % self.k == 0 else self.k
        self.m = config['mapping']['M0']  # number of tile output channels
        self.m_last = self.M % self.m if not self.M % self.m == 0 else self.m
        self.n = config['mapping']['N0']  # number of tile ifmaps
        self.n_last = self.N % self.n if not self.N % self.n == 0 else self.n
        self.e = math.ceil((self.H - self.R + 1) / self.U)
        self.f = math.ceil((self.W - self.S + 1) / self.U)

        # generate counters according to the mapping
        self.n_in_chn_tile = math.ceil(self.C / self.k)
        self.n_out_chn_tile = math.ceil(self.M / self.m)
        self.n_batch_tile = math.ceil(self.N / self.n)
        self.n_tile = self.n_out_chn_tile * self.n_batch_tile

        self.entries_per_pass = math.ceil(self.m * self.e * self.f * self.n /
                                          self.width)

        # number of tiles the layer will incur, determines when should the address generation completely stop
        self.nreset = self.n_tile
        self.curr_tile = 0
        self.new_tile_config()
        AG.configure(self)
    def configure(self, config):

        self.depth = config['logical_depth']

        # 2D shape of the datatype
        self.S = config['shape']['S']  # number of filter cols
        self.W = config['shape']['W']  # number of ifmap cols
        self.F = config['shape']['F']  # number of ofmap cols

        self.R = config['shape']['R']  # number of filter rows
        self.H = config['shape']['H']  # number of ifmap  rows
        self.E = config['shape']['E']  # number of ofmap  rows

        self.N = config['shape']['N']  # total number of ifmaps
        self.M = config['shape']['M']  # total number of filters
        self.C = config['shape']['C']  # total number of input channels

        self.U = config['shape']['U']  # stride size

        # mapping parameters needed
        self.k = config['mapping']['C0']  # number of tile input channels
        self.m = config['mapping']['M0']  # number of tile output channels
        self.n = config['mapping']['N0']  # number of tile ifmaps
        self.e = math.ceil((self.H - self.R + 1) / self.U)
        self.f = math.ceil((self.W - self.S + 1) / self.U)

        # generate counters according to the mapping
        self.n_in_chn_tile = math.ceil(self.C / self.k)
        self.n_out_chn_tile = math.ceil(self.M / self.m)
        self.n_batch_tile = math.ceil(self.N / self.n)
        self.n_tile = self.n_in_chn_tile * self.n_out_chn_tile * self.n_batch_tile
        self.addr_per_pass = self.k * self.n * self.E * self.F
        self.entries_per_pass = math.ceil(self.addr_per_pass / self.width)
        self.rounds_per_pass = math.ceil(self.entries_per_pass / self.depth)

        self.curr_tile = 0
        self.curr_round = 0
        self.nreset = self.n_tile
        self.new_tile_config()
        AG.configure(self)