Skip to content
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

failed to run some FPGA samples #1383

Closed
remifan opened this issue Oct 6, 2023 · 2 comments
Closed

failed to run some FPGA samples #1383

remifan opened this issue Oct 6, 2023 · 2 comments

Comments

@remifan
Copy link

remifan commented Oct 6, 2023

Describe the bug
I can run dace/samples/fpga/rtl/fladd.py without issues but failed in running other rtl examples. Here is the error log:

python dace/samples/fpga/rtl/pipeline.py
                                                                      
Traceback (most recent call last):                                                                                             
  File "/home/<user>/Workspace/dace/pipeline.py", line 164, in <module>                                                          
    sdfg(A=a, B=b, N=N)                                                                                                        
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/sdfg/sdfg.py", line 2342, in __call__   
    binaryobj = sdfg.compile()                                                                                                 
                ^^^^^^^^^^^^^^                                                                                                 
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/sdfg/sdfg.py", line 2254, in compile    
    program_objects = codegen.generate_code(sdfg, validate=validate)                                                           
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                           
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/codegen.py", line 231, in genera
te_code                                                                                                                        
    (global_code, frame_code, used_targets, used_environments) = frame.generate_code(sdfg, None)                               
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                               
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/framecode.py", line 831,
 in generate_code                                                                                                              
    states_generated = self.generate_states(sdfg, global_stream, callsite_stream)                                              
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                              
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/framecode.py", line 408,
 in generate_states                                                                                                            
    callsite_stream.write(cft.as_cpp(self, sdfg.symbols), sdfg)                                                                
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                       
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/control_flow.py", line 217, in a
s_cpp                                                                                                                          
    expr += elem.as_cpp(codegen, symbols)                                                                                      
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                      
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/control_flow.py", line 129, in a
s_cpp
    expr += self.dispatch_state(self.state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/framecode.py", line 385,
 in dispatch_state
    self._dispatcher.dispatch_state(sdfg, state, global_stream, stream)
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/dispatcher.py", line 354, in dis
patch_state
    disp.generate_state(sdfg, state, function_stream, callsite_stream)
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/fpga.py", line 637, in g
enerate_state
    self.generate_kernel(sdfg, state, kernel_name, single_sgs, function_stream, callsite_stream,
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/fpga.py", line 2263, in 
generate_kernel
self.generate_kernel_internal(sdfg, state, kernel_name, predecessors, subgraphs, kernel_stream,
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/xilinx.py", line 1094, in generate_kernel_internal
    self.generate_modules(sdfg, state, kernel_name, subgraphs, subgraph_parameters, module_stream, entry_stream,
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/fpga.py", line 2316, in generate_modules
    self.generate_module(sdfg, state, kernel_name, module_name, subgraph, subgraph_parameters[subgraph],
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/xilinx.py", line 823, in generate_module
    self._dispatcher.dispatch_subgraph(sdfg,
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/dispatcher.py", line 393, in dispatch_subgraph
    self.dispatch_node(sdfg, dfg, state_id, v, function_stream, callsite_stream)
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/dispatcher.py", line 420, in dispatch_node
    disp.generate_node(sdfg, dfg, state_id, node, function_stream, callsite_stream)
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/rtl.py", line 64, in generate_node
    self.dispatcher.dispatch_copy(src_node, node, edge, sdfg, dfg, state_id, function_stream,
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/dispatcher.py", line 562, in dispatch_copy
    target.copy_memory(sdfg, dfg, state_id, src_node, dst_node, edge, function_stream, output_stream)
  File "/home/<user>/Applications/miniconda3/envs/dace/lib/python3.11/site-packages/dace/codegen/targets/rtl.py", line 110, in copy_memory
    callsite_stream.write(line)
                          ^^^^
UnboundLocalError: cannot access local variable 'line' where it is not associated with a value

note that "line" is possibly unbound in dace/codegen/targets/rtl.py:110

Desktop (please complete the following information):

  • OS: Ubuntu 20.04.6 LTS x86_64
  • Dace: Version: 0.14.4

Anything I missed?

@carljohnsen
Copy link
Collaborator

Hi @remifan ! You were right, some of the RTL samples weren't set up properly, resulting in them not using the workflow for which they were intended, which led to the error you encountered. After #1403 this shouldn't be the case anymore, and each sample should run as intended.

Could you verify whether you're still having the problem with the current master branch? And do say if you encounter any more problems. :)

@remifan
Copy link
Author

remifan commented Oct 26, 2023

Thanks a lot for the fixes, the examples are working now

@remifan remifan closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants