"fmoe/megatron/checkpoint.py" did not exist on "1c69da9cb900ba6203adcedfe387b630b139ab5b"
write_literals.cpp 519 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
14
15
16
17
18
19
20
21
22
{
    for(auto ins : iterator_for(p))
    {
        if(ins->op.name() == "@literal")
        {
            literal l = ins->lit;
            auto pre  = p.add_literal(l);
            p.replace_instruction(ins, hip_write{}, pre);
        }
    }
}

Paul's avatar
Paul committed
23
} // namespace gpu
Paul's avatar
Paul committed
24
25

} // namespace migraph