Unverified Commit 2466dd6f authored by Shucai Xiao's avatar Shucai Xiao Committed by GitHub
Browse files

Refactor program to module (#684)



* code backup

* clang format

* change corresponding tool files

* clang format
Co-authored-by: default avatarmvermeulen <5479696+mvermeulen@users.noreply.github.com>
parent de10423f
#ifndef MIGRAPHX_GUARD_RTGLIB_CPU_LOWERING_HPP
#define MIGRAPHX_GUARD_RTGLIB_CPU_LOWERING_HPP
#include <migraphx/program.hpp>
#include <string>
#include <migraphx/config.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct program;
using module = program;
namespace cpu {
struct lowering
{
std::string name() const { return "cpu::lowering"; }
void apply(program& p) const;
void apply(module& p) const;
};
} // namespace cpu
......
......@@ -27,6 +27,7 @@
#include <migraphx/cpu/gemm.hpp>
#include <migraphx/register_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/program.hpp>
#include <unordered_map>
#include <utility>
#include <iostream>
......@@ -882,7 +883,7 @@ MIGRAPHX_REGISTER_OP(cpu_rnn_var_sl_last_output)
struct cpu_apply
{
program* prog;
module* prog;
std::unordered_map<std::string, std::function<void(instruction_ref)>> apply_map{};
template <class T>
......@@ -967,7 +968,7 @@ struct cpu_apply
}
};
void lowering::apply(program& p) const { cpu_apply{&p}.apply(); }
void lowering::apply(module& p) const { cpu_apply{&p}.apply(); }
} // namespace cpu
} // namespace MIGRAPHX_INLINE_NS
......
......@@ -7,7 +7,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
void adjust_allocation::apply(program& p) const
void adjust_allocation::apply(module& p) const
{
for(auto ins : iterator_for(p))
{
......
......@@ -28,7 +28,7 @@ struct hip_stream_model
bool is_wait(migraphx::instruction_ref ins) const { return ins->name() == "gpu::wait_event"; }
};
stream_model make_stream_model(const program& p)
stream_model make_stream_model(const module& p)
{
hip_stream_model m;
std::size_t stream = 0;
......@@ -49,7 +49,7 @@ stream_model make_stream_model(const program& p)
return m;
}
std::vector<stream_race> analyze_streams(const program& p)
std::vector<stream_race> analyze_streams(const module& p)
{
return migraphx::analyze_streams(p, make_stream_model(p));
}
......
......@@ -11,7 +11,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
void eliminate_workspace::apply(program& p) const
void eliminate_workspace::apply(module& p) const
{
std::size_t n = 0;
std::vector<instruction_ref> allocs;
......
This diff is collapsed.
......@@ -13,7 +13,7 @@ namespace gpu {
struct adjust_allocation
{
std::string name() const { return "gpu::adjust_allocation"; }
void apply(program& p) const;
void apply(module& p) const;
};
} // namespace gpu
......
......@@ -6,9 +6,13 @@
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct program;
using module = program;
namespace gpu {
std::vector<stream_race> analyze_streams(const program& p);
std::vector<stream_race> analyze_streams(const module& p);
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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