Skip to content

jit: use the native process target - #6415

Merged
sueszli merged 3 commits into
xdslproject:mainfrom
sueszli:review/jit-native-target
Sep 5, 2026
Merged

sueszli merged 3 commits into
xdslproject:mainfrom
sueszli:review/jit-native-target

Conversation

@sueszli

@sueszli sueszli commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Uses the process triple and native data layout for MCJIT, following feedback on PR #6410, comment #3889958560 --- stacked on #6414.

Closes the stacked #6410, whose remaining work it carries, and fixes #6426.

@sueszli sueszli added the JIT Just-In-Time compilation. label Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.94%. Comparing base (97d0b5a) to head (b9c2aa7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6415      +/-   ##
==========================================
- Coverage   86.95%   86.94%   -0.01%     
==========================================
  Files         439      439              
  Lines       66016    65970      -46     
  Branches     7514     7514              
==========================================
- Hits        57404    57360      -44     
+ Misses       7039     7038       -1     
+ Partials     1573     1572       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sueszli sueszli self-assigned this Sep 2, 2026
Comment thread xdsl/jit/llvm/backend.py Outdated
sueszli added a commit that referenced this pull request Sep 5, 2026
Adds opt-in host O3 optimization after separating the refactoring
requested on [PR #6410, comment
#3889970708](#6410 (comment))
--- stacked on #6415.
Reject modules whose data layout is not the native one, and give the entry
point external linkage so that global DCE in the optimization pipeline cannot
drop it. Annotate the llvmlite stubs both need.
LLVM writes one target several ways, such as arm64 for aarch64 and macosx for
darwin, and the order of the specs in a data layout carries no meaning, so
comparing either as a string rejects a module that names the native target.

Closes xdslproject#6426
@sueszli
sueszli force-pushed the review/jit-native-target branch from 7bc7473 to 789044c Compare September 5, 2026 13:37
@sueszli
sueszli changed the base branch from sueszli/jit-refactor-base to main September 5, 2026 13:37
@sueszli

sueszli commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Okidokes - I'm happy with this PR now and would really appreciate a second pair of eyes to look at the diff :)

Comment thread tests/jit/llvm/test_backend.py Outdated
Comment on lines +19 to +22
_compile_module, # pyright: ignore[reportPrivateUsage]
_create_target_machine, # pyright: ignore[reportPrivateUsage]
_is_native_data_layout, # pyright: ignore[reportPrivateUsage]
_is_native_triple, # pyright: ignore[reportPrivateUsage]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend against this, we should be testing user-facing observable behaviour. If these are observable to the user then they should be public, otherwise let's test the APIs and results/errors for those. (To me it feels like_is_native_data_layout and _is_native_triple should be public, not sure about the other ones).

@sueszli sueszli Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - I also thought harder about this and lots of pieces were actually even unreachable because we were assigning them ourselves a couple steps further up the call chain, before verifying

The data layout check, the missing function check, and the external linkage of
the entry point all guard a state that `jit` cannot produce. It overwrites the
data layout with the native one, rejects a symbol that is not an `llvm.func`
before the module is compiled, and the LLVM converter drops the linkage of a
function anyway. Testing them meant importing private helpers, which is what
kept the three from looking dead.

Test the target triple through the public API instead, and make the predicate
that survives it public.
@sueszli

sueszli commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Thank you

@sueszli
sueszli merged commit fd605c2 into xdslproject:main Sep 5, 2026
25 checks passed
@superlopuh

Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JIT Just-In-Time compilation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jit: only one spelling of the native target triple is accepted

2 participants