HigherOrderCO/Bend

Enable net size check when running with `run-cu`

Opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
We disabled the check_net_size compilation pass so that it wouldn't trigger when running things with the C runtime. But now, if a net ends up being too large for hvm-cu, it'll fail at runtime.

Describe the solution you'd like
We should enable check_net_size when the CLI command is run-cu.

We should also enable it when the command is run-c but with a different max net size (atm: 64 for hvm-cu, 4095 for hvm-c).
This max net size should probably be a cli option as well, but that's not necessary for now.

"We disabled the check_net_size

What i am assuming that you made check_net_size default to false. ? it that correct. And for enabling it should be true?

image

Yes, that's correct.
The actual maximum value depends on the runtime you're targetting, so we disabled it to avoid false positives.

@developedby
When enabling it and setting 4095 for run-c 2 tests are failing, one of which is net_size_too_large.bend - with the diagnostics message, I think the failing is the green condition here, since it should fail on large net size case.

?

@developedby When enabling it and setting 4095 for run-c 2 tests are failing, one of which is net_size_too_large.bend - with the diagnostics message, I think the failing is the green condition here, since it should fail on large net size case.

?

Yeah, this test checks that the error is properly thrown by the compiler. Probably the function it creates is not large enough to cause an error in the C runtime, so we'd need to change it to something larger.

A way to create a very large function that can't be broken up is

def too_large(x):
  return x(
    x, x, x, x, x, x, x, x, x, x,
    x, x, x, x, x, x, x, x, x, x,
    x, x, x, x, x, x, x, x, x, x,
    x, x, x, x, x, x, x, x, x, x,
    # ... as large as you want it to be
    x, x, x, x, x, x, x, x, x, x)