are there any ways to improve cranelift output? i know there is the speed/size opt setting but even going for best perf the code isn't fantastic. are there maybe like some addon modules which can do better optimizations or something?
Are you using the new x64 backend or the old x86 backend? When using wasmtime you can enable the former using the "experimental_x64" crate feature. The new x64 backend can result in better output.
@snek I have a module to do constant propagation but I can't really upstream it until the IR structs in cranelift-codegen get moved somewhere else (otherwise there is a circular dependency). I can share that module if you're interested, though.
bjorn3 said:
Are you using the new x64 backend or the old x86 backend? When using wasmtime you can enable the former using the "experimental_x64" crate feature. The new x64 backend can result in better output.
not using wasmtime, just cranelift directly (not doing wasm stuff either)
Andrew Brown said:
snek I have a module to do constant propagation but I can't really upstream it until the IR structs in cranelift-codegen get moved somewhere else (otherwise there is a circular dependency). I can share that module if you're interested, though.
sounds cool, is it on gh?
snek said:
not using wasmtime, just cranelift directly (not doing wasm stuff either)
It's an option in Cranelift actually, though when using cranelift-codegen
directly, you need to build with the x64
feature (x86
is the old backend) and then choose BackendVariant::MachInst
when instantiating the backend. @bjorn3's point stands: the new backend will generally produce better code, so it's worth experimenting with if you're not already! We're hoping to make it the default soon, once a few more features are finished.
so i need to stop using the cranelift
package, spilt that into cranelift-frontend
and cranelift-codegen
with x64 feature?
Oh, no, you can do all this via cranelift
too
In that case build with experimental_x64
there is no x64 or experimental_x64 feature for the cranelift crate
Urgh, I was looking at cranelift-tools
actually, sorry about that
Yes, to access the new backend you'll need to depend on the -codegen crate directly
Last updated: Nov 22 2024 at 16:03 UTC