Skip to content

[Codegen] Make ReconcileTranslationInfo work with multiple exports - #20801

Merged
qedawkins merged 3 commits into
iree-org:mainfrom
qedawkins:multi_export_reconcile
May 16, 2025
Merged

qedawkins merged 3 commits into
iree-org:mainfrom
qedawkins:multi_export_reconcile

Conversation

@qedawkins

Copy link
Copy Markdown
Contributor

Symbol uniqueness guarantees that exports -> functions is injective (and bijective with public functions) so we can greedily reconcile translation info for each export. It is, however, possible for multiple publicly exported functions to transiently call a shared function which needs to resolve with consistent translation info (workgroup/subgroup size).

To support the kind of code we generate today, this works in 2 steps. Foreach export:

  1. Resolve workgroup count from the immediately exported function (guaranteed consistent by bijection). This means we don't support transiently distributed function calls yet.
  2. Walk the callgraph to find all locally annotated global kernel parameters (subgroup/workgroup size) and make sure they are consistent per export.

@qedawkins
qedawkins requested a review from hanhanW as a code owner May 14, 2025 17:17
Symbol uniqueness guarantees that exports -> functions is injective (and
bijective with public functions) so we can greedily reconcile
translation info for each export. It is, however, possible for multiple
publicly exported functions to transiently call a shared function which
needs to resolve with consistent translation info (workgroup/subgroup
size).

To support the kind of code we generate today, this works in 2 steps.
Foreach export:
  1. Resolve workgroup count from the immediately exported function
     (guaranteed consistent by bijection). This means we don't support
     transiently distributed function calls yet.
  2. Walk the callgraph to find all locally annotated global kernel
     parameters (subgroup/workgroup size) and make sure they are
     consistent per export.

@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.

nice!

@qedawkins
qedawkins merged commit 51d6412 into iree-org:main May 16, 2025
@qedawkins
qedawkins deleted the multi_export_reconcile branch May 16, 2025 22:31
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
…20801)

Symbol uniqueness guarantees that exports -> functions is injective (and
bijective with public functions) so we can greedily reconcile
translation info for each export. It is, however, possible for multiple
publicly exported functions to transiently call a shared function which
needs to resolve with consistent translation info (workgroup/subgroup
size).

To support the kind of code we generate today, this works in 2 steps.
Foreach export:
1. Resolve workgroup count from the immediately exported function
(guaranteed consistent by bijection). This means we don't support
transiently distributed function calls yet.
2. Walk the callgraph to find all locally annotated global kernel
parameters (subgroup/workgroup size) and make sure they are consistent
per export.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants