ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Driver.cpp File Reference
#include <enco/Frontend.h>
#include <enco/Backend.h>
#include <cmdline/View.h>
#include <string>
#include <vector>
#include <functional>
#include "Dump.h"
#include <dlfcn.h>
#include <memory>
#include <map>
#include <iostream>
#include <stdexcept>

Go to the source code of this file.

Data Structures

class  cmdline::Vector
 

Namespaces

namespace  cmdline
 

Functions

int entry (int argc, char **argv)
 Dump IR for given arguments.
 

Function Documentation

◆ entry()

int entry ( int  argc,
char **  argv 
)

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

HDF5 layout is like below

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 ...

Definition at line 155 of file Driver.cpp.

156{
157 // Usage:
158 // [Command] --frontend [Frontend .so path] --frontend-arg ...
159 std::unique_ptr<FrontendZone> frontend_zone;
160
161 // Simple argument parser (based on map)
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 // dump
201 dump(bundle.module());
202
203 // todo : dump data
204
205 return 0;
206}
void dump(const coco::Op *op, int indent)
Definition Dump.cpp:177

References dump().