convert.cpp 717 Bytes
Newer Older
1
#include <migraphx/gpu/device/convert.hpp>
2
3
4
5
6
7
8
#include <migraphx/gpu/device/nary.hpp>

namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {

9
void convert(hipStream_t stream, const argument& result, const argument& arg)
10
{
11
12
    result.visit([&](auto output) {
        arg.visit([&](auto input) {
13
14
            const auto* input_ptr = device_cast(input.data());
            auto* output_ptr      = device_cast(output.data());
15
16
            gs_launch(stream, result.get_shape().elements())(
                [=](auto i) __device__ { output_ptr[i] = input_ptr[i]; });
17
18
19
20
21
22
23
24
        });
    });
}

} // namespace device
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx