Repository navigation
dev-kit: make the Peano stack check real; build q4nx with -O3 and the engines' ISA flags - #1085
Merged
Merged
Conversation
check_peano_stack.sh summed the stack frames with `paste -sd+ | bc`. The kernel build image has no bc, so the sum came out empty and every core was treated as having no stack: the check passed without checking anything. Sum the padd [sp] immediates with bash arithmetic instead, and turn every case the script cannot work out into an error rather than a skipped core: a missing llvm-objdump, llvm-nm, grep or awk; no ELF arguments or an ELF that does not exist; objdump or nm failing; a disassembly with no functions; an SP adjustment whose operand is not an immediate; a core that uses stack but has no _sp_start_value_DM_stack or no buffer above it. A core with no SP adjustment at all still has nothing to check. The three copies (generic_decoding_layer, Hy_mem_30BA3B dense_decoding and moe_decoding) stay identical. Hy_MT2_1.8B uses stack_depth.py and has no bc. Co-Authored-By: Claude <noreply@anthropic.com>
detail/q4nx/Makefile was the only engine Makefile without an optimisation level or $(FLM_MARCH): libq4_npu_eXpress.so was built at -O0 without AVX-512, and g++ warned that AVX vector returns in typedef.hpp change the ABI (-Wpsabi). Use -O3 and $(FLM_MARCH) like every sibling Makefile. The Windows CMakeLists already builds it with /O2 /arch:AVX512. -fopenmp and -ffast-math are left out: q4nx has no OpenMP code, and adding -fopenmp would give the library a libgomp dependency it does not need. Co-Authored-By: Claude <noreply@anthropic.com>
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
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.
Stack check.
check_peano_stack.sh(generic_decoding_layer, Hy_mem_30BA3B dense/moe; the three copies stay identical) summed stack frames withpaste -sd+ | bc. The kernel image has nobc, so every core was treated as "no stack" and the check never ran in CI. The sum now uses bash arithmetic. The script also fails loudly on a missing tool, unparsable objdump/nm output, a missing stack symbol or bound, or an empty file list, instead of skipping. A core with no SP adjustment is still skipped.Built locally with the pinned Peano and mlir-aie, for every MODEL_TYPE in
build_units.json: all pass. Nine generic_decoding_layer variants peak at 3904/4096 B (95%, warning). Those are LLAMA_3_1_8B, LLAMA_3_2_3B, PHI4_4B, QWEN3_0_6B/1_7B/4B/8B, QWEN3_ASR_1_7B and QWEN3_ASR_1_7B_MIX. This PR's devkit-xclbins run confirms it in the real image.q4nx flags.
detail/q4nx/Makefile(Linux) was the only engine Makefile without an-Olevel or$(FLM_MARCH), which gave-Wpsabi"AVX vector return without AVX enabled" warnings. It now builds with-O3 $(FLM_MARCH)like the other engines.-fopenmpis left out because q4nx has no OpenMP, and-ffast-mathto keep its float results. The warning is gone and NEEDED is unchanged. The Windows CMake already had/O2 /arch:AVX512.docker/aie-build.Dockerfileandtoolchain.lockare unchanged, so there is no image rebuild.🤖 Generated with Claude Code