microsoft / microsoft/onnxruntime
[Build] QNN EP build : implicit conversion loses integer precision
@adrianlizarraga is already working on this.
Since Oct 5, 2023.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the issue
When building with use_qnn (clang, targeting Android), several files in the QNN Execution Provider sources use size_t and unit64_t interchangeably. Clang disagrees with that.
base_op_builder.cc - this one is a simple fix, just change line 212 to use auto
simple_op_builder.cc
qnn_backend_manager.cc
- In these files, unt64_t is returned from some functions, but passed as size_t to other methods
```
simple_op_builder.cc:175:68: error: implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'size_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
ParQuantizeLinearStd(&tensor_data.alpha, unpacked_data.data(), num_of_elements, scale, zero_point, thread_pool);
qnn_backend_manager.cc:361:87: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
std::unique_ptr context_buffer = std::make_unique(required_buffer_size);
qnn_backend_manager.cc:413:66: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'std::streamsize' (aka 'int') [-Werror,-Wshorten-64-to-32]
of_stream.write(reinterpret_cast(context_buffer.get()), written_buffer_size);
qnn_backend_manager.cc:440:79: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
std::unique_ptr buffer = std::make_unique(buffer_size);
qnn_backend_manager.cc:444:84: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'std::streamsize' (aka 'int') [-Werror,-Wshorten-64-to-32]
const auto& read_result = cache_file.read(reinterpret_cast(buffer.get()), buffer_size);
### Urgency
_No response_
### Target platform
Android
### Build script
python3 tools/ci_build/build.py \
--cmake_extra_defines "CMAKE_VERBOSE_MAKEFILE=ON" \
--cmake_extra_defines "CMAKE_C_FLAGS=$extra_cflags" \
--cmake_extra_defines "CMAKE_CXX_FLAGS=$extra_cflags" \
--build_dir "$build_dir" \
--config $build_type \
--build_shared_lib \
--parallel \
--android \
--android_abi $build_target \
--android_api $VERSION \
--android_sdk_path "$(get_android_home)" \
--android_ndk_path "[...]" \
--android_cpp_shared \
--use_cache \
--use_xnnpack \
--use_nnapi \
--use_qnn \
--qnn_home="[...]" \
--skip_tests \
--path_to_protoc_exe "$PROTOC" \
### Error / output
(See above)
### Visual Studio Version
_No response_
### GCC / Compiler Version
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.