Commit 3265b9f0 authored by umangyadav's avatar umangyadav
Browse files

add test

parent b92d27b0
...@@ -74,7 +74,8 @@ void migraphx_from_value(const value& v, literal& l) ...@@ -74,7 +74,8 @@ void migraphx_from_value(const value& v, literal& l)
} }
else else
{ {
assert(v.is_array()); auto v_data = v.at("data");
assert(v_data.is_array());
size_t array_size = 1 + ((binary_size - 1) / partition_length); size_t array_size = 1 + ((binary_size - 1) / partition_length);
assert(array_size == v.size()); assert(array_size == v.size());
std::vector<uint8_t> binary_array(binary_size); std::vector<uint8_t> binary_array(binary_size);
...@@ -82,9 +83,10 @@ void migraphx_from_value(const value& v, literal& l) ...@@ -82,9 +83,10 @@ void migraphx_from_value(const value& v, literal& l)
for(size_t i = 0; i < array_size; ++i) for(size_t i = 0; i < array_size; ++i)
{ {
binary_array.insert(binary_array.end(), binary_array.insert(binary_array.end(),
v.at(i).get_binary().data(), v_data.at(i).get_binary().data(),
v.at(i).get_binary().data() + v.at(i).get_binary().size()); v_data.at(i).get_binary().data() +
read_size += v.at(i).get_binary().size(); v_data.at(i).get_binary().size());
read_size += v_data.at(i).get_binary().size();
} }
assert(read_size == binary_size); assert(read_size == binary_size);
l = literal(s, binary_array.data()); l = literal(s, binary_array.data());
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/register_target.hpp> #include <migraphx/register_target.hpp>
#include <migraphx/load_save.hpp> #include <migraphx/load_save.hpp>
#include <migraphx/generate.hpp>
#include "test.hpp" #include "test.hpp"
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
...@@ -88,6 +89,16 @@ TEST_CASE(compiled) ...@@ -88,6 +89,16 @@ TEST_CASE(compiled)
EXPECT(p1.sort() == p2.sort()); EXPECT(p1.sort() == p2.sort());
} }
TEST_CASE(large_literal)
{
migraphx::program p1;
auto* mm = p1.get_main_module();
mm->add_literal(migraphx::generate_literal({migraphx::shape::half_type, {39664984, 64}}));
std::vector<char> buffer = migraphx::save_buffer(p1);
migraphx::program p2 = migraphx::load_buffer(buffer);
EXPECT(p1.sort() == p2.sort());
}
TEST_CASE(unknown_format) TEST_CASE(unknown_format)
{ {
migraphx::file_options options; migraphx::file_options options;
......
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