Skip to content

[AIROCMLIR-555] Remove mhal.launch and mhal.await from the codebase#2333

Open
erizheng-amd wants to merge 28 commits intodevelopfrom
eric-555
Open

[AIROCMLIR-555] Remove mhal.launch and mhal.await from the codebase#2333
erizheng-amd wants to merge 28 commits intodevelopfrom
eric-555

Conversation

@erizheng-amd
Copy link
Copy Markdown
Contributor

@erizheng-amd erizheng-amd commented Apr 6, 2026

Motivation

This PR addresses the issue in ticket 555. It removes the dependency on mhal conversions from both Tosa and Linalg by modifying the clone-harness pipeline

Technical Details

  • Removed the redundant code and includes for the workaround for mhal instructions
  • Modified the clone-harness pipeline from using mhal.launch and mhal.await to func.call
  • Modified MHALToGPU.cpp to adapt both mhal and func.call lowering
  • Removed support for mhal.launch and mhal.await as they are no longer used
  • Updated LIT tests for the change

Test Plan

Tested with check-rocmlir

Test Result

All tests passed

root@d81de03d786c:~/code/rocMLIR/build# ninja check-rocmlir
[15/352] Running utility command for fusion-e2e-tests
DONE!
[334/335] Running the RocMLIR regression tests

Testing Time: 817.30s

Total Discovered Tests: 1185
  Unsupported      : 181 (15.27%)
  Passed           : 999 (84.30%)
  Expectedly Failed:   5 (0.42%)

Submission Checklist

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

This PR removes the remaining reliance on mhal.launch/mhal.dependency in MIGraphX-to-{Tosa,Linalg} boundary handling by switching the clone-harness wrapper path to func.call, and updates GPU lowering + LIT tests accordingly.

Changes:

  • Update rocmlir-gen clone-harness wrapper generation to use func.call and ensure prefill initialization is inserted for both mhal.launch and func.call paths.
  • Remove mhal.launch legality/pattern handling from MIGraphXToTosa and MIGraphXToLinalg boundary conversions.
  • Extend MHAL→GPU lowering to handle bufferized func.call to GPU kernels, and update e2e/LIT expectations for the new verification output.

Reviewed changes

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

Show a summary per file
File Description
mlir/tools/rocmlir-gen/rocmlir-gen.cpp Switch clone-harness wrapper to func.call; run prefills before cloning; handle prefills for both launch/call.
external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp Add shared lowering for GPU kernels and support bufferized func.call lowering in addition to mhal.launch.
mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosaPass.cpp Remove mhal.launch dynamic legality from boundary conversion setup.
mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosa.cpp Remove the mhal.launch conversion pattern from boundary pattern population.
mlir/lib/Conversion/MIGraphXToLinalg/MIGraphXToLinalgPass.cpp Remove mhal.launch dynamic legality and launcher conversion hookup.
mlir/lib/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.cpp Stop injecting mhal.launch legalization patterns into boundary conversion patterns.
mlir/include/mlir/Conversion/MIGraphXToTosa/MIGraphXToTosa.h Adjust includes for pass registration usage (PassManager).
mlir/include/mlir/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.h Remove launcher-conversion API declaration and prune includes.
mlir/test/xmir/pr-e2e/resnet18_blk3/resnet18_blk3_part2.mlir Update RUN line to always print verify results; adjust FileCheck expectations.
mlir/test/xmir/pr-e2e/resnet18_blk3/resnet18_blk3_part1.mlir Same as above.
mlir/test/xmir/pr-e2e/resnet18_blk2/resnet18_blk2_part0.mlir Same as above.
mlir/test/xmir/pr-e2e/resnet18_blk1/resnet18_blk_part2.mlir Same as above.
mlir/test/xmir/pr-e2e/resnet18_blk1/resnet18_blk_part0.mlir Same as above.
mlir/test/fusion/pr-e2e/tosa-to-rock-exp.e2e.mlir Update verifier output checks for new always-print behavior.
mlir/test/fusion/pr-e2e/mixr-sd-explicit-broadcasting.mlir Replace mhal.launch/mhal.await with func.call in wrapper.
mlir/test/fusion/pr-e2e/mixr-gemm/mixr-gemm-tr-folding2.mlir Replace mhal.launch/mhal.await with func.call in wrapper.
mlir/test/fusion/pr-e2e/mixr-gemm/mixr-gemm-tr-folding.mlir Replace mhal.launch/mhal.await with func.call in wrapper.
mlir/test/fusion/pr-e2e/mixr-conv-bias-clipped-relu.mlir Replace mhal.launch/mhal.await with func.call in wrapper.
mlir/test/fusion/pr-e2e/mixr-dot-int4-f16.mlir Update FileCheck expectation from mhal.launch to call @....
mlir/test/fusion/pr-e2e/mixr-non-contiguous-strides.mlir Update RUN + expectation to reflect full-tensor correctness.
mlir/test/fusion/pr-e2e/mixr-expand-strides-non-multiple.mlir Update RUN + expectation to reflect full-tensor correctness.

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

Comment thread mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosaPass.cpp Outdated
Comment thread mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosa.cpp Outdated
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

Copilot reviewed 48 out of 48 changed files in this pull request and generated no new comments.


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

Comment thread mlir/test/Dialect/Rock/gridwise_attention_scale_output_divf_arcp.mlir Outdated
Comment thread mlir/test/fusion/pr-e2e/mixr-expand-strides-non-multiple.mlir Outdated
Comment thread mlir/tools/rocmlir-gen/rocmlir-gen.cpp Outdated
Comment thread mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosaPass.cpp Outdated
Comment thread external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp Outdated
Comment thread external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp Outdated
Comment thread external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp Outdated
Comment thread external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp Outdated
Comment thread mlir/tools/rocmlir-gen/rocmlir-gen.cpp Outdated
@erizheng-amd erizheng-amd changed the title [AIROCMLIR-555] Remove mhal.dependency from MIGraphXTo* passes [AIROCMLIR-555] Remove mhal.launch and mhal.await from the codebase May 1, 2026
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