This is an archive of the discontinued LLVM Phabricator instance.

[mlir] FunctionOpInterface: turn required attributes into interface methods (Reland)
ClosedPublic

Authored by Mogball on Dec 9 2022, 12:05 PM.

Details

Summary

Reland D139447, D139471 With flang actually working

  • FunctionOpInterface: make get/setFunctionType interface methods

This patch removes the concept of a function_type-named type attribute
as a requirement for implementors of FunctionOpInterface. Instead, this
type should be provided through two interface methods, getFunctionType
and setFunctionTypeAttr (*Attr because functions may use different
concrete function types), which should be automatically implemented by
ODS for ops that define a $function_type attribute.

This also allows FunctionOpInterface to materialize function types if
they don't carry them in an attribute, for example.

Importantly, all the function "helper" still accept an attribute name to
use in parsing and printing functions, for example.

  • FunctionOpInterface: arg and result attrs dispatch to interface

This patch removes the arg_attrs and res_attrs named attributes as a
requirement for FunctionOpInterface and replaces them with interface
methods for the getters, setters, and removers of the relevent
attributes. This allows operations to use their own storage for the
argument and result attributes.

Diff Detail

Event Timeline

Mogball created this revision.Dec 9 2022, 12:05 PM
Herald added a reviewer: rriddle. · View Herald Transcript
Herald added a reviewer: jpienaar. · View Herald Transcript
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Mogball requested review of this revision.Dec 9 2022, 12:05 PM

My smoketest looks good.

Please wait for an approval from @DavidSpickett before merging.

Thanks for fixing this!

jpienaar accepted this revision.Dec 9 2022, 2:35 PM

Thanks - could you update the description to make the feature top and the relanding inside? (just to make it easier to see from header the feature without looking at full description)

This revision is now accepted and ready to land.Dec 9 2022, 2:35 PM
Mogball retitled this revision from [mlir] Reland D139447, D139471 to [mlir] FunctionOpInterface: turn required attributes into interface methods (Reland).Dec 10 2022, 3:16 PM
Mogball edited the summary of this revision. (Show Details)

Please wait for an approval from @DavidSpickett before merging.

Happy to report flang bots are green.

I think we're in different time zones so landing as you did is fine, I had finished for the week anyway. If you have future changes I can test them on our hardware if needed, but flang (so far) is pretty consistent across architectures so just using the same cmake will cover most things.