This is an archive of the discontinued LLVM Phabricator instance.

[mlir] remove StringMap to make -view-op-graph attr order deterministic
AbandonedPublic

Authored by erikdesjardins on Feb 2 2023, 7:11 PM.

Details

Summary

I am planning to change the StringMap hash function in D142862,
which breaks mlir/test/Transforms/print-op-graph.mlir because
it changes the iteration order.

A map isn't necessary in this situation. Switch to SmallVector instead.

Diff Detail

Event Timeline

erikdesjardins created this revision.Feb 2 2023, 7:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 7:11 PM
erikdesjardins requested review of this revision.Feb 2 2023, 7:11 PM
python3kgae added inline comments.Feb 2 2023, 7:51 PM
mlir/lib/Transforms/ViewOpGraph.cpp
62

Will the max size of Attributes change in the future?

mehdi_amini accepted this revision.Feb 2 2023, 8:31 PM
This revision is now accepted and ready to land.Feb 2 2023, 8:31 PM

use ArrayRef

mlir/lib/Transforms/ViewOpGraph.cpp
62

Sure, if someone adds another attribute and they want to keep the SmallVector on the stack, this size could change.

This does make me realize that SmallVector is only necessary at one callsite, so we might as well use ArrayRef here instead (done in latest version of patch).

python3kgae accepted this revision.Feb 3 2023, 4:50 AM