-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unresolved numeric contexts that should be resolvable #678
Comments
Is the
Anyway, BSC has determined that My guess is that BSC could be doing a better job of showing you the trace of the instances that it went through, to get to that point, and that could help identify what I would guess that FYI, I did find some code that surprised me. It may not the be the cause of your problem, because fixing it doesn't fix the problem. But I notice that you have some classes defined like this:
Here, the proviso has variables
I was able to workaround that using |
I notice that in the instance for |
The trace seems to suggest that BSC ends up with this:
and it deduces that And I think that earlier they were this (but
And specifically,
I also see that earlier BSC encounters this:
which suggests that it has figured out that
And best I can tell
But I don't know why it wouldn't be able to conclude that |
Ah, nevermind. It does look like a bug in BSC. BSC can be made to compile the example by changing line 427 in
to this:
This is in a case-arm where BSC's proviso satisfier has determined that a proviso can be resolved, but it introduces new provisos that need to be resolved, as well as a substitution of what was learned in the process. What was happening was that the needed provisos had types that could be substituted with more concrete information. Specifically, I noticed that I don't know if this is necessarily the best change, though. Maybe the place that produced the needed provisos should have applied the substitution first? (I assume that it's not the responsibility of a later place to apply the substitution; because we want to avoid unnecessary re-application of the substititon, I suspect.) It may be that the substitution needs to be applied to the bindings -- and that the variables only show up in the later provisos because we've left them in the bindings. Or maybe we need both? Anyway, I discovered the issue by looking in the trace from |
I observe that applying the substitution to the bindings (even to the existing ones) doesn't help BSC get past the error. So applying to the needed provisos may be the right thing. |
Thank you for taking time to look into this! Yes, the above change you mentioned in TCMisc does seem to solve the error for now. |
The background for this is that my
GenCRepr
library uses a variable-width, byte-packed serialization format. The current implementation generates very inefficient hardware for sequences of variable-width items, such as likeVector 100 (Maybe Bool)
- the number of cases ends up being exponential in the size of the vector. I have been trying to make this more efficient by instead tracking the running size of the message and generating multiplexers to read/write the appropriate offset in the message being packed/unpacked. The code for this is currently at https://github.com/krame505/bsc-contrib/tree/genc-encode-vector.However, I have been seeing some errors about unresolved contexts that I don't understand:
Both of these contexts seemingly should be trivially satisfied? This is either a bug in context reduction, or else a symptom of another error in my code that isn't being reported properly. I added the file that caused this error at https://github.com/krame505/bsc-contrib/blob/genc-encode-vector/Libraries/GenC/Test.bs.
The text was updated successfully, but these errors were encountered: