| 32 | #include <test.hpp> |
| 33 | |
| 34 | TEST_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 | |
| 52 | TEST_CASE(unpack_fp4) |
| 53 | { |
nothing calls this directly
no test coverage detected