coreblocks
coreblocks copied to clipboard
[RFC] Non blocking if
I create this issue, to allow for brainstorm how to implement non blocking if
in transactron. Lets take:
with Transaction().body(m):
with m.If(m, cond):
method(m)
In current implementation we always block method
if transaction is called regardless of cond
. We would like to not block method is cond
is false.
The easy implementation idea is to calculate runnable signal for each pair of (transaction, method) using:
runnable = enable.implies(ready)
Where enable
is signal pointing if transaction want to run method and ready
say us if method is ready.
Above idea works as long as:
-
cond
is independent from method output or - method from which it is a result is independent from scheduling result/input data
Lets say:
with Transaction().body(m):
cond=method1(m, in_data1)
with m.If(m, cond):
method2(m)
Now we can consider two cases:
- if
in_data1
influencecond
thencond
depends from scheduling result (as long as it is not single-caller method), so there is a combinational cycle, because scheduling result (socond
) influence scheduling ofmethod2
. - if
in_data1
is the same regardless of input there is no problem
To summarise. We have to decide how to handle if
-s which depends from methods whose output depends on input. Some propositions:
- disallow non blocking
if
-s in situations where condition depends from scheduler. This solution is somehow similar to old handling of readiness of methods. We allowedready
signal to depends on input data only if method wassingle-caller
- Maybe we can start scheduling from methods whose output influence scheduling? In other words do scheduling in steps. Does this introduce possibility of deadlocks? Can we reuse
schedule_before
for that?
All other propositions are welcome.