google / XNNPACK

High-efficiency floating-point neural network inference operators for mobile, server, and Web
Other
1.89k stars 376 forks source link

LTO type mismatch on `xnn_table_exp2minus_k_over_*` kernels #7261

Open Skylion007 opened 1 month ago

Skylion007 commented 1 month ago

This is an issue at commit: 87ee0b46b834f67bad9025d4a82ed5654f3403d3

I tried enabling GCC LTO for PyTorch in this PR: https://github.com/pytorch/pytorch/pull/137866 and hit this warning that is treated as an error. Seems like a potentially straightforward fix upstream and would let XNNPack be properly LTO compiled by GCC without warning.

/var/lib/jenkins/workspace/third_party/XNNPACK/src/amalgam/gen/sse2.c:2482: error: type of ‘xnn_table_exp2minus_k_over_64’ does not match original declaration [-Werror=lto-type-mismatch]
 2482 | extern XNN_INTERNAL const float xnn_table_exp2minus_k_over_64[64];
      | 
/var/lib/jenkins/workspace/third_party/XNNPACK/src/tables/exp2minus-k-over-64.c:12: note: type ‘const uint32_t’ should match type ‘const float’
   12 | XNN_INTERNAL const uint32_t xnn_table_exp2minus_k_over_64[64] = {
      | 
/var/lib/jenkins/workspace/third_party/XNNPACK/src/tables/exp2minus-k-over-64.c:12: note: ‘xnn_table_exp2minus_k_over_64’ was previously declared here
/var/lib/jenkins/workspace/third_party/XNNPACK/src/amalgam/gen/sse2.c:1931: error: type of ‘xnn_table_exp2minus_k_over_16’ does not match original declaration [-Werror=lto-type-mismatch]
 1931 | extern XNN_INTERNAL const float xnn_table_exp2minus_k_over_16[16];
      | 
/var/lib/jenkins/workspace/third_party/XNNPACK/src/tables/exp2minus-k-over-16.c:12: note: type ‘const uint32_t’ should match type ‘const float’
   12 | XNN_INTERNAL const uint32_t xnn_table_exp2minus_k_over_16[16] = {
      | 
/var/lib/jenkins/workspace/third_party/XNNPACK/src/tables/exp2minus-k-over-16.c:12: note: ‘xnn_table_exp2minus_k_over_16’ was previously declared here
lto1: all warnings being treated as errors
Skylion007 commented 1 month ago

Actually seems like it's a duplicate of this issue which is still open: https://github.com/google/XNNPACK/issues/6806

alankelly commented 3 weeks ago

Could you please open a PR with a fix?