-
Notifications
You must be signed in to change notification settings - Fork 375
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
xnn_table_exp2minus_k_over_16 has inconsistent types #6806
Comments
Thanks for the report // Copyright 2019 Google LLC #include <xnnpack/common.h> // Table of exp2(k / 64) values, k = 0..63 |
I found int and int32_t variations of this, and fixed those. Now its just the float extern that is sometimes used. grep extern.*xnn_table_exp2minus_k_over_ . -r -h | sort | uniq |
@fbarchard did you ever commit those changes? I don't see e.g. any links to commits that fixed it. I tried to test a recent snapshot. The previous one where I saw the inconsistent types was from 2024.02.29. Trying the latest version I actually cannot even get far enough to hit errors with LTO, as I get tons of e.g.
Attached is a full log of the entire failure: build.log |
pytorch/pytorch#137866 for has some runs with full stack traces and repros if you need some more reproducers. Here is the PyTorch HUD: https://hud.pytorch.org/pr/pytorch/pytorch/137866#31470457008 |
@eli-schwartz Those errors still exist on master so they were not committed. |
@fbarchard Posted full build logs and happy to try master when they are fixed, I posted the full error logs in my above comment. Simple search suggests the problem still appears on master. |
@fbarchard Found the PRs you made ie: #6832, unfortunately converting them to uint32 is still causing issues with LTO with GCC even if they are the same width. |
The type of xnn_table_exp2minus_k_over_16 varies between declarations.
It's defined as
uint32_t[64]
here but other declarations have various different types.For example, here it's declared as
float[64]
.This is illegal in C as uint32_t and float are not compatible types (just being the same size isn't sufficient to be compatible) so strictly speaking this is undefined behaviour. I hit an error with this while compiling with LTO, so the work-around is probably "don't do that", but it is still incorrect even if it happens to work.
One possible solution is to declare the array as float[64], and use hexadecimal float literals, e.g. 0x1p+0 instead of 0x3F800000, 0x1.fec9a4p-1 instead of 0x3F7F64D2, etc., which should still be bit-for-bit identical.
The text was updated successfully, but these errors were encountered: