mirror of https://github.com/m-labs/artiq.git
transforms.interleaver: add a diagnostic for interleave inlining failure.
This commit is contained in:
parent
8527e306c3
commit
fec5c2ebf0
|
@ -3,6 +3,8 @@
|
|||
the timestamp would always monotonically nondecrease.
|
||||
"""
|
||||
|
||||
from pythonparser import diagnostic
|
||||
|
||||
from .. import types, builtins, ir, iodelay
|
||||
from ..analyses import domination
|
||||
from ..algorithms import inline
|
||||
|
@ -127,6 +129,14 @@ class Interleaver:
|
|||
else: # It's a call.
|
||||
need_to_inline = len(source_blocks) > 1
|
||||
if need_to_inline:
|
||||
if old_decomp.static_target_function is None:
|
||||
diag = diagnostic.Diagnostic("fatal",
|
||||
"it is not possible to interleave this function call within "
|
||||
"a 'with parallel:' statement because the compiler could not "
|
||||
"prove that the same function would always be called", {},
|
||||
old_decomp.loc)
|
||||
self.engine.process(diag)
|
||||
|
||||
inline(old_decomp)
|
||||
postdom_tree = domination.PostDominatorTree(func)
|
||||
continue
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.signature +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
def f():
|
||||
delay_mu(2)
|
||||
|
||||
def g():
|
||||
delay_mu(2)
|
||||
|
||||
x = f if True else g
|
||||
|
||||
def h():
|
||||
with parallel:
|
||||
f()
|
||||
# CHECK-L: ${LINE:+1}: fatal: it is not possible to interleave this function call within a 'with parallel:' statement because the compiler could not prove that the same function would always be called
|
||||
x()
|
Loading…
Reference in New Issue