Skip to content

jitlayers: Use GlobalISel on AArch64 at -O0/-O1#61758

Merged
IanButterworth merged 1 commit into
JuliaLang:masterfrom
IanButterworth:ib/GlobalISel
May 11, 2026
Merged

jitlayers: Use GlobalISel on AArch64 at -O0/-O1#61758
IanButterworth merged 1 commit into
JuliaLang:masterfrom
IanButterworth:ib/GlobalISel

Conversation

@IanButterworth
Copy link
Copy Markdown
Member

#60339 was auto-closed when #59950 merged and can't be reopened.

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 <noreply@anthropic.com>
@IanButterworth IanButterworth requested a review from xal-0 May 9, 2026 11:07
@IanButterworth
Copy link
Copy Markdown
Member Author

@xal-0 I think this fix is in-line with the reported issue so I'll merge. Post merge review would still be appreciated. Thanks

@IanButterworth IanButterworth merged commit 5dee674 into JuliaLang:master May 11, 2026
9 checks passed
@IanButterworth IanButterworth deleted the ib/GlobalISel branch May 11, 2026 16:30
@topolarity topolarity requested a review from gbaraldi May 12, 2026 00:51
@gbaraldi
Copy link
Copy Markdown
Member

gbaraldi commented May 12, 2026

I just wanted to ask what does clang do and that we should mostly mirror it. If rust does this then I guess it's also fine

@IanButterworth
Copy link
Copy Markdown
Member Author

Claude:


Looking at LLVM's AArch64TargetMachine.cpp, the relevant knob is:

static cl::opt<int> EnableGlobalISelAtO(
    "aarch64-enable-global-isel-at-O", cl::Hidden,
    cl::desc("Enable GlobalISel at or below an opt level (-1 to disable)"),
    cl::init(0));

with the gate optLevel <= EnableGlobalISelAtO, so Clang enables GlobalISel on AArch64 only at -O0 by default (and falls back to SelectionDAG above that). This PR enables it at both -O0 and -O1, which is slightly more aggressive than Clang.

Given the fallback mode (GlobalISelAbortMode::Disable) and the Float16 atomic regression test added here, I think it's reasonable, but it would be conservative to narrow the gate to opt_level < 1 to exactly mirror Clang.

@IanButterworth
Copy link
Copy Markdown
Member Author

It would be great if we could run an aarch64 pkgeval before and after this change, but I understand that's quite manual and time consuming

@oscardssmith
Copy link
Copy Markdown
Member

I don't think we actually have a way to run aarch64 pkgeval.

@IanButterworth
Copy link
Copy Markdown
Member Author

We have done it once at least. @maleadt did it. Not sure where the results are

@IanButterworth
Copy link
Copy Markdown
Member Author

@IanButterworth
Copy link
Copy Markdown
Member Author

@maleadt
Copy link
Copy Markdown
Member

maleadt commented May 12, 2026

Yeah it's a pain. Also, the machine in question is used for Base CI now, so it's not available anymore for a full-system run (and running under qemu introduces plenty of issues with several packages).

hardikxk pushed a commit to hardikxk/julia that referenced this pull request May 18, 2026
JuliaLang#60339 was auto-closed when
JuliaLang#59950 merged and can't be
reopened.

Co-authored-by: Claude <noreply@anthropic.com>
mkitti pushed a commit to mkitti/julia that referenced this pull request May 22, 2026
JuliaLang#60339 was auto-closed when
JuliaLang#59950 merged and can't be
reopened.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants