Commit cfbd5e8b authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Add tupleVisitor for from_gpu

Need this for when we debug and use MIGRAPHX_TRACE_EVAL() to show tuples

Without this we break when reading our buffer due to the use of visit()

Credit for Paul Fultz helping on this.
parent 3eaeeca9
......@@ -196,12 +196,21 @@ argument to_gpu(const argument& arg, bool host)
argument from_gpu(const argument& arg)
{
argument result;
arg.visit([&](auto x) {
arg.visit(
[&](auto x) {
using type = typename decltype(x)::value_type;
auto v = read_from_gpu<type>(arg.data(), x.get_shape().bytes() / sizeof(type));
// cppcheck-suppress returnDanglingLifetime
result = {x.get_shape(), [v]() mutable { return v.data(); }};
},
[&](const auto& xs) {
std::vector<argument> args;
std::transform(xs.begin(), xs.end(), std::back_inserter(args), [&](auto x) {
return from_gpu(x);
});
result = argument{args};
});
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment