-
Notifications
You must be signed in to change notification settings - Fork 46
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
Implement boolean types support #24
Comments
Does it consider short circuit functionality? Thas isz for example in case of &&, the second should be skipped (i.e. if has side effects such as chamging variables, that should't ocurr) basic implementation is with nested ifs: |
Good question @suarezvictor These types of functions we have been writing in PipelineC are currently 1) (and potentially 2) in the below image So for now, in the style of function we have been writing so far, something like
Creates hardware that is
Meaning that the expressions are evaluated in parallel by parallel/duplicated hardware prior to the This is a result of PipelineC deriving a dataflow graph from the C code. A little bit from the docs: // Simple example of math pipeline
float main(float x1, float x2, float y1, float y2)
{
float x_sum;
x_sum = x1 + x2;
float y_sum;
y_sum = y1 + y2;
return x_sum + y_sum;
} The above example instantiates 3 floating point adders. Two in parallel, and a third for the return. Would love to answer any more questions you have :) |
I see you ask about side effects - a quick sentence if you are interested: |
To me, the best solution if && appears in code, is the following:
…-if second and subsequent operands doesn't have side effects, then it would
be equivalent to evaluate both or just one of them, the only difference is
to test the operand with "!=0" (all bits 0) instead of bitwise and (it
would be the same if data is of only a bit -- most common case)
-In case the second operand has side effects, then a warning can be
reported to user, and implement the correct logic in a less performant way.
The chance of having && with side effects statements are exceptionally
low...
I know adding all this logic is quite difficult, so maybe for the moment an
entry on documentation can say "short circuit logic isn't implemented yet,
don't use it with operands with side effects!". That would cover the
majority of the algorithms, anyways.
On Sat, Oct 2, 2021 at 1:05 PM Julian Kemmerer ***@***.***> wrote:
I see you ask about side effects - a quick sentence if you are interested:
These functions can maintain state (making them style #1
<#1> only). But
the state the maintain (even if in global namespace, declared as global
variable, etc). Is not a 'shared global memory' like on a cpu. There are
additional mechanisms to move data between functions like you would
normally do via a global/shared memory concept. So 'global stateful side
effects' are not really a thing.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBHVWP4AZU7CM5RRCZUGKDUE4UURANCNFSM5FFDBLUA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
&& 'logical and' should be defined as l!=0 & r!=0 - it is not
if(x) should evaluate if(x!=0) - it does not
x ? ternary operator has similar problems
The text was updated successfully, but these errors were encountered: