Stream: cranelift

Topic: regalloc2-tool


view this post on Zulip Amanieu (Jul 11 2023 at 13:37):

I'm currently hitting a bug in regalloc2, but don't have an easy way to share the regalloc input. What are your thoughts about having a regalloc2-tool which reads a textual representation of a Function and MachineEnv and run the register allocator and checker on it. A utility function would also be provided to serialize a Function and MachineEnv into this textual representation.

This would be useful both for debugging and for working on better optimizations in the register allocator.

view this post on Zulip Chris Fallin (Jul 11 2023 at 15:44):

Yes, that would be very useful indeed! Possibly if what we need is a way to snapshot bug-cases, we could get away with something simpler as well, e.g. a bincode format (regalloc.rs had this)

view this post on Zulip Chris Fallin (Jul 11 2023 at 15:45):

although a text format has nice long-term value: it would allow us to reify a fuzz corpus into a regression suite in-tree; currently the fuzzer is really good for testing but each person has to independently build up a corpus

view this post on Zulip Chris Fallin (Jul 11 2023 at 15:46):

(that's a problem that can also be solved by keeping a corpus repo I guess, but having the ability to read and write human-readable test cases and minimize by hand would be nice)

view this post on Zulip fitzgen (he/him) (Jul 11 2023 at 16:17):

I've found that, in practice, corpus repos become out of date almost immediately unless there is automation to keep them up to date

view this post on Zulip fitzgen (he/him) (Jul 11 2023 at 16:18):

also, they aren't incredibly useful for arbitrary-based fuzz targets, because if the Arbitrary types change, then the fuzz inputs tend not to test what they did before anymore

view this post on Zulip Amanieu (Jul 12 2023 at 12:52):

Here's the output of regalloc2-tool for the function that I'm currently debugging: https://gist.github.com/Amanieu/b1a338a5b2da38355f60b0f5fe5eb79c

GitHub Gist: instantly share code, notes, and snippets.

view this post on Zulip Amanieu (Jul 12 2023 at 12:52):

I ended up just using bincode for serialization instead of a text format for simplicity.


Last updated: Dec 23 2024 at 13:07 UTC