[MLIR][PDL] returning results from pdl.apply_native_constraints?

Hello,

I’m currently trying to write a PDL pattern with a constraint that ensures exactly one dimension of a DenseIntElementsAttr is non-zero. Problem is, I also need to use the index of said dimension as an attribute in the rewrite.

Currently, the only solution I see is to write a separate native_constraint and native_rewrite, which effectively do the same thing. Is there currently a way around this? If not, is there a plan to allow native_constraints to return values? I see this also being useful for composing native_constraints, to reduce the amount of hyper-specific native_constraint functions that need to be written.

thank you.