[EXTERNAL][MLIR][ExecutionEngine] Guard obj.MLIRRocmExecutionEngineUtils references for static builds#2410
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes CMake configuration failures in pure static builds (BUILD_SHARED_LIBS=OFF) by guarding references to the obj.MLIRRocmExecutionEngineUtils object-library target, which is not created in that configuration. This keeps the shared/default build behavior unchanged while allowing static configurations to configure successfully.
Changes:
- Guard
target_compile_options(obj.MLIRRocmExecutionEngineUtils ...)behindif(TARGET obj.MLIRRocmExecutionEngineUtils). - Guard
target_link_libraries(obj.MLIRRocmExecutionEngineUtils ...)behindif(TARGET obj.MLIRRocmExecutionEngineUtils).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory) · Findings: 0 (0 Critical, 0 Major, 0 Minor)
Scope
Guards the four target_compile_options and the target_link_libraries references to obj.MLIRRocmExecutionEngineUtils in external/llvm-project/mlir/lib/ExecutionEngine/CMakeLists.txt behind if(TARGET obj.MLIRRocmExecutionEngineUtils). The obj.* object-library target only exists when libraries are built shared; a fully-static (BUILD_SHARED_LIBS=OFF) configure previously errored on the unknown target. Sole file changed.
Findings
No blocking issues found.
Notes
- The change is correct and idiomatic:
if(TARGET ...)is the standard CMake guard for conditionally-defined targets, and the new outer guard cleanly wraps the existing innerCXX_SUPPORTS_*checks (lines 467-484) plus the link block (lines 494-498). For the default shared build the target always exists, so the guards are always true and the behavior is unchanged — matching the PR's stated no-op claim for shared builds. - Minor / convention only (non-blocking): the checklist asks for
external/changes to be prefixed[EXTERNAL]. This PR is entirely underexternal/llvm-project/(so it is already isolated from rocMLIR-proper changes, satisfying the "must be separate" intent), but the title is prefixed[MLIR][ExecutionEngine]rather than[EXTERNAL]. Worth aligning the title/commit prefix with the convention, but it does not affect correctness. - This is a CMake/build-configuration change with no source or runtime impact, so the checklist's E2E/Lit/FileCheck test requirements do not apply.
CI status
No failing or cancelled checks in the pre-fetched status (only the in-progress auto-review detect check is present, which is expected).
7f0fc92 to
51d5ba0
Compare
|
Updated to address review feedback:
On the |
…ils references A pure static configuration (BUILD_SHARED_LIBS=OFF) does not create the obj.* object-library targets, but the ROCm execution-engine CMake refers to obj.MLIRRocmExecutionEngineUtils unconditionally -- both for its private -Wno-* compile options and for its hip::host/hip::amdhip64 link libraries. CMake then fails to configure because the target does not exist. Wrap those references in if(TARGET obj.MLIRRocmExecutionEngineUtils) so the object-library target is only touched when it is actually defined. Shared builds still create the target, so the guards are always true there and the change is a no-op; static builds now configure instead of erroring out.
51d5ba0 to
5704c1d
Compare
|
The
@umangyadav could you please re-trigger the |
Triggered re-run |
Resolves the conflict in external/llvm-project/mlir/lib/ExecutionEngine/CMakeLists.txt introduced by develop's AIROCMLIR-939 change (fix dead -Wno-c++98-compat-extra-semi suppression). The obj.MLIRRocmExecutionEngineUtils TARGET guards from this branch are retained and develop's corrected CXX_SUPPORTS_NO_CXX98_COMPAT_EXTRA_SEMI_FLAG check name is adopted. mlir/tools/rocmlir-tuning-driver/CMakeLists.txt is taken from develop.
|
Merged current The conflict was in The resolution keeps the |
|
This PR is green and ready: it is The seven The merge conflict from the AIROCMLIR-939 change has been resolved and the branch is up to date with |
|
Hi @umangyadav — a gentle nudge on this one when you have a moment. It is The 7 stages still showing |
Hi @sudheerdevu would it be possible to create PR on We will merge this PR but it would be good to have this change upstreamed as well. |
|
Thanks @umangyadav, much appreciated on the merge. On upstreaming: I looked into porting this to If you instead meant contributing the One note on CI: this change was fully green on |
Problem
A pure static configuration (
BUILD_SHARED_LIBS=OFF) does not create theobj.*object-library targets. The ROCm execution-engine CMake, however, referencesobj.MLIRRocmExecutionEngineUtilsunconditionally — for its private-Wno-*compile options and for itship::host/hip::amdhip64link libraries. Configuration then fails with an unknown-target error before the build starts.Fix
Guard those references with
if(TARGET obj.MLIRRocmExecutionEngineUtils)so the object-library target is only used when it is actually defined.Impact
BUILD_SHARED_LIBS=OFF.Context
A static build is needed on ROCm 7.13 / gfx115x to avoid duplicate-LLVM symbol interposition between rocMLIR's vendored LLVM and ROCm's
libLLVM/libamd_comgrat runtime. This guard is the only change required to make that configuration build; it is independent of, and harmless to, the default shared build.