Skip to content

Adding compilation mode#4770

Open
pnikolic-amd wants to merge 18 commits intodevelopfrom
compile-modes
Open

Adding compilation mode#4770
pnikolic-amd wants to merge 18 commits intodevelopfrom
compile-modes

Conversation

@pnikolic-amd
Copy link
Copy Markdown
Collaborator

@pnikolic-amd pnikolic-amd commented Apr 9, 2026

Motivation

Adding compilation mode which defines factor between compilation time and quality of model optimization. This is defined by compile option "compile_mode" which is defined by int value 0-100 (0 - fast, minimal/no optimization, 100 slow, best optimization quality).

Technical Details

compile_mode is represented by enum class compile_modes, and int value is mapped in the closest value. There are three modes defined for now (more fine-grained system can be implemented later):

  • BALANCED (50) - Default execution of model compilation
  • MAX (100) - Default execution with exhaustive_tune flag enabled
  • EAGER (0) - Removed most of gpu independent passes except fusions and normalize_ops and skiped benchmarking for gpu kernels

Tested on both platforms, Eager mode improves compilation time up to 10x while decreasing inference performance for 20-50%.

Changelog Category

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

    • Added: New enum class compile_modes that define compile options
    • Added: New param compile_mode in compile_options struct
    • Added: Added support to set compile mode using all supported APIs and added flag for migraphx-driver app.
    • Changed: Changed get passes function for gpu target, to support execution in defined modes.
    • TODO: Add support to skip fusions in eager mode
    • TODO: Re-run mgx tests in eager mode

@pnikolic-amd pnikolic-amd self-assigned this Apr 9, 2026
@pnikolic-amd pnikolic-amd requested a review from causten as a code owner April 9, 2026 19:50
Comment thread src/include/migraphx/compile_modes.hpp Outdated
Comment thread src/include/migraphx/compile_options.hpp Outdated
Comment thread src/include/migraphx/compile_modes.hpp
Comment thread src/py/migraphx_py.cpp Outdated
Comment thread src/targets/gpu/target.cpp Outdated
Comment thread src/targets/gpu/target.cpp Outdated
Comment thread src/targets/gpu/target.cpp
Comment thread src/targets/gpu/target.cpp Outdated
Comment thread src/compile_modes.cpp Outdated
Comment thread src/compile_modes.cpp Outdated
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.

2 participants