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

Function TEST_CASE

test/ref/pack_unpack_fp4.cpp:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32#include <test.hpp>
33
34TEST_CASE(pack_fp4)
35{
36 migraphx::program p;
37 auto* mm = p.get_main_module();
38 migraphx::shape s{migraphx::shape::float_type, {2, 2}};
39 auto l0 = mm->add_literal(migraphx::literal{s, {-2.f, 3.4f, 3.5f, 0.f}});
40 mm->add_instruction(migraphx::make_op("pack_fp4"), l0);
41 p.compile(migraphx::make_target("ref"));
42 auto result = p.eval({}).back();
43 result =
44 result.reshape(migraphx::shape(migraphx::shape::uint8_type, result.get_shape().lens()));
45 std::vector<uint8_t> results_vector(2);
46 result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
47 std::vector<uint8_t> gold{0x5C, 0x06};
48 EXPECT(results_vector.at(0) == gold.at(0));
49 EXPECT(results_vector.at(1) == gold.at(1));
50}
51
52TEST_CASE(unpack_fp4)
53{

Callers

nothing calls this directly

Calls 15

make_targetFunction · 0.85
get_main_moduleMethod · 0.80
backMethod · 0.80
reshapeMethod · 0.80
lensMethod · 0.80
atMethod · 0.80
make_opFunction · 0.50
shapeFunction · 0.50
float_equalFunction · 0.50
add_literalMethod · 0.45
add_instructionMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected