Page MenuHomePhabricator

[mlir][spirv] Use SmallVector<ArrayRef> for availability queries
ClosedPublic

Authored by antiagainst on Mar 9 2020, 2:07 PM.

Details

Summary

Previously extensions and capabilities requirements are returned as
SmallVector<SmallVector>. It's an anti-pattern; this commit improves
a bit by returning as SmallVector<ArrayRef>. This is possible because
the internal sequence is always known statically (from the spec)
so that we can use a static constant array for it and get an ArrayRef.

Depends On D75872

Diff Detail

Event Timeline

antiagainst created this revision.Mar 9 2020, 2:07 PM
Herald added a project: Restricted Project. · View Herald Transcript
mravishankar requested changes to this revision.Mar 10 2020, 12:26 PM

Do we need to autogen these? Can we have a simple utility method instead of generating this. Its a bit hard to parse.

mlir/include/mlir/Dialect/SPIRV/SPIRVAvailability.td
50

nit : s/instnace/instance

This revision now requires changes to proceed.Mar 10 2020, 12:26 PM
antiagainst marked an inline comment as done.

Address comments

Do we need to autogen these? Can we have a simple utility method instead of generating this. Its a bit hard to parse.

Agreed that it's a bit hard to parse, but note that this is expected to be general so later other dialects can also use the availability mechanism if they want. I plan to update the doc to explain a bit afterwards.

mravishankar accepted this revision.Mar 12 2020, 2:29 PM
This revision is now accepted and ready to land.Mar 12 2020, 2:29 PM
This revision was automatically updated to reflect the committed changes.