-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
jitlayers: Use GlobalISel on AArch64 at -O0/-O1 #60339
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
base: master
Are you sure you want to change the base?
Conversation
FastISel was disabled on AArch64 in 2015 (PR JuliaLang#13393) to fix issue JuliaLang#13321, but that issue was specifically about 32-bit ARM (ARMv7) segfaults during bootstrap. The AArch64 exclusion was added conservatively alongside the ARM fix. AArch64 FastISel has been actively maintained upstream with recent bug fixes: - llvm/llvm-project#75993 (Jan 2024) - llvm/llvm-project#133987 (May 2025) This enables faster instruction selection for JIT compilation on AArch64 at lower optimization levels, reducing compilation latency.
GlobalISel is LLVM's modern instruction selector that is designed to replace both FastISel and SelectionDAG. On AArch64, it is mature and enabled by default at -O0 in upstream LLVM. This enables GlobalISel with fallback mode on AArch64, which provides faster instruction selection than SelectionDAG while maintaining correctness by falling back to SelectionDAG for unsupported patterns. Note: This requires RemoveJuliaAddrspacesPass to run before codegen, which is already the case in the current pipeline (see pipeline.cpp comment about GlobalISel not liking Julia's address spaces). Co-Authored-By: Claude <[email protected]>
d89fedf to
dc0539b
Compare
|
I'm more comfortable with this than fastisel |
|
Does this need a pkgeval? |
|
Yeah a pkgeval on aarch64 would be good. @maleadt is that still possible? |
|
I believe this was enabled at one point for ahead-of-time compilation but disabled because of miscompiles? I should probably report/fix the easy ones upstream... The atomic Float16 miscompile still happens on this version: Compare with IIRC you can get this to trigger during bootstrapping with -O1. |
|
yeah. we should definitely be reporting any bugs in global isel we're finding. IIUC Global Isel is intended to be the isel future (completely replacing SelectionDAG) so we want it to be as solid as possible. |
Not easily, no; it's a very manual process. |
|
should we also use it at O2/O3? iiuc, for aarch64 it's generally expected to produce equally good code |
|
@xal-0 I added a test based on your example. It fails locally. |
36855b7 to
e49df8d
Compare
|
You can probably ask Claude to turn this into an llc test case for an LLVM issue. |
On-top of/alternative to #60338
Just exploring whether this works, given below:
GlobalISel is LLVM's modern instruction selector that is designed to replace
both FastISel and SelectionDAG. On AArch64, it is mature and enabled by default
at -O0 in upstream LLVM.
This enables GlobalISel with fallback mode on AArch64, which provides faster
instruction selection than SelectionDAG while maintaining correctness by
falling back to SelectionDAG for unsupported patterns.
Note: This requires RemoveJuliaAddrspacesPass to run before codegen, which is
already the case in the current pipeline (see pipeline.cpp comment about
GlobalISel not liking Julia's address spaces).
Co-authored-by: Claude