This is an archive of the discontinued LLVM Phabricator instance.

[mlir][PDL] Add support for variadic operands and results in the PDL byte code
ClosedPublic

Authored by rriddle on Jan 29 2021, 7:56 PM.

Details

Summary

Supporting ranges in the byte code requires additional complexity, given that a range can't be easily representable as an opaque void *, as is possible with the existing bytecode value types (Attribute, Type, Value, etc.). To enable representing a range with void *, an auxillary storage is used for the actual range itself, with the pointer being passed around in the normal byte code memory. For type ranges, a TypeRange is stored. For value ranges, a ValueRange is stored. The above problem represents a majority of the complexity involved in this revision, the rest is adapting/adding byte code operations to support the changes made to the PDL interpreter in the parent revision.

After this revision, PDL will have initial end-to-end support for variadic operands/results.

Depends On D95722

Diff Detail

Event Timeline

rriddle created this revision.Jan 29 2021, 7:56 PM
rriddle requested review of this revision.Jan 29 2021, 7:57 PM
jpienaar accepted this revision.Mar 10 2021, 10:12 AM

I'll probably need to go through these again later, but looks good from check and can be refined later.

mlir/include/mlir/IR/PatternMatch.h
292–326

Is there no helper that covers these? Seems like a tagged union with generic pointer

mlir/lib/Rewrite/ByteCode.cpp
398

I stream output of these I found useful for debugging before. Not needed as part of this.

This revision is now accepted and ready to land.Mar 10 2021, 10:12 AM
rriddle updated this revision to Diff 330792.Mar 15 2021, 1:26 PM
rriddle marked 2 inline comments as done.

rebase

mlir/include/mlir/IR/PatternMatch.h
292–326

Not that I know of. All of the pointer union functionality in LLVM that I know of relies on using bits from the pointer, and not an additional tag field.

mlir/lib/Rewrite/ByteCode.cpp
398

SG, will add more debug logging in a followup.

This revision was landed with ongoing or failed builds.Mar 16 2021, 1:20 PM
This revision was automatically updated to reflect the committed changes.