[AIMIGRAPHX-1163] Add lower_device_ops pass - #5030
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional GPU pipeline pass (gpu::lower_hip_ops) to lower hip::fill / hip::copy into gpu::precompile_op (and thus HIP code objects) before compile_ops, gated by MIGRAPHX_GPU_LOWER_HIP_OPS. This is intended to avoid leaving hip::* memory ops in the IR at the point where compilation happens.
Changes:
- Introduces
gpu::lower_hip_opspass and wires it into the GPU target pipeline behindMIGRAPHX_GPU_LOWER_HIP_OPS. - Extends GPU JIT fill compilation with a dedicated
hip::fillcompiler producinghip_fill_kernel. - Adds GPU tests (including tuple + dynamic-shape behavior) and documents the new environment variable.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/targets/gpu/lower_hip_ops.cpp |
Implements matcher-based lowering of hip::fill/hip::copy into gpu::precompile_op, including tuple handling. |
src/targets/gpu/include/migraphx/gpu/lower_hip_ops.hpp |
Declares the new gpu::lower_hip_ops pass. |
src/targets/gpu/target.cpp |
Adds env-var gating and inserts the pass before compile_ops in the GPU pipeline. |
src/targets/gpu/jit/fill.cpp |
Factors common fill-kernel compilation and adds a hip::fill JIT compiler path. |
src/targets/gpu/CMakeLists.txt |
Adds lower_hip_ops.cpp to the GPU target build. |
test/gpu/lower_hip_ops.cpp |
Adds unit + end-to-end tests for lowering behavior (static, dynamic, tuple) and kernel execution. |
docs/reference/MIGraphX-dev-env-vars.rst |
Documents MIGRAPHX_GPU_LOWER_HIP_OPS. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5030 +/- ##
========================================
Coverage 92.89% 92.89%
========================================
Files 603 603
Lines 32448 32448
========================================
Hits 30140 30140
Misses 2308 2308 🚀 New features to boost your workflow:
|
Regressions detected 🔴 * No develop baseline was found for this PR's branch point; compared against the latest available develop run instead. |
|
TedThemistokleous
left a comment
There was a problem hiding this comment.
Some initial comments
TedThemistokleous
left a comment
There was a problem hiding this comment.
Thanks for answering the questions. No other issues/concerns with this. Approved
pfultz2
left a comment
There was a problem hiding this comment.
The find_contiguous_copy needs to also be removed from fuse_ops since this pass should handle it.
Motivation
Adds a pass to lower
hip::copyandhip::fillinstructions beforecompile_opspass.Technical Details
If
MIGRAPHX_GPU_LOWER_HIP_OPSis set, alower_hip_opspass will run beforecompile_opsto replace anyhip::copyandhip::fillinstructions with a precompiled op.Example IR below after compiling using reducesum and
MIGRAPHX_SPLIT_REDUCE_SIZE=1.w/o lowering:
w/ lowering:
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable