-
Notifications
You must be signed in to change notification settings - Fork 12.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
ARM: Clang 17.x crash in libdeflate #65152
Comments
@llvm/issue-subscribers-backend-arm |
Thanks for the report. There is reproducer of what I think it is doing here:
It seems to define __ARM_FEATURE_CRC in order to get the function definitions from arm_acle.h, and then specifies a target override on the function calling __crc32b. It needs to be marked with "armv8-a,crc" in order to select crc32b as the backend pattern specifies HasV8
This used to inline, but after the changes in d6f994a the __crc32b function is no longer inlined into test. The __crc32b only has v7a+crc, so can't select crc which requires v8a+crc. I'm not sure I agree that disabling the inlining for these force_inline functions was a good idea. The real root cause is that target attributes are not well supported on Arm, so the code needs to start hacking around it in unsupported ways like defining __ARM_FEATURE_CRC32. The backend patterns needn't really be predicated on HasV8, which would allow the code to compile, but would leave a lot of extra functions that are not inlined, decreasing performance more than need be. |
@davemgreen thanks for looking into it. I agree with your suggestion to fix the compilation process for file in question, however I also think that compiler should not crash, that in itself is a bug regardless. Do you see it same way ? |
@kazutakahirata I think d6f994a has broken this usecase. You might be able to argue that by overriding __ARM_FEATURE_CRC32 the code is doing something that is unsupported. There still needs to be some way to handle what it is trying to do though. There is a disconnect between what the frontend checks for crc intrinsics (CRC is available), and what the backend checks (both crc and v8a). The backend needn't be checking both I think. We can allow v7a+crc as a usability improvement. See #65591 That would leave function that are no longer inlined though, which would have a pretty large impact on performance for intrinsics that are designed to always be inlined. The code in libdeflate may be best changed to |
IIUC, the caller If so, could we implement
I'm happy to come up with a patch if you are OK with this direction. Of course, I am open to other routes. |
That sounds like it would help, but I feel it is quite complex for Arm to come up with a set of rules that would fix all cases. For example a v8a function should in general not be inlined into a v7a callee, unless it is marked always_inline in which case it should be. All the functions in arm_acle.h and arm_neon.h were written in the expectation that they would really always be inlined and optimized away. I feel like the logic in the inliner should reflect that and always inline with a always_inline attribute. There is a fix for the crc part in 65591. |
This reverts commit d6f994a. Several people have reported breakage resulting from this patch: - llvm#65152 - llvm#65205
This reverts commit d6f994a. Several people have reported breakage resulting from this patch: - llvm/llvm-project#65152 - llvm/llvm-project#65205 (cherry picked from commit b4301df61fc77a9d54ac236bc88742a731285f1c)
This reverts commit d6f994a. Several people have reported breakage resulting from this patch: - llvm/llvm-project#65152 - llvm/llvm-project#65205 (cherry picked from commit b4301df61fc77a9d54ac236bc88742a731285f1c)
Attach test case is a new crash seen with Clang 17.x branch as compared to 16.x where it works ok.
it says
| fatal error: error in backend: Cannot select: intrinsic %llvm.arm.crc32b
and detailed crash log below.
test.zip
The text was updated successfully, but these errors were encountered: