PYNQ icon indicating copy to clipboard operation
PYNQ copied to clipboard

Error registering CU with 64b arguments

Open quetric opened this issue 3 years ago • 2 comments

  • PYNQ version: 2.7
  • Board name: Alveo U280
  • XRT version: 2.13.399
  • Description: When getting a handle to a CU with 64b unsigned int arguments, pynq fails with KeyError: 'unsigned long long' in _create_call of overlay.py. The error can be worked around by adding 'unsigned long long': 'Q', to the _struct_dict.

quetric avatar Mar 04 '22 16:03 quetric

For completeness, let me add the full trace

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-5-a0166a429a82> in <module>
----> 1 ol.hostctrl_0

/scratch/anaconda3/envs/pynq/lib/python3.7/site-packages/pynq/overlay.py in __getattr__(self, key)
    364         """
    365         if self.is_loaded():
--> 366             return getattr(self._ip_map, key)
    367         else:
    368             raise RuntimeError("Overlay not currently loaded")

/scratch/anaconda3/envs/pynq/lib/python3.7/site-packages/pynq/overlay.py in __getattr__(self, key)
    876             ipdescription = self._description['ip'][key]
    877             try:
--> 878                 driver = ipdescription['driver'](ipdescription)
    879             except UnsupportedConfiguration as e:
    880                 warnings.warn(

/scratch/anaconda3/envs/pynq/lib/python3.7/site-packages/pynq/overlay.py in __init__(self, description)
    693                     self.device.has_capability('CALLABLE')):
    694                 self._signature, struct_string, self._ptr_list, self.args = \
--> 695                     _create_call(self._registers)
    696                 self._call_struct = struct.Struct(struct_string)
    697                 self._ctrl_reg = True

/scratch/anaconda3/envs/pynq/lib/python3.7/site-packages/pynq/overlay.py in _create_call(regmap)
    615             ptr_type = True
    616         else:
--> 617             struct_string += _struct_dict[v['type']]
    618             ptr_type = False
    619         if k != 'CTRL':

KeyError: 'unsigned long long'

mariodruiz avatar Mar 04 '22 18:03 mariodruiz

We may need to review the datatypes in the _struct_dict https://github.com/Xilinx/PYNQ/blob/master/pynq/overlay.py#L561-L581

As some of them seem not to be correct C datatypes https://en.wikipedia.org/wiki/C_data_types. For instance, 'long long unsigned int': 'Q' should be 'unsigned long long': 'Q' which is your case.

mariodruiz avatar Mar 04 '22 18:03 mariodruiz