Skip to content

[ROCMTarget] Add pass for applying builtin specialization patterns - #21001

Merged
qedawkins merged 3 commits into
iree-org:mainfrom
qedawkins:apply_specialization_builtins
Jun 24, 2025
Merged

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

Conversation

@qedawkins

Copy link
Copy Markdown
Contributor

Adds support for arch/sku specific PDL patterns to be loaded for finding and annotating ops with ranges to specialize for. This is a stopgap for a longer term solution where configuration logic uses range information directly and returns the set of ranges to specialize for itself.

Today, IREE::Codegen::BlockDynamicDims uses the divisibility info to split out static dims that kernel config uses, meaning this has to happen before this pass.

PDL modules aren't ideal for this use case because pattern rewrite sets require ownership over the module, but is lighter weight than transform dialect for this use case (basic matching + annotation). The reason for IR based patterns is two-fold

  1. Arch/SKU specific ranges are often fixed to a few static best cases, meaning hand writing the ranges to annotate is fewer characters than emitting it with C++.
  2. Adding support for new architectures is much faster to copy-paste an existing file and update the values than extending C++ switch statements.

@qedawkins

Copy link
Copy Markdown
Contributor Author

This is stalled on fixing #21019 and undoing the associated revert.

@qedawkins
qedawkins force-pushed the apply_specialization_builtins branch from 5b20e43 to 5174dd2 Compare June 16, 2025 20:48
Adds support for arch/sku specific PDL patterns to be loaded for finding
and annotating ops with ranges to specialize for. This is a stopgap for
a longer term solution where configuration logic uses range information
directly and returns the set of ranges to specialize for itself.

Today, IREE::Codegen::BlockDynamicDims uses the divisibility info to
split out static dims that kernel config uses, meaning this has to
happen before this pass.

PDL modules aren't ideal for this use case because pattern rewrite sets
require ownership over the module, but is lighter weight than transform
dialect for this use case (basic matching + annotation). The reason for
IR based patterns is two-fold

1. Arch/SKU specific ranges are often fixed to a few static best cases,
   meaning hand writing the ranges to annotate is fewer characters than
   emitting it with C++.
2. Adding support for new architectures is much faster to copy-paste an
   existing file and update the values than extending C++ switch
   statements.
@qedawkins
qedawkins force-pushed the apply_specialization_builtins branch from 3dc2bc5 to 355b837 Compare June 16, 2025 21:02
@qedawkins
qedawkins marked this pull request as ready for review June 16, 2025 21:02
@qedawkins
qedawkins requested a review from kuhar as a code owner June 16, 2025 21: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.

I understand this PR by itself, but I am not sure how this connects to actual injection of the ping-pong kernel later on.

@qedawkins
qedawkins enabled auto-merge (squash) June 24, 2025 02:56
@qedawkins
qedawkins disabled auto-merge June 24, 2025 15:04
@qedawkins
qedawkins merged commit 23e4a5a into iree-org:main Jun 24, 2025
@qedawkins
qedawkins deleted the apply_specialization_builtins branch June 24, 2025 18:45
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
…21001)

Adds support for arch/sku specific PDL patterns to be loaded for finding
and annotating ops with ranges to specialize for. This is a stopgap for
a longer term solution where configuration logic uses range information
directly and returns the set of ranges to specialize for itself.

Today, IREE::Codegen::BlockDynamicDims uses the divisibility info to
split out static dims that kernel config uses, meaning this has to
happen before this pass.

PDL modules aren't ideal for this use case because pattern rewrite sets
require ownership over the module, but is lighter weight than transform
dialect for this use case (basic matching + annotation). The reason for
IR based patterns is two-fold

1. Arch/SKU specific ranges are often fixed to a few static best cases,
meaning hand writing the ranges to annotate is fewer characters than
emitting it with C++.
2. Adding support for new architectures is much faster to copy-paste an
existing file and update the values than extending C++ switch
statements.
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