futhark icon indicating copy to clipboard operation
futhark copied to clipboard

Add `auto out` test support for opaque types

Open FluxusMagna opened this issue 2 years ago • 3 comments

This would be helpful to ensure programs with opaque outputs don't regress.

One way to avoid the issue of changes in data format between compiler versions could be to have an output script, similar to the script input currently available, which would take the output and convert it to a type that can be stored in a stable format (a tuple of scalars and arrays).

It would also be good to extend support for scripted inputs to this, so that any entry point can tested against prior versions and for different backends.

FluxusMagna avatar Oct 12 '22 11:10 FluxusMagna

script output would be equivalent to wrapping the entry point a function that does the rewriting. That is already possible.

This would be a useful feature, but I don't think ensuring (or checking for) stability across compiler versions is important. Two reasons:

  1. Realistically, the format doesn't change that often. Off the top of my head, I'm not sure it has ever changed. The only change I can imagine is that we may improve deduplication for sum types.
  2. The format is stable across different compiler backends, which is more often useful.

athas avatar Oct 12 '22 11:10 athas

The issue with wrapping in the program is code duplication, which increases compile times. adding a test would essentially double the compile time for a function (assuming the wrapper is small).

If you think the built in serialization is stable enough, I'm all for it.

edit: Now that I think about it, didn't you add some kind of deduplication step, or at least somehow reduce the amount of generated code a while back?

FluxusMagna avatar Oct 12 '22 11:10 FluxusMagna

You can use #[noinline] inside the wrapper. (And in the future, we'll inline less aggressively.)

athas avatar Oct 12 '22 12:10 athas