[Feature] qjit-compatible implementation of itertools.product
#1340
Labels
enhancement
New feature or request
itertools.product
#1340
It's quite common to see workflows that make use of itertools related functionality, in particular
itertools.product
,itertools.combinations
, anditertools.permutations
.Here, I focus only on
product
as this is part of the workflow I am using.For example, consider:
Here,
product
has the following rough semantics:(note this is not exactly the implementation, as the actual implementation does not generate intermediate lists in memory).
This will fail to compile, since Autograph is not able to recognize and convert
itertools.product
(even though the arguments are all compile-time constant).It is also non-trivial to re-write as pure catalyst loops using
range
in complex cases.I propose adding our own
catalyst.product
, similar to our existingrange
, that AutoGraph can use as the conversion target. This would then lower to a fast implementation of product (likely as nested for loops) at the MLIR layer. An advantage here is that this would allowproduct
to work even with dynamic arguments.The text was updated successfully, but these errors were encountered: