Skip to content

Changes to fix data types mismatches for armv7 build #395

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cache_entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ CacheEntry::SerializeResponse(InferenceResponse* response, Buffer& buffer)
position += sizeof(uint32_t);

for (const auto& output : response->Outputs()) {
uint64_t packed_output_byte_size = 0;
size_t packed_output_byte_size = 0;
RETURN_IF_ERROR(SerializeResponseOutput(
output, base + position, &packed_output_byte_size));
// 2. Then the packed buffer will hold pairs of (output_size, output_bytes)
Expand Down Expand Up @@ -255,7 +255,7 @@ CacheEntry::SerializeResponseOutput(
// Pack everything into provided buffer
uint64_t position = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why this line doesn't cause issues

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oandreeva-nv you have a good point. I'll elaborate a bit more on this one. The real issue is with the following lines. SerializeResponseOutput is expecting a size_t pointer:
CacheEntry::SerializeResponseOutput( const InferenceResponse::Output& output, Byte* buffer, size_t* output_size)

For our platform there is a mismatch between these two types:
error: cannot convert ‘uint64_t*’ {aka ‘long long unsigned int*’} to ‘size_t*’ {aka ‘unsigned int*’}

// Total serialized output size
memcpy(buffer + position, &total_byte_size, sizeof(uint64_t));
memcpy(buffer + position, &total_byte_size, sizeof(size_t));
position += sizeof(uint64_t);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


// Name
Expand Down Expand Up @@ -327,7 +327,7 @@ CacheEntry::DeserializeBuffer(InferenceResponse* response, const Buffer& buffer)

for (size_t i = 0; i < num_outputs; i++) {
// Get size of packed output
uint64_t packed_output_size = 0;
size_t packed_output_size = 0;
std::memcpy(
&packed_output_size, base + position, sizeof(packed_output_size));
position += sizeof(packed_output_size);
Expand Down