target.cpp 1.02 KB
Newer Older
Paul's avatar
Paul committed
1
2
3
4
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/lowering.hpp>
#include <migraph/gpu/write_literals.hpp>
#include <migraph/gpu/context.hpp>
Paul's avatar
Paul committed
5
#include <migraph/check_context.hpp>
Paul's avatar
Paul committed
6
#include <migraph/auto_contiguous.hpp>
Paul's avatar
Paul committed
7
8
#include <migraph/dead_code_elimination.hpp>
#include <migraph/simplify_reshapes.hpp>
9
#include <migraph/eliminate_contiguous.hpp>
Paul's avatar
Paul committed
10
11

namespace migraph {
Paul's avatar
Paul committed
12
namespace gpu {
Paul's avatar
Paul committed
13

Paul's avatar
Paul committed
14
std::vector<pass> target::get_passes(migraph::context& gctx) const
Paul's avatar
Paul committed
15
{
Paul's avatar
Paul committed
16
    auto& ctx = any_cast<context>(gctx);
Paul's avatar
Paul committed
17
18
19
20
    // clang-format off
    return
    {
        auto_contiguous{},
Paul's avatar
Paul committed
21
        simplify_reshapes{},
Paul's avatar
Paul committed
22
        lowering{ctx},
23
        eliminate_contiguous{},
Paul's avatar
Paul committed
24
        write_literals{},
25
26
        check_context<context>{},
        dead_code_elimination{}
Paul's avatar
Paul committed
27
28
    };
    // clang-format on
Paul's avatar
Paul committed
29
}
Paul's avatar
Paul committed
30

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

Paul's avatar
Paul committed
33
migraph::context target::get_context() const
Paul's avatar
Paul committed
34
{
Paul's avatar
Paul committed
35
    return context{share(make_obj<miopen_handle>(&miopenCreate)),
Paul's avatar
Paul committed
36
                   share(create_rocblas_handle_ptr())};
Paul's avatar
Paul committed
37
38
}

Paul's avatar
Paul committed
39
} // namespace gpu
Paul's avatar
Paul committed
40

Paul's avatar
Paul committed
41
} // namespace migraph