Fletchgen
The Fletcher Design Generator
profiler.h
1 // Copyright 2018-2019 Delft University of Technology
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <cerata/api.h>
18 #include <utility>
19 #include <string>
20 #include <vector>
21 #include <memory>
22 #include <map>
23 
24 #include "fletchgen/basic_types.h"
25 #include "fletchgen/nucleus.h"
26 
27 namespace fletchgen {
28 
30 using NodeProfilerPorts = std::map<Node *, std::pair<std::vector<Instance *>, std::vector<Port *>>>;
31 
33 std::vector<MmioReg> GetProfilingRegs(const std::vector<std::shared_ptr<RecordBatch>> &recordbatches);
34 
36 std::shared_ptr<cerata::Type> stream_probe(const std::shared_ptr<Node> &count_width);
37 
39 std::unique_ptr<cerata::Instance> profiler(const std::string &name,
40  cerata::NodeMap *rebinding,
41  const std::shared_ptr<cerata::ClockDomain> &domain = kernel_cd());
42 
55 NodeProfilerPorts EnableStreamProfiling(cerata::Component *comp, const std::vector<cerata::Signal *> &profile_nodes);
56 
57 } // namespace fletchgen
Contains all classes and functions related to Fletchgen.
Definition: array.cc:29
std::shared_ptr< ClockDomain > kernel_cd()
Fletcher accelerator clock domain.
Definition: basic_types.cc:62
std::unique_ptr< cerata::Instance > profiler(const std::string &name, cerata::NodeMap *rebinding, const std::shared_ptr< cerata::ClockDomain > &domain=kernel_cd())
Returns an instance of a StreamProfiler.
std::map< Node *, std::pair< std::vector< Instance * >, std::vector< Port * > >> NodeProfilerPorts
A mapping from nodes to profiler instances and ports.
Definition: profiler.h:30
std::shared_ptr< cerata::Type > stream_probe(const std::shared_ptr< Node > &count_width)
Returns a stream probe type based on a count width for multi-epc streams.
Definition: profiler.cc:110
NodeProfilerPorts EnableStreamProfiling(cerata::Component *comp, const std::vector< cerata::Signal * > &profile_nodes)
Transforms a Cerata component graph to include stream profilers for selected nodes.
Definition: profiler.cc:155
std::vector< MmioReg > GetProfilingRegs(const std::vector< std::shared_ptr< RecordBatch >> &recordbatches)
Obtain the registers that should be reserved in the mmio component for profiling.
Definition: profiler.cc:66