write_literals.cpp 683 Bytes
Newer Older
Paul's avatar
Paul committed
1
#include <migraph/gpu/write_literals.hpp>
Paul's avatar
Paul committed
2
#include <migraph/iterator_for.hpp>
Paul's avatar
Paul committed
3
#include <migraph/gpu/hip.hpp>
Paul's avatar
Paul committed
4
5
6
7
#include <migraph/instruction.hpp>

namespace migraph {

Paul's avatar
Paul committed
8
namespace gpu {
Paul's avatar
Paul committed
9

Paul's avatar
Paul committed
10
void write_literals::apply(program& p) const
Paul's avatar
Paul committed
11
12
13
{
    for(auto ins : iterator_for(p))
    {
mei-ye's avatar
mei-ye committed
14
#if 0        
Paul's avatar
Paul committed
15
16
17
18
19
20
        if(ins->op.name() == "@literal")
        {
            literal l = ins->lit;
            auto pre  = p.add_literal(l);
            p.replace_instruction(ins, hip_write{}, pre);
        }
mei-ye's avatar
mei-ye committed
21
22
23
24
25
#else
        if (ins->op.name() == "write_literal") {
            p.replace_instruction(ins, hip_memcpy{}, ins->arguments);
        }
#endif        
Paul's avatar
Paul committed
26
27
28
    }
}

Paul's avatar
Paul committed
29
} // namespace gpu
Paul's avatar
Paul committed
30
31

} // namespace migraph