Skip to content

Add rock prefix for rocMLIR attributes#4748

Open
dhernandez0 wants to merge 2 commits intodevelopfrom
add_rock_prefix
Open

Add rock prefix for rocMLIR attributes#4748
dhernandez0 wants to merge 2 commits intodevelopfrom
add_rock_prefix

Conversation

@dhernandez0
Copy link
Copy Markdown

@dhernandez0 dhernandez0 commented Apr 7, 2026

Motivation

rocMLIR is going to use rock. prefix for attributes (ROCm/rocMLIR#2334), just updating them on MIGraphX side as well.

We probably want to sync this PR merge with rocMLIR PR. And bump rocMLIR commit hash.

Technical Details

  • docs/dev/triage-rocmlir.rst: update example, added prefix
  • src/targets/gpu/mlir.cpp: set attributes with prefix
  • test/gpu/mlir.cpp: update get_attrs() with prefix as well

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

Copilot AI review requested due to automatic review settings April 7, 2026 15:44
@dhernandez0 dhernandez0 requested review from a team and causten as code owners April 7, 2026 15:44
@dhernandez0 dhernandez0 self-assigned this Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates MIGraphX’s rocMLIR integration to use the new rock.-prefixed function attributes expected by rocMLIR, and aligns tests/docs with the updated MLIR printing.

Changes:

  • Switch MLIR func.func attributes from arch/kernel/num_* to rock.arch/rock.kernel/rock.num_* (and rock.enable_splitk_for_tuning).
  • Update GPU MLIR dump tests to expect the new attribute names.
  • Refresh rocMLIR triage documentation snippets to show the new attribute names.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/targets/gpu/mlir.cpp Emits rock.* attributes on generated func.func ops (including SplitK unit attr).
test/gpu/mlir.cpp Updates expected MLIR attribute dictionaries to match rock.* naming.
docs/dev/triage-rocmlir.rst Updates example MLIR module snippets to use rock.* attribute names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


module {
func.func @mlir_convolution(%arg0: !migraphx.shaped<2x8x3x3xf32, 72x9x3x1>, %arg1: !migraphx.shaped<1x8x4x4xf32, 128x16x4x1>) -> !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> attributes {arch = "gfx90a:sramecc+:xnack-", enable_splitk_for_tuning = true, kernel = "mixr", num_cu = 110 : i64} {
func.func @mlir_convolution(%arg0: !migraphx.shaped<2x8x3x3xf32, 72x9x3x1>, %arg1: !migraphx.shaped<1x8x4x4xf32, 128x16x4x1>) -> !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning = true, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The example shows rock.enable_splitk_for_tuning = true, but MIGraphX emits this as a unit attribute (see mlirUnitAttrGet(...) usage in src/targets/gpu/mlir.cpp), which prints as just rock.enable_splitk_for_tuning (no = true) in MLIR assembly. Update the snippet to match the actual printed MLIR so users can copy/paste it reliably during triage.

Suggested change
func.func @mlir_convolution(%arg0: !migraphx.shaped<2x8x3x3xf32, 72x9x3x1>, %arg1: !migraphx.shaped<1x8x4x4xf32, 128x16x4x1>) -> !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning = true, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {
func.func @mlir_convolution(%arg0: !migraphx.shaped<2x8x3x3xf32, 72x9x3x1>, %arg1: !migraphx.shaped<1x8x4x4xf32, 128x16x4x1>) -> !migraphx.shaped<1x2x2x2xf32, 8x4x2x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {

Copilot uses AI. Check for mistakes.

module {
func.func @mlir_dot_add(%arg0: !migraphx.shaped<1x5x4xf32, 20x4x1>, %arg1: !migraphx.shaped<1x4x3xf32, 12x3x1>, %arg2: !migraphx.shaped<1x5x3xf32, 15x3x1>) -> !migraphx.shaped<1x5x3xf32, 15x3x1> attributes {arch = "gfx90a:sramecc+:xnack-", enable_splitk_for_tuning = true, kernel = "mixr", num_cu = 110 : i64} {
func.func @mlir_dot_add(%arg0: !migraphx.shaped<1x5x4xf32, 20x4x1>, %arg1: !migraphx.shaped<1x4x3xf32, 12x3x1>, %arg2: !migraphx.shaped<1x5x3xf32, 15x3x1>) -> !migraphx.shaped<1x5x3xf32, 15x3x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning = true, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

Same as above: rock.enable_splitk_for_tuning should be shown as a unit attribute (no = true) to match MIGraphX’s emitted/printed MLIR and avoid confusing copy/paste during triage.

Suggested change
func.func @mlir_dot_add(%arg0: !migraphx.shaped<1x5x4xf32, 20x4x1>, %arg1: !migraphx.shaped<1x4x3xf32, 12x3x1>, %arg2: !migraphx.shaped<1x5x3xf32, 15x3x1>) -> !migraphx.shaped<1x5x3xf32, 15x3x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning = true, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {
func.func @mlir_dot_add(%arg0: !migraphx.shaped<1x5x4xf32, 20x4x1>, %arg1: !migraphx.shaped<1x4x3xf32, 12x3x1>, %arg2: !migraphx.shaped<1x5x3xf32, 15x3x1>) -> !migraphx.shaped<1x5x3xf32, 15x3x1> attributes {rock.arch = "gfx90a:sramecc+:xnack-", rock.enable_splitk_for_tuning, rock.kernel = "mixr", rock.num_cu = 110 : i64, rock.num_chiplets = 1 : i64} {

Copilot uses AI. Check for mistakes.
@umangyadav
Copy link
Copy Markdown
Member

you would need to bump rocMLIR SHA too

Copy link
Copy Markdown
Member

@bdevorem bdevorem left a comment

Choose a reason for hiding this comment

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

assuming the rocmlir hash gets updated after that PR is merged, lgtm

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.

8 participants