-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: Fix aggregate result error while use gcc11 compile with O2 optim… #12176
fix: Fix aggregate result error while use gcc11 compile with O2 optim… #12176
Conversation
✅ Deploy Preview for meta-velox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
for simplify the test code and test data file, i use only a subset data from #11257 test data, and the data can repeat the problem and verify the fix |
774e4f4
to
b095f86
Compare
@majetideepak can you help review this change? |
@lifulong Can you fix the code format issue ? |
ok , i have fix the code format issue, can you help trigger the check again? |
b095f86
to
60488d7
Compare
@pedroerp has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Fixes: #11257
I found the wrong result with gcc11 is originated by gcc inline optimize rule by test, use gcc -O1 compile result is ok, use gcc -O2 -fno-inline result is ok, but gcc -O2 result is wrong
three ways can fix this problem in my test:
__attribute__((noinline))
before functionaddValues
in source file velox/vector/LazyVector.h at line 121, disable inlineaddValues
functionasm volatile("" ::: "memory");
before callhook.addValues
at line 267 in source file velox/dwio/common/DecoderUtil.h, disable instruction reordering herevalues
to a tmp array before callhook.addValues
at line 267 in source file velox/dwio/common/DecoderUtil.h, same as logic at line 327 in source file velox/dwio/common/DecoderUtil.has it show above, there is same logic as fix way 3 at line 327 in source file velox/dwio/common/DecoderUtil.h, so i choose this resolution also, and i have add unit test recording to this problem, make sure the problem fixed.
i think this error may cause by gcc inline and instruction reordering, use error variable values while program exec ? for example we update variable a and use it, after inline and code reorder, variable a update after use, i am not sure here, i have read one article introduce same kind problem cause by gcc inline and code reorder lead to register value mis use.