-
Notifications
You must be signed in to change notification settings - Fork 63
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
Surprising behavior involving a reactor that splits a multiport into individual ports #1321
Comments
The first example indeed looks like a bug in the C code generator. Have you tried this in the C++ target? The error message from the C++ runtime in the second example is not very informative, but it is saying that directly connecting inputs to outputs is not implemented (as I did not consider this a valid use at the point of writing the code). As it looks, we do support direct connections in LF, so we should update the C++ runtime. In the meantime, you can work around this by adding a reaction in the middle that dimply forwards all values from the inputs to the correct output port. |
I tried it in C++ just now and saw the same error as in the other example:
Incidentally, I was surprised that I needed to call
|
Oh, right this is the same problem as in the other example. In the C++ target, |
This pulls in lf-lang/reactor-cpp#29 and addresses the problem in the C++ target described in #1321. It also adds the two programs written by @petervdonovan as tests.
I fixed the problem in the C++ runtime in #1361. Now the first program works as expected in C++. |
Looks like this still has to be fixed for C? |
Yes, even after #1370 this issue seems to persist. |
I'm labeling this as a question because it's possible this stems from a misunderstanding on my part of the semantics of multiports. I had difficulty getting any programs similar to these to work.
IndexIntoMultiportOutput
This program compiles successfully and executes with the C target, but its behavior is inconsistent with my expectations. I expect it to print "1 = 1" and "2 = 2", but instead, it prints "1 = 0" and "2 = 1". This is because instead of connecting the
i
th reaction to thei
th multiport channel, it fills reactions into the multiport channels starting at channel 0. I find this kind of behavior strange and hard to reason about. The way messages are routed insideMultiportSplitter
should not be affected by how things are connected outside of it.This is the output:
This is the program:
IndexIntoMultiportInput
This program fails with the C++ target, I think during the assemble phase of execution, and I do not understand why.
This is the output of the program:
This is the program:
The text was updated successfully, but these errors were encountered: