dace
dace copied to clipboard
Some failed test
Hello,
I have noticed that dace like to fail when accessing local array and using maps. I don't know it is a bug or it should behave that way. Anyways here it is... DaCe_Bugger.zip There are some more hidden bugs with FPGA memory allocations. In the given case the "local" -"global" memory fails mapping because it generates code like this: "some_arr_out_out" when it should be named "some_arr_out". I hope this "bugger" will help you pinpoint some problems with code generation.
Take care!
Thank you for the bug report. Global memories are generated as separate _in
and _out
pointers, and sometimes the renaming is done too seldomly or too often, as you found ;-)
Also take a look at generated code Sometimes when specialize is used there are multiple const deniniftions in top of the .Cpp file and near the for loop!
Hi @bartokon,
could you please double-check if things improve with the latest DaCe master?
I could try tommorow :)
Hmm, I have reinstalled Dace master by git clone, git submodules, pip install -e but:
Hi @bartokon,
a temporary workaround would be to do not specialize the SDFG (line 105 in your script).
@tbennun any idea on how to fix this? Apparently the values returned by sdfg.constants
(invoked by LoopToMap) do not contains info about the data type (it is a dict[str, value]
)
@TizianoDeMatteis sdfg.constants
is a @property
that wraps around sdfg.constants_prop
. The latter is a dictionary mapping to a tuple of (dtype, val)
just like the one iterated over in the exception above.
Hello @bartokon, this should be fixed now in the latest master
Not yet :)
Impl: 2, test 1 passed! Applied 1 FPGATransformSDFG. Applied 0 Global-To-Local. Traceback (most recent call last): File "DaCe_Bugger.py", line 131, in <module> fun_compiled = fun_sdfg.compile() File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/sdfg/sdfg.py", line 1799, in compile program_objects = codegen.generate_code(sdfg, validate=validate) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/codegen.py", line 226, in generate_code (global_code, frame_code, used_targets, used_environments) = frame.generate_code(sdfg, None) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 749, in generate_code states_generated = self.generate_states(sdfg, global_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 378, in generate_states callsite_stream.write(cft.as_cpp(self.dispatcher.defined_vars, sdfg.symbols), sdfg) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/control_flow.py", line 205, in as_cpp expr += elem.as_cpp(defined_vars, symbols) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/control_flow.py", line 124, in as_cpp expr += self.dispatch_state(self.state) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 357, in dispatch_state self._dispatcher.dispatch_state(sdfg, state, global_stream, stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 347, in dispatch_state disp.generate_state(sdfg, state, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 978, in generate_state self._frame.generate_state(sdfg, state, function_stream, callsite_stream, generate_state_footer=False) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 326, in generate_state self._dispatcher.dispatch_subgraph(sdfg, state, sid, global_stream, callsite_stream, skip_entry_node=False) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 381, in dispatch_subgraph self.dispatch_scope(v.map.schedule, sdfg, scope_subgraph, state_id, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 425, in dispatch_scope self._map_dispatchers[map_schedule].generate_scope(sdfg, sub_dfg, state_id, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 1201, in generate_scope self.generate_kernel_scope(sdfg, dfg_scope, state_id, scope_entry.map, kernel_name, grid_dims, block_dims, File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 1573, in generate_kernel_scope self._dispatcher.dispatch_subgraph(sdfg, File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 386, in dispatch_subgraph self.dispatch_node(sdfg, dfg, state_id, v, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 413, in dispatch_node disp.generate_node(sdfg, dfg, state_id, node, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 1944, in generate_node gen(sdfg, dfg, state_id, node, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 1986, in _generate_NestedSDFG self._cpu_codegen._generate_NestedSDFG(sdfg, dfg, state_id, node, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 1537, in _generate_NestedSDFG global_code, local_code, used_targets, used_environments = self._frame.generate_code( File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 749, in generate_code states_generated = self.generate_states(sdfg, global_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 378, in generate_states callsite_stream.write(cft.as_cpp(self.dispatcher.defined_vars, sdfg.symbols), sdfg) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/control_flow.py", line 205, in as_cpp expr += elem.as_cpp(defined_vars, symbols) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/control_flow.py", line 124, in as_cpp expr += self.dispatch_state(self.state) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 357, in dispatch_state self._dispatcher.dispatch_state(sdfg, state, global_stream, stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 347, in dispatch_state disp.generate_state(sdfg, state, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 974, in generate_state self.generate_devicelevel_state(sdfg, state, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 1084, in generate_devicelevel_state self._frame.generate_state(sdfg, state, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/framecode.py", line 333, in generate_state self._dispatcher.dispatch_subgraph(sdfg, c, sid, global_stream, callsite_stream, skip_entry_node=False) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 386, in dispatch_subgraph self.dispatch_node(sdfg, dfg, state_id, v, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 413, in dispatch_node disp.generate_node(sdfg, dfg, state_id, node, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 145, in generate_node gen(sdfg, dfg, state_id, node, function_stream, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 1882, in _generate_AccessNode self.process_out_memlets( File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 907, in process_out_memlets dispatcher.dispatch_copy( File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 555, in dispatch_copy target.copy_memory(sdfg, dfg, state_id, src_node, dst_node, edge, function_stream, output_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 944, in copy_memory self._emit_copy(state_id, src_node, src_storage, dst_node, dst_storage, dst_schedule, memlet, sdfg, dfg, File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cuda.py", line 924, in _emit_copy self._cpu_codegen.copy_memory(sdfg, dfg, state_id, src_node, dst_node, edge, None, callsite_stream) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 472, in copy_memory self._emit_copy( File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpu.py", line 622, in _emit_copy cpp.memlet_copy_to_absolute_strides( File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpp.py", line 132, in memlet_copy_to_absolute_strides dst_expr = copy_expr(dispatcher, File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/targets/cpp.py", line 71, in copy_expr defined_types = dispatcher.defined_vars.get(data_name, is_global=is_global) File "/usr/local/lib/python3.8/dist-packages/dace-0.12-py3.8.egg/dace/codegen/dispatcher.py", line 84, in get raise KeyError("Variable {} has not been defined".format(name)) KeyError: 'Variable fpga_out_data has not been defined'
Hello @bartokon, this should be fixed now in the latest master
yours merge fixed some errors, but there are still more :+1: