Xilinx / mlir-air

MIT License
71 stars 26 forks source link

Improvements to ChannelGet and ChannelPut Python Wrappers #622

Closed hunhoffe closed 3 weeks ago

hunhoffe commented 3 weeks ago

This PR seeks to improve readability of python code using the ChannelGet and ChannelPut python wrappers and also seeks to make it easier to use these wrappers.

Readability improvements come from forcing the callee to explicitly label (src|dst)_(strides|sizes|offsets) labels in their code. By requiring explicit labels, this can help a reader better understand how these mechanisms are used without having to lookup or memorize the API itself.

Usability improvement is from implementing behind-the-scenes conversion from python integers to Index values. This conversion is done by most wrappers in _air_opts_ext.py. I removed the existing list comprehension-based conversions in favor of a conversion function that can be mapped to lists using functools, so that the logic of the conversion is only found in a singular helper function instead of for each individual argument of each individual wrapper.