forked from M-Labs/artiq
artiq_compile: actually disable attribute writeback.
I wrote both halves of this condition but forgot to hook them together. Fixes #586.
This commit is contained in:
parent
67e743d74a
commit
0e76cbc414
|
@ -40,7 +40,8 @@ class Source:
|
||||||
return cls(source.Buffer(f.read(), filename, 1), engine=engine)
|
return cls(source.Buffer(f.read(), filename, 1), engine=engine)
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
def __init__(self, src, ref_period=1e-6):
|
def __init__(self, src, ref_period=1e-6, attribute_writeback=True):
|
||||||
|
self.attribute_writeback = attribute_writeback
|
||||||
self.engine = src.engine
|
self.engine = src.engine
|
||||||
self.embedding_map = src.embedding_map
|
self.embedding_map = src.embedding_map
|
||||||
self.name = src.name
|
self.name = src.name
|
||||||
|
@ -79,7 +80,8 @@ class Module:
|
||||||
llvm_ir_generator = transforms.LLVMIRGenerator(
|
llvm_ir_generator = transforms.LLVMIRGenerator(
|
||||||
engine=self.engine, module_name=self.name, target=target,
|
engine=self.engine, module_name=self.name, target=target,
|
||||||
embedding_map=self.embedding_map)
|
embedding_map=self.embedding_map)
|
||||||
return llvm_ir_generator.process(self.artiq_ir, attribute_writeback=True)
|
return llvm_ir_generator.process(self.artiq_ir,
|
||||||
|
attribute_writeback=self.attribute_writeback)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
printer = types.TypePrinter()
|
printer = types.TypePrinter()
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Core:
|
||||||
self.core = self
|
self.core = self
|
||||||
self.comm.core = self
|
self.comm.core = self
|
||||||
|
|
||||||
def compile(self, function, args, kwargs, set_result=None, with_attr_writeback=True):
|
def compile(self, function, args, kwargs, set_result=None, attribute_writeback=True):
|
||||||
try:
|
try:
|
||||||
engine = _DiagnosticEngine(all_errors_are_fatal=True)
|
engine = _DiagnosticEngine(all_errors_are_fatal=True)
|
||||||
|
|
||||||
|
@ -89,7 +89,9 @@ class Core:
|
||||||
stitcher.stitch_call(function, args, kwargs, set_result)
|
stitcher.stitch_call(function, args, kwargs, set_result)
|
||||||
stitcher.finalize()
|
stitcher.finalize()
|
||||||
|
|
||||||
module = Module(stitcher, ref_period=self.ref_period)
|
module = Module(stitcher,
|
||||||
|
ref_period=self.ref_period,
|
||||||
|
attribute_writeback=attribute_writeback)
|
||||||
target = OR1KTarget()
|
target = OR1KTarget()
|
||||||
|
|
||||||
library = target.compile_and_link([module])
|
library = target.compile_and_link([module])
|
||||||
|
|
|
@ -55,7 +55,7 @@ def main():
|
||||||
|
|
||||||
object_map, kernel_library, _, _ = \
|
object_map, kernel_library, _, _ = \
|
||||||
core.compile(exp.run, [exp_inst], {},
|
core.compile(exp.run, [exp_inst], {},
|
||||||
with_attr_writeback=False)
|
attribute_writeback=False)
|
||||||
except CompileError as error:
|
except CompileError as error:
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue