Skip to content

Handle symbol name conflicts during executable linking. - #5978

Merged
ScottTodd merged 3 commits into
iree-org:mainfrom
ScottTodd:linking-symbol-conflicts
Jun 1, 2021
Merged

ScottTodd merged 3 commits into
iree-org:mainfrom
ScottTodd:linking-symbol-conflicts

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

Executable linking merges multiple modules together into a single module. If a symbol name already exists in the merged module, we previously skipped over it assuming the contents of those symbols were identical. This now resolve conflicts by

  • renaming different private symbols
  • merging equivalent private symbols
  • emitting an error for public symbol conflicts

Fixes #5946.
Includes a step towards #4670 that should be made generic in some way.
Issues like #4897 will still need to use MLIR symbol visibility (not some special visibility) or ensure uniqueness prior to this pass.

@ScottTodd ScottTodd added the compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) label May 21, 2021
@google-cla google-cla Bot added the cla: yes label May 21, 2021
@ScottTodd
ScottTodd marked this pull request as ready for review May 21, 2021 18:02

@MaheshRavishankar MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments

static void printRodataOp(OpAsmPrinter &p, RodataOp &op) {
p << op.getOperationName() << ' ';

// TODO(#4670): Share across ops or upstream a custom directive

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we dont print all the attributes on this op. The canonical way of doing this is to print the attribute list on the op, there is a stock method to do that which excepts a list of already printed attribues. Anyway, just an FYI. Its not needed here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This custom printer/parser already skips some of the default formatting with its attributes. This special handling for symbol visibility as a bare word op prefix is forked from upstream:

@ScottTodd
ScottTodd force-pushed the linking-symbol-conflicts branch from 16aed8f to 0f57486 Compare May 21, 2021 21:59
@ScottTodd
ScottTodd force-pushed the linking-symbol-conflicts branch from 4daf6f7 to 34f7a1e Compare June 1, 2021 18:27
@ScottTodd
ScottTodd enabled auto-merge June 1, 2021 19:09
@ScottTodd
ScottTodd merged commit 8857851 into iree-org:main Jun 1, 2021
@ScottTodd
ScottTodd deleted the linking-symbol-conflicts branch June 1, 2021 19:12
ScottTodd added a commit that referenced this pull request Jun 1, 2021
This was referenced Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LinkExecutables pass overrides duplicate named tensors

3 participants