Repository navigation
[MIOpen] Fix MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF build in grouped-conv CK solvers - #7338
Closed
amd-bartgips wants to merge 2 commits into
Closed
amd-bartgips wants to merge 2 commits into
amd-bartgips wants to merge 2 commits into
Conversation
Building with MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF failed with "unknown
type name" errors because SolverHeuristicConfig and HeuristicInitState
are declared inside the #if MIOPEN_ENABLE_AI_KERNEL_TUNING guard in
ai_conv_nd_kernel_tuning_utils.hpp, but five solver files used them
unconditionally.
Fix: move the constexpr SolverHeuristicConfig k*SolverConfig declarations
and the HeuristicInitState/state.Reset/state.SetResult usages inside the
#if MIOPEN_ENABLE_AI_KERNEL_TUNING guard in each file. Add an #else branch
with a bare InitValidKernels + DefaultKernelFromList path for the no-AI
case. The ranked_gemm_3d_grp_{bwd,wrw}* vectors stay outside the guard as
they are consumed by DefaultKernelFromList in the #else path.
Verified: clean build with -DMIOPEN_ENABLE_AI_KERNEL_TUNING=OFF (build_bo),
zero errors and zero warnings.
Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Contributor
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
Contributor
Author
|
Already handled in #6800 , closing this one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Building MIOpen with
MIOPEN_ENABLE_AI_KERNEL_TUNING=OFFfailed to compile witherror: unknown type name 'SolverHeuristicConfig'anderror: use of undeclared identifier 'HeuristicInitState'in six grouped-conv CK solverfiles. Both types are declared inside the
#if MIOPEN_ENABLE_AI_KERNEL_TUNINGguard inai_conv_nd_kernel_tuning_utils.hpp(which is itself only#included under that guard),but the solver files used them unconditionally — the
constexpr SolverHeuristicConfig k*SolverConfigdeclaration in each file's anonymous namespace sat outside the guard, andfive of the six files also used
HeuristicInitStateoutside the guard inHeuristicInit().This broke any build configuration that disables AI kernel tuning (e.g. the
build_boconfiguration used for performance profiling without the fdeep/AI dependency).
Related: PR #6834 fixed an analogous guard issue for
MIOPEN_USE_COMPOSABLEKERNEL=OFFinimplicitgemm_ck_util.hpp.Technical Details
Root cause: In all six solver files, the
#includeofai_conv_nd_kernel_tuning_utils.hppis wrapped in#if MIOPEN_ENABLE_AI_KERNEL_TUNING,so
SolverHeuristicConfigandHeuristicInitStateare not declared when the flag isOFF. Theconstexpr SolverHeuristicConfig k*SolverConfigobjects were declared inanonymous namespaces outside that guard, causing the compile failure.
Fix:
constexpr SolverHeuristicConfig k*SolverConfigdeclaration inside a#if MIOPEN_ENABLE_AI_KERNEL_TUNING/#endifblock (together with its enclosinganonymous namespace).
HeuristicInitState state(...),state.Reset(...), andstate.SetResult(...)were also outside the guard, move them inside the existing#ifblock alongsideRunAIHeuristics().#elsebranch that callsInitValidKernels(problem)+DefaultKernelFromList(ctx)directly for the no-AI case. Both functions are definedoutside the guard and already implement the correct fallback behavior.
ranked_gemm_3d_grp_{bwd,wrw}*kernel ranking vectors are intentionally leftoutside the guard — they are used by
DefaultKernelFromListin the new#elsepath.conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cpphadHeuristicInitStatealreadycorrectly inside the guard; only its
k3DFwdSolverConfigdeclaration needed moving.Files changed:
src/solver/conv/conv_hip_implicit_gemm_grouped_fwd_xdlops.cppsrc/solver/conv/conv_hip_implicit_gemm_grouped_bwd_xdlops.cppsrc/solver/conv/conv_hip_implicit_gemm_grouped_wrw_xdlops.cppsrc/solver/conv/conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cppsrc/solver/conv/conv_hip_implicit_gemm_3d_grouped_bwd_xdlops.cppsrc/solver/conv/conv_hip_implicit_gemm_3d_grouped_wrw_xdlops.cppTest Plan
-DMIOPEN_ENABLE_AI_KERNEL_TUNING=OFF— must producezero errors and zero warnings.
-DMIOPEN_ENABLE_AI_KERNEL_TUNING=ON(default) —must produce zero errors and zero warnings (no regression).
#else(no-AI) fallback path callsInitValidKernels+DefaultKernelFromList,which is the same code path taken when the CK library fails to load; this path is
already exercised by existing CI.
Test Results
MIOPEN_ENABLE_AI_KERNEL_TUNING=OFF(build_bo, gfx942, Release)MIOPEN_ENABLE_AI_KERNEL_TUNING=ON(defaultbuild, gfx942, Release)Submission Checklist