MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / TEST_CASE

Function TEST_CASE

test/gpu/hip.cpp:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#include <migraphx/gpu/target.hpp>
29
30TEST_CASE(tuple_from_gpu)
31{
32 migraphx::shape s1{migraphx::shape::float_type, {2, 3}};
33 migraphx::shape s2{migraphx::shape::int32_type, {2, 4}};
34 std::vector<float> p1_data = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6};
35 std::vector<int> p2_data = {1, 2, 3, 4, 5, 6, 7, 8};
36 auto p1 = migraphx::argument{s1, p1_data.data()};
37 auto p2 = migraphx::argument{s2, p2_data.data()};
38 auto p1_gpu = migraphx::gpu::to_gpu(p1);
39 auto p2_gpu = migraphx::gpu::to_gpu(p2);
40 auto p_tuple = migraphx::gpu::from_gpu(migraphx::argument({p1_gpu, p2_gpu}));
41 std::vector<migraphx::argument> results = p_tuple.get_sub_objects();
42 std::vector<float> result1;
43 results[0].visit([&](auto output) { result1.assign(output.begin(), output.end()); });
44 std::vector<int> result2;
45 results[1].visit([&](auto output) { result2.assign(output.begin(), output.end()); });
46 EXPECT(result1 == p1_data);
47 EXPECT(result2 == p2_data);
48}
49
50TEST_CASE(tuple_to_gpu)
51{

Callers

nothing calls this directly

Calls 9

to_gpuFunction · 0.85
from_gpuFunction · 0.85
argumentClass · 0.50
dataMethod · 0.45
get_sub_objectsMethod · 0.45
visitMethod · 0.45
assignMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected