flake: update llvmlite and llvm#2859
Conversation
|
This runs some experiments, but causes an issue in code using integer modulo (e.g. just The way the new passs manger pipeline is set up, __py_modsi3 does not get inlined, and remains in the final ELF as a defined weak symbol ( Either way, the underlying issue causing this to surface now appears to be that the draft PR disables inlining completely (except for --- a/artiq/compiler/targets.py
+++ b/artiq/compiler/targets.py
@@ -107,34 +107,18 @@ class Target:
return llmachine
def optimize(self, llmodule):
- llpassmgr = llvm.ModulePassManager()
-
- # Start by cleaning up after our codegen and exposing as much
- # information to LLVM as possible.
- llpassmgr.add_constant_merge_pass()
- llpassmgr.add_simplify_cfg_pass()
- llpassmgr.add_instruction_combine_pass()
- llpassmgr.add_sroa_pass()
- llpassmgr.add_dead_code_elimination_pass()
- llpassmgr.add_post_order_function_attributes_pass()
- llpassmgr.add_global_opt_pass()
-
- # Now, actually optimize the code.
- llpassmgr.add_always_inliner_pass()
- llpassmgr.add_ipsccp_pass()
- llpassmgr.add_instruction_combine_pass()
- llpassmgr.add_new_gvn_pass()
- llpassmgr.add_simplify_cfg_pass()
-
- # Clean up after optimizing.
- llpassmgr.add_dead_arg_elimination_pass()
- llpassmgr.add_global_dead_code_eliminate_pass()
-
- # Create PassBuilder with required arguments for new pass manager
llmachine = self.target_machine()
- pto = llvm.create_pipeline_tuning_options()
- pb = llvm.create_pass_builder(llmachine, pto)
+ pto = llvm.create_pipeline_tuning_options(size_level=1)
+
+ # This combination of levels gets mapped to the -Os PassManagerBuilder default in
+ # llvmlite 0.45. The mapping is slightly nonsensical in that -Oz (which is more
+ # aggressively optimizing for size at the expense of runtime) is accessed via
+ # speed_level=size_level=2.
+ pto.speed_level = 1
+
+ pb = llvm.create_pass_builder(llmachine, pto)
+ llpassmgr = pb.getModulePassManager()
llpassmgr.run(llmodule, pb)
def compile(self, module):If we want to optimise our pass pipeline, we should probably take the current |
|
(see numba/llvmlite#1306 for the size_level issue pointed out in the comment) |
dde13b6 to
94c1c4d
Compare
|
Kernels fail to run on the device with this error: @fsagbuya please use readelf and other llvm/binutils tools to debug this. |
|
Interesting; some people here are supposedly using recent ARTIQ with this patch (on Kasli v2, but that seems unlikely to be related). |
715c616 to
94c1c4d
Compare
7689f1c to
1e3f953
Compare
1e3f953 to
0717fb7
Compare
@sbourdeauducq builds now with this commit: 0717fb7 |
LLVM lld 17+ adds PT_RISCV_ATTRIBUTES program header, increasing ELF header size from 0x74 to 0x94 bytes and breaking runtime validation. Discard the section to restore expected header size. The section contains only metadata and PT_RISCV_ATTRIBUTES is now deprecated in RISC-V ELF psABI.
0717fb7 to
e148bdc
Compare
Nix has already dropped support for llvm_15 which will be reflected in the next flake update:
Also, there is now a recent release of llvmlite which supports llvm_20.
Tests:
nix build .#artiq -Lnix build .#hydraJobs.kc705-hitl -L