target.cpp 972 Bytes
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>
Paul's avatar
Paul committed
9
10

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

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

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

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

Paul's avatar
Paul committed
37
} // namespace gpu
Paul's avatar
Paul committed
38

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