Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fix for test_msgpack_float and test_msgpack_object #2155
Added fix for test_msgpack_float and test_msgpack_object #2155
Changes from 3 commits
f557e67
3c400ba
ec541ae
bf42d61
959a01c
22a9ea0
f391728
9b5a580
cea31cc
d2fd5ac
8d1157c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we using an unordered map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created buffer is a map. After its creation there is check if buffer is equal with buffer initialized with map (here).
In value definition inside value.hpp I haven't seen constructor for map, I found just constructor for unordered map, so because of that I used conversion to vector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not using the
std::unordered_map
constructor, its using thestd::initializer_list
constructor which will preserve the order of the list.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw value constructor for std::initializer_list in value.cpp. In this case (where size is not 2 and elements have key) it is calling
set_vector
function, so I thinkto_vector()
function can be used for comparing if result values are equal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_vector
will only compare the values and not the keys. The==
operator for value will compare the keys as well:migraphx::from_msgpack(buffer) == v
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
migraphx::from_msgpack(buffer)
function is fixed, I won't have need to cast output tofloat
in the following way which i committed in this PR too (EXPECT(migraphx::from_msgpack(buffer).to<float>() == v.to<float>());
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do you see this happening?
from_msgpack
converts the float32 or float64 to double here: https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/blob/develop/src/msgpack.cpp#L85.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it in the debugger during comparing
EXPECT(migraphx::from_msgpack(buffer) == v);
. You can see debugger output in the following screenshot when debugging test_msgpack_float, herex
ismigraphx::from_msgpack(buffer)
output andy
ismigraphx::value v
which is double. If we castv
to beuint64_t
, the test passes.Also, if there is type conversion why do we need to cast function output to int here (which already exists in develop branch)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion since we do want to keep comparing the keys and the types are different for the values that we should either change operator== to have a specialization that can properly compare types, call the compare function directly if that will allow us to compare types or create a compare function that can compare the keys and compare with an explicit type conversion (passed as a template parameter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is something wrong with either msgpack serialization or the value construction as it should be
float_type
as well.