target.cpp 1.87 KB
Newer Older
Paul's avatar
Paul committed
1
2
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/lowering.hpp>
mei-ye's avatar
mei-ye committed
3
#include <migraph/memory_coloring.hpp>
Paul's avatar
Paul committed
4
5
#include <migraph/gpu/write_literals.hpp>
#include <migraph/gpu/context.hpp>
6
#include <migraph/gpu/eliminate_workspace.hpp>
Paul's avatar
Paul committed
7
#include <migraph/eliminate_allocation.hpp>
Paul's avatar
Paul committed
8
#include <migraph/gpu/fuse_ops.hpp>
Paul's avatar
Paul committed
9
#include <migraph/check_context.hpp>
Paul's avatar
Paul committed
10
#include <migraph/auto_contiguous.hpp>
Paul's avatar
Paul committed
11
12
#include <migraph/dead_code_elimination.hpp>
#include <migraph/simplify_reshapes.hpp>
Paul's avatar
Paul committed
13
14
#include <migraph/simplify_algebra.hpp>
#include <migraph/constant_propagate.hpp>
15
#include <migraph/eliminate_contiguous.hpp>
Paul's avatar
Paul committed
16
#include <migraph/common_subexpression_elimination.hpp>
17
#include <migraph/fwd_conv_batchnorm_rewrite.hpp>
Paul's avatar
Paul committed
18
19

namespace migraph {
20
namespace MIGRAPH_INLINE_NS {
Paul's avatar
Paul committed
21
namespace gpu {
mei-ye's avatar
mei-ye committed
22

Paul's avatar
Paul committed
23
std::vector<pass> target::get_passes(migraph::context& gctx) const
Paul's avatar
Paul committed
24
{
Paul's avatar
Paul committed
25
    auto& ctx = any_cast<context>(gctx);
Paul's avatar
Paul committed
26
27
28
    // clang-format off
    return
    {
Paul's avatar
Paul committed
29
30
        dead_code_elimination{},
        fwd_conv_batchnorm_rewrite{},
Paul's avatar
Paul committed
31
        dead_code_elimination{},
Paul's avatar
Paul committed
32
33
        common_subexpression_elimination{},
        dead_code_elimination{},
Paul's avatar
Paul committed
34
35
36
37
        simplify_algebra{},
        dead_code_elimination{},
        constant_propagate{},
        dead_code_elimination{},
Paul's avatar
Paul committed
38
        auto_contiguous{},
Paul's avatar
Paul committed
39
        simplify_reshapes{},
Paul's avatar
Paul committed
40
        dead_code_elimination{},
Paul's avatar
Paul committed
41
        lowering{ctx},
42
        eliminate_contiguous{},
Paul's avatar
Paul committed
43
        dead_code_elimination{},
Paul's avatar
Paul committed
44
45
        fuse_ops{&ctx},
        dead_code_elimination{},
Paul's avatar
Paul committed
46
        write_literals{&ctx},
Paul's avatar
Paul committed
47
        memory_coloring{"hip::allocate"},
Paul's avatar
Paul committed
48
49
        eliminate_workspace{},
        eliminate_allocation{"hip::allocate"},
50
51
        check_context<context>{},
        dead_code_elimination{}
Paul's avatar
Paul committed
52
53
    };
    // clang-format on
Paul's avatar
Paul committed
54
}
Paul's avatar
Paul committed
55

Paul's avatar
Paul committed
56
std::string target::name() const { return "miopen"; }
Paul's avatar
Paul committed
57

Paul's avatar
Paul committed
58
migraph::context target::get_context() const { return context{}; }
Paul's avatar
Paul committed
59
} // namespace gpu
60
} // namespace MIGRAPH_INLINE_NS
Paul's avatar
Paul committed
61
} // namespace migraph