Dump IR for given arguments.
Call example: $ ./build/compiler/encodump/encodump \ –frontend build/compiler/enco/frontend/caffe/libenco_caffe_frontend.so \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.prototxt \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.caffemodel
GROUP "/" ㄴGROUP "name" ㄴATTRIBUTE "0" ㄴDATA (0): "input_01:0" ㄴATTRIBUTE "1" ㄴDATA (0): "input_02:0" ㄴGROUP "value" ㄴDATASET "0" ㄴDATA ... ㄴDATASET "1" ㄴDATA ...
156{
157
158
159 std::unique_ptr<FrontendZone> frontend_zone;
160
161
162 std::map<std::string, std::function<void(const std::string &arg)>> argparse;
163
164 argparse["--frontend"] = [&](const std::string &path) {
165 frontend_zone = std::make_unique<FrontendZone>(path);
166 };
167
168 argparse[
"--frontend-arg"] = [&](
const std::string &
arg) { frontend_zone->append(arg); };
169
170 if (argc < 2)
171 {
172 std::cerr << "Usage:" << std::endl;
173 std::cerr << "[Command] --frontend [.so path]" << std::endl;
174 std::cerr << " --frontend-arg [argument] ..." << std::endl;
175 return 255;
176 }
177
178 for (
int n = 1; n <
argc; n += 2)
179 {
180 const std::string tag{
argv[n]};
181 const std::string
arg{
argv[n + 1]};
182
183 auto it = argparse.find(tag);
184
185 if (it == argparse.end())
186 {
187 std::cerr << "Option '" << tag << "' is not supported" << std::endl;
188 return 255;
189 }
190
191 it->second(arg);
192 }
193
194 assert(frontend_zone != nullptr);
195
196 auto frontend = frontend_zone->factory()->make(frontend_zone->args());
197
198 auto bundle = frontend->load();
199
200
201 dump(bundle.module());
202
203
204
205 return 0;
206}
void dump(const coco::Op *op, int indent)