"library/vscode:/vscode.git/clone" did not exist on "e573a2a0e7c6099b9bf19cc0f14e4ea6645e9957"
Commit 3d4d0179 authored by Paul's avatar Paul
Browse files

Add run and compile command

parent e6174b8f
......@@ -5,6 +5,7 @@
#include <migraphx/config.hpp>
#include <migraphx/type_name.hpp>
#include <migraphx/stringutils.hpp>
#include <unordered_map>
#include <vector>
......@@ -20,10 +21,23 @@ inline auto& get_commands()
}
template <class T>
std::string command_name()
std::string compute_command_name()
{
static const std::string& name = get_type_name<T>();
return name.substr(name.rfind("::") + 2);
static const std::string& tname = get_type_name<T>();
auto name = tname.substr(tname.rfind("::") + 2);
if (ends_with(name, "_command"))
name = name.substr(0, name.size()-8);
if (ends_with(name, "_cmd"))
name = name.substr(0, name.size()-4);
return name;
}
template <class T>
const std::string& command_name()
{
static const std::string& name = compute_command_name<T>();
return name;
}
template <class T>
......
......@@ -122,6 +122,40 @@ struct verify : command<verify>
}
};
struct compile : command<compile>
{
compiler c;
void parse(argument_parser& ap)
{
c.parse(ap);
}
void run()
{
std::cout << "Compiling ... " << std::endl;
auto p = c.compile();
std::cout << p << std::endl;
}
};
struct run_cmd : command<run_cmd>
{
compiler c;
void parse(argument_parser& ap)
{
c.parse(ap);
}
void run()
{
std::cout << "Compiling ... " << std::endl;
auto p = c.compile();
std::cout << "Allocating params ... " << std::endl;
auto m = c.params(p);
std::cout << p << std::endl;
}
};
struct perf : command<perf>
{
compiler c;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment