Add option to skip kernel build in op_test build_mha.sh#2181
Add option to skip kernel build in op_test build_mha.sh#2181
Conversation
There was a problem hiding this comment.
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=1option to skip runningcompile.pyinbuild_mha.sh. - Continue to the existing link steps to produce
fwd.exe/bwd.exeeven when the compile step is skipped.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "######## building mha kernels $FMA_API" | ||
| python3 compile.py --api=$FMA_API |
There was a problem hiding this comment.
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).
| if [ x"$AITER_TEST_SKIP_BUILD" = x"1" ]; then | ||
| echo "######## skipping build of mha kernels $FMA_API" | ||
| else |
There was a problem hiding this comment.
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.
Motivation
Often times we'll use the generated
{f, b}wd.exeprograms to isolate specific kernels and validate TE's AITER integration. In doing so, we usually prefer to use existing pre-builtlibmha_{f, b}wd.solibraries. 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.pyinbuild_mha.shby settingAITER_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