Page MenuHomePhabricator

[mlir][Pass] Add support for generating pass utilities via tablegen
ClosedPublic

Authored by rriddle on Mar 23 2020, 5:42 PM.

Details

Summary

This revision adds support for generating utilities for passes such as options/statistics/etc. that can be inferred from the tablegen definition. This removes additional boilerplate from the pass, and also makes it easier to remove the reliance on the pass registry to provide certain things(e.g. the pass argument).

Depends On D76658

Diff Detail

Event Timeline

rriddle created this revision.Mar 23 2020, 5:42 PM
mehdi_amini added inline comments.Mar 29 2020, 11:10 AM
mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
27

Have you looked into generating normal top-level headers (maybe even one per pass) that would put define a base class for each of the pass so you could just inherit from it?

#include "milr/Dialect/Quant/ConvertConstPassGen.h"

struct ConvertConstPass : public ConvertConstPassBase {

}
rriddle marked 2 inline comments as done.Mar 29 2020, 1:04 PM
rriddle added inline comments.
mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
27

As a first order it ended up being more boilerplate than I'd like, e.g. properly handling CRTP, setting the right base class(between function, module, operation, and user defined), etc.

rriddle updated this revision to Diff 253516.Mar 30 2020, 12:47 AM
rriddle marked an inline comment as done.

Rebase

mehdi_amini accepted this revision.Mar 31 2020, 7:44 PM
This revision is now accepted and ready to land.Mar 31 2020, 7:44 PM
nicolasvasilache accepted this revision.Mar 31 2020, 8:28 PM

Very cool way to centralize all this,

This revision was automatically updated to reflect the committed changes.