Skip to content

Add option to skip kernel build in op_test build_mha.sh#2181

Closed
Micky774 wants to merge 1 commit intomainfrom
zain/skip-compile
Closed

Add option to skip kernel build in op_test build_mha.sh#2181
Micky774 wants to merge 1 commit intomainfrom
zain/skip-compile

Conversation

@Micky774
Copy link
Copy Markdown
Contributor

@Micky774 Micky774 commented Mar 4, 2026

Motivation

Often times we'll use the generated {f, b}wd.exe programs to isolate specific kernels and validate TE's AITER integration. In doing so, we usually prefer to use existing pre-built libmha_{f, b}wd.so libraries. This addition makes it so we can directly skip building the libraries while still easily building {f, b}wd.exe.

Technical Details

Adds an option to skip running compile.py in build_mha.sh by setting AITER_TEST_SKIP_BUILD=1. It is not set by default, hence this change is backwards compatible.

Test Plan

N/A

Test Result

N/A

Submission Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a build-time switch for the MHA op test harness to optionally skip compiling the MHA kernel shared libraries while still producing the {f,b}wd.exe benchmarks, supporting workflows that rely on prebuilt libmha_{f,b}wd.so.

Changes:

  • Add AITER_TEST_SKIP_BUILD=1 option to skip running compile.py in build_mha.sh.
  • Continue to the existing link steps to produce fwd.exe / bwd.exe even when the compile step is skipped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +17
echo "######## building mha kernels $FMA_API"
python3 compile.py --api=$FMA_API
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 compile.py is invoked via a relative path before SCRIPT_DIR is computed. If this script is run from outside op_tests/cpp/mha/, the build step will fail because compile.py won’t be found. Consider computing SCRIPT_DIR at the top and invoking python3 "$SCRIPT_DIR/compile.py" --api="$FMA_API" (also quoting $FMA_API to avoid word-splitting).

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +15
if [ x"$AITER_TEST_SKIP_BUILD" = x"1" ]; then
echo "######## skipping build of mha kernels $FMA_API"
else
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When AITER_TEST_SKIP_BUILD=1, the script proceeds to linking but doesn’t validate that the expected prebuilt libraries exist in $SCRIPT_DIR (e.g., libmha_fwd.so / libmha_bwd.so). Skipping the check can lead to a confusing hipcc: cannot find -lmha_* error; consider checking for the required .so files based on FMA_API and exiting with a clear message if they’re missing.

Copilot uses AI. Check for mistakes.
@Micky774 Micky774 closed this Mar 26, 2026
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