Skip to content

fix: build with MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF - #6800

Merged
jdcampbe merged 8 commits into
developfrom
users/jascampb/ai-tuning-off-build-error
Jun 1, 2026
Merged

jdcampbe merged 8 commits into
developfrom
users/jascampb/ai-tuning-off-build-error

Conversation

@jdcampbe

@jdcampbe jdcampbe commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

The grouped xdlops solvers reference SolverHeuristicConfig and HeuristicInitState unconditionally (including in the non-AI fallback path), but the include of ai_conv_nd_kernel_tuning_utils.hpp was gated behind MIOPEN_ENABLE_AI_KERNEL_TUNING and HeuristicInitState was defined inside the same guard in the header. With the flag OFF, these symbols were undeclared and the build failed.

Move the header include outside the guard in the six affected solver .cpp files and move HeuristicInitState out of the AI-only block in ai_conv_nd_kernel_tuning_utils.hpp. The struct holds only references and trivial accessors with no AI-runtime dependency.

Motivation

Building MIOpen with -DMIOPEN_ENABLE_AI_KERNEL_TUNING=OFF fails to compile. The grouped xdlops
convolution solvers reference AI-tuning helper types (SolverHeuristicConfig, HeuristicInitState) from
code paths that are not guarded by the flag — including the non-AI fallback path that runs regardless of
the flag's value. With the flag OFF, the necessary header is not included and the symbols are
undeclared.

This PR fixes the build so that MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF is a supported configuration again,
without changing any runtime behavior when the flag is ON (the default).

Technical Details

Two distinct gating bugs were introduced by the recent centralized AI heuristics refactor:

Bug 1 — Header include gated, but types used unguarded. In each of the six affected solver .cpp files,
the include of ai_conv_nd_kernel_tuning_utils.hpp was inside #if MIOPEN_ENABLE_AI_KERNEL_TUNING. But
SolverHeuristicConfig (used at file scope to declare each solver's constexpr config) and
HeuristicInitState (used inside HeuristicInit, including the fallback path) are referenced unguarded.
With the flag OFF the header was never parsed and the types were undeclared.

Bug 2 — HeuristicInitState defined inside the AI-only block. In ai_conv_nd_kernel_tuning_utils.hpp,
HeuristicInitState was inside the #if MIOPEN_ENABLE_AI_KERNEL_TUNING guard. The struct is a trivial
state holder (refs to valid_kernels/index/split_k/kernel_id plus Reset() and SetResult()) with no
AI-runtime dependency, and it is used by the non-AI fallback path at the end of HeuristicInit, so it
must compile both ways.

Changes:

  • src/include/miopen/conv/heuristics/ai_conv_nd_kernel_tuning_utils.hpp — moved struct
    HeuristicInitState out of the #if MIOPEN_ENABLE_AI_KERNEL_TUNING block, placing it next to
    SolverHeuristicConfig in the unguarded namespace section. The AI-runtime symbols (RunAIHeuristics,
    RunParameterPredictionModel, etc.) remain inside the guard.
  • The following six solver .cpp files — moved #include
    <miopen/conv/heuristics/ai_conv_nd_kernel_tuning_utils.hpp> outside the #if. The other two AI headers
    (ai_heuristics.hpp, ai_candidate_selection.hpp) remain gated since they are only referenced from
    already-guarded code:
    • src/solver/conv/conv_hip_implicit_gemm_grouped_fwd_xdlops.cpp
    • src/solver/conv/conv_hip_implicit_gemm_grouped_bwd_xdlops.cpp
    • src/solver/conv/conv_hip_implicit_gemm_grouped_wrw_xdlops.cpp
    • src/solver/conv/conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cpp
    • src/solver/conv/conv_hip_implicit_gemm_3d_grouped_bwd_xdlops.cpp
    • src/solver/conv/conv_hip_implicit_gemm_3d_grouped_wrw_xdlops.cpp

No functional change when MIOPEN_ENABLE_AI_KERNEL_TUNING=ON (the default):
ai_conv_nd_kernel_tuning_utils.hpp was already being included in that path; this PR just makes the
include unconditional. AI-only code remains gated.

Test Plan

  • Configure and build with -DMIOPEN_ENABLE_AI_KERNEL_TUNING=OFF (HIP backend) and confirm the previously
    failing translation units now compile cleanly.
  • Configure and build with the default (MIOPEN_ENABLE_AI_KERNEL_TUNING=ON) to confirm no regression to
    the AI-enabled build.
  • Run existing AI-related unit tests with the default ON build to confirm AI tuning behavior is
    unchanged: test/gtest/kernel_tuning_net.cpp, test/gtest/conv_ai_candidate_selection_model.cpp,
    test/gtest/conv_ai_nd_kernel_tuning_utils.cpp.
  • Smoke-test the affected grouped/3D-grouped xdlops convolution solvers via MIOpenDriver on a supported
    architecture (gfx942/gfx950 or gfx90a) to confirm both the AI path (ON) and the fallback path (OFF)
    produce valid kernels.

Test Result

  • Build successful with both MIOPEN_ENABLE_AI_KERNEL_TUNING ON/OFF.

Submission Checklist

The grouped xdlops solvers reference SolverHeuristicConfig and
HeuristicInitState unconditionally (including in the non-AI fallback
path), but the include of ai_conv_nd_kernel_tuning_utils.hpp was gated
behind MIOPEN_ENABLE_AI_KERNEL_TUNING and HeuristicInitState was defined
inside the same guard in the header. With the flag OFF, these symbols
were undeclared and the build failed.

Move the header include outside the guard in the six affected solver
.cpp files and move HeuristicInitState out of the AI-only block in
ai_conv_nd_kernel_tuning_utils.hpp. The struct holds only references
and trivial accessors with no AI-runtime dependency.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@jdcampbe
jdcampbe merged commit e6288c3 into develop Jun 1, 2026
40 checks passed
@jdcampbe
jdcampbe deleted the users/jascampb/ai-tuning-off-build-error branch June 1, 2026 04:19
JonathanLichtnerAMD added a commit that referenced this pull request Jul 15, 2026
JIRA ID: ALMIOPEN-2312

## Motivation

`projects/miopen/CHANGELOG.md`'s "MIOpen 3.5.2 for ROCm 7.14.0" section
only had 4 entries, but 68 commits touched `projects/miopen` between the
`therock-7.13` tag and `release/therock-7.14`. Auditing that commit
range (via `git log --oneline
therock-7.13..remotes/origin/release/therock-7.14 -- projects/miopen`)
found 18 additional user-facing changes — new gfx950/gfx1250
architecture support, SystemDB refreshes, AI-heuristic improvements,
several correctness/crash bug fixes, and OpenCL solver removals — that
were never documented. This PR backfills those entries so the 7.14.0
changelog accurately reflects what shipped.

## Technical Details

Added 24 lines to the existing "MIOpen 3.5.2 for ROCm 7.14.0" section of
`projects/miopen/CHANGELOG.md`, merging new bullets into the existing
`Added`/`Changed`/`Resolved Issues` sub-sections (no new entries were
duplicated or reworded) and adding a new `Removed` sub-section for
solver removals. No existing content was altered.

Each new bullet was traced to a specific commit + PR:

| Entry | Commit | PR |
|---|---|---|
| Added gfx950 (MI350X/MI355X) SystemDB | `60d8e1e5175` | #8081 |
| Added initial gfx1250 architecture support | `d3f057b2f22` | #7587 |
| Added JSON-formatted performance logs (`MIOPEN_PERFORMANCE_LOGS`) |
`ffbde871260` | #5736 |
| Refreshed gfx942 SystemDB | `faf754a9ef6` | #8174 |
| Refined 2D AI heuristics (Tunanet/KTN) for gfx942 & gfx950 |
`c24ad415884` | #7109 |
| Fixed thread-safety issue in AI-heuristic model caches | `cd957402309`
| #9149 (cherry-pick of #9131) |
| Fixed CK grouped-conv solvers not always registered in host |
`c971d54d7ae` | #9105 |
| Fixed legacy CK buffer resource descriptor (gfx1250) | `1dee011b8b0` |
#8758 |
| Removed stale gfx942 SystemDB naive-solver entries | `f42668f6316` |
#7028 |
| Fixed softmax NaN when `beta=0` | `fb8157c8512` | #8426 |
| Fixed BN backward spatial variant 1 vectorized memory access bug |
`1351a7e8b10` | #6765 |
| Fixed use-after-free of `kernel_id` in `InitInvokerFactoryNCHW` |
`394ebffb50d` | #7922 |
| Fixed SoftMarginLoss forward reduce-kernel kernarg corruption |
`1e65a31570f` | #8065, #8135 |
| Fixed build with `MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF` | `e6288c3ca61`
| #6800 |
| Fixed install RPATH for MIOpenDriver / CK backend libs | `ef8a4cf2f93`
| #7485 |
| Fixed dangling lambda causing log-level 6 segfault | `190f9791737` |
#6953 |
| Enabled Windows long-path support for `addkernels` | `1f9d69724cf` |
#7387 |
| Removed OCL solver `ConvOclDirectFwd1x1` | `126c720cadd` | #6491 |
| Removed OCL solver `conv_ocl_dir2Dfwdgen` | `2d499ddf709` | #6633 |
| Removed OCL solvers `ConvOclBwdWrW1x1`, `ConvOclBwdWrW2` |
`b5d43a33dc6` | #6859 |
| Removed OCL solvers `OpTensorLeadingOnes`, `Op5dTensorGeneric` |
`8642c83b7de` | #7347 |

The remaining ~40 commits in the 68-commit range were deliberately
excluded (tests/CI/build/docs/internal refactors/1:1 OCL→HIP swaps with
no behavior change, per each commit's own stated scope) and are not
represented here.

## Risk Assessment

**Risk Level: 🟢 Low**

This is a documentation-only change to a single Markdown file. No code,
build configuration, tests, or public API surface is touched.

### Impacted Components

- `projects/miopen/CHANGELOG.md` only.

### Potential Side Effects

None expected. This does not change any runtime behavior; it only
documents changes that already shipped on `release/therock-7.14`.

### Mitigation Steps

None required beyond normal review — a reviewer familiar with the 7.14
release can spot-check a few entries against the linked commit hashes/PR
numbers for accuracy.

## Test Plan

Not applicable (no code changes). Verification was done by
cross-referencing every added bullet against a specific commit hash and
PR number pulled from `git log`, and by diffing the edited section
against `git show
remotes/origin/release/therock-7.14:projects/miopen/CHANGELOG.md` to
confirm no existing entry was duplicated or altered.

## Test Result

All 21 new bullets map 1:1 to a real commit/PR in the
`therock-7.13..release/therock-7.14` range for `projects/miopen`. No
pre-existing changelog text was modified — `git diff` shows a pure
addition (24 insertions, 0 deletions). Two borderline commits
(`a67834413e8` "Standalone build", `7c7cd5774a9` "enable warnings about
deprecated API/features") were deliberately left out pending author
judgment on whether they warrant an entry.
pschang-phy pushed a commit that referenced this pull request Jul 17, 2026
JIRA ID: ALMIOPEN-2312

## Motivation

`projects/miopen/CHANGELOG.md`'s "MIOpen 3.5.2 for ROCm 7.14.0" section
only had 4 entries, but 68 commits touched `projects/miopen` between the
`therock-7.13` tag and `release/therock-7.14`. Auditing that commit
range (via `git log --oneline
therock-7.13..remotes/origin/release/therock-7.14 -- projects/miopen`)
found 18 additional user-facing changes — new gfx950/gfx1250
architecture support, SystemDB refreshes, AI-heuristic improvements,
several correctness/crash bug fixes, and OpenCL solver removals — that
were never documented. This PR backfills those entries so the 7.14.0
changelog accurately reflects what shipped.

## Technical Details

Added 24 lines to the existing "MIOpen 3.5.2 for ROCm 7.14.0" section of
`projects/miopen/CHANGELOG.md`, merging new bullets into the existing
`Added`/`Changed`/`Resolved Issues` sub-sections (no new entries were
duplicated or reworded) and adding a new `Removed` sub-section for
solver removals. No existing content was altered.

Each new bullet was traced to a specific commit + PR:

| Entry | Commit | PR |
|---|---|---|
| Added gfx950 (MI350X/MI355X) SystemDB | `60d8e1e5175` | #8081 |
| Added initial gfx1250 architecture support | `d3f057b2f22` | #7587 |
| Added JSON-formatted performance logs (`MIOPEN_PERFORMANCE_LOGS`) |
`ffbde871260` | #5736 |
| Refreshed gfx942 SystemDB | `faf754a9ef6` | #8174 |
| Refined 2D AI heuristics (Tunanet/KTN) for gfx942 & gfx950 |
`c24ad415884` | #7109 |
| Fixed thread-safety issue in AI-heuristic model caches | `cd957402309`
| #9149 (cherry-pick of #9131) |
| Fixed CK grouped-conv solvers not always registered in host |
`c971d54d7ae` | #9105 |
| Fixed legacy CK buffer resource descriptor (gfx1250) | `1dee011b8b0` |
#8758 |
| Removed stale gfx942 SystemDB naive-solver entries | `f42668f6316` |
#7028 |
| Fixed softmax NaN when `beta=0` | `fb8157c8512` | #8426 |
| Fixed BN backward spatial variant 1 vectorized memory access bug |
`1351a7e8b10` | #6765 |
| Fixed use-after-free of `kernel_id` in `InitInvokerFactoryNCHW` |
`394ebffb50d` | #7922 |
| Fixed SoftMarginLoss forward reduce-kernel kernarg corruption |
`1e65a31570f` | #8065, #8135 |
| Fixed build with `MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF` | `e6288c3ca61`
| #6800 |
| Fixed install RPATH for MIOpenDriver / CK backend libs | `ef8a4cf2f93`
| #7485 |
| Fixed dangling lambda causing log-level 6 segfault | `190f9791737` |
#6953 |
| Enabled Windows long-path support for `addkernels` | `1f9d69724cf` |
#7387 |
| Removed OCL solver `ConvOclDirectFwd1x1` | `126c720cadd` | #6491 |
| Removed OCL solver `conv_ocl_dir2Dfwdgen` | `2d499ddf709` | #6633 |
| Removed OCL solvers `ConvOclBwdWrW1x1`, `ConvOclBwdWrW2` |
`b5d43a33dc6` | #6859 |
| Removed OCL solvers `OpTensorLeadingOnes`, `Op5dTensorGeneric` |
`8642c83b7de` | #7347 |

The remaining ~40 commits in the 68-commit range were deliberately
excluded (tests/CI/build/docs/internal refactors/1:1 OCL→HIP swaps with
no behavior change, per each commit's own stated scope) and are not
represented here.

## Risk Assessment

**Risk Level: 🟢 Low**

This is a documentation-only change to a single Markdown file. No code,
build configuration, tests, or public API surface is touched.

### Impacted Components

- `projects/miopen/CHANGELOG.md` only.

### Potential Side Effects

None expected. This does not change any runtime behavior; it only
documents changes that already shipped on `release/therock-7.14`.

### Mitigation Steps

None required beyond normal review — a reviewer familiar with the 7.14
release can spot-check a few entries against the linked commit hashes/PR
numbers for accuracy.

## Test Plan

Not applicable (no code changes). Verification was done by
cross-referencing every added bullet against a specific commit hash and
PR number pulled from `git log`, and by diffing the edited section
against `git show
remotes/origin/release/therock-7.14:projects/miopen/CHANGELOG.md` to
confirm no existing entry was duplicated or altered.

## Test Result

All 21 new bullets map 1:1 to a real commit/PR in the
`therock-7.13..release/therock-7.14` range for `projects/miopen`. No
pre-existing changelog text was modified — `git diff` shows a pure
addition (24 insertions, 0 deletions). Two borderline commits
(`a67834413e8` "Standalone build", `7c7cd5774a9` "enable warnings about
deprecated API/features") were deliberately left out pending author
judgment on whether they warrant an entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants