From 10776fecdc1c0856a6cb706748e58c02c0df5aa8 Mon Sep 17 00:00:00 2001 From: Farrah Chen Date: Wed, 2 Sep 2026 16:00:04 +0800 Subject: [PATCH] BM/amx: add FP16 (TDPFP16PS) functional test list Add a dedicated tests-fp16 list that exercises the AMX FP16 matrix multiply instruction (TDPFP16PS) via the tmul binary's instruction type 5. It covers the context-switch break scenarios (yield, sleep, trap, futex) plus a signal-break run, mirroring the coverage the other TMUL instruction types already have. TDPFP16PS support requires the tmul binary to be built with FP16 enabled ("make fp16", gcc 13.3 or above), so the cases are kept in a separate list whose header documents the build and hardware requirements. Co-authored-by: GitHub Copilot Signed-off-by: Farrah Chen (cherry picked from commit 4cc3937706812c81b74910a38b90847f69f540d8) --- BM/amx/tests-fp16 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 BM/amx/tests-fp16 diff --git a/BM/amx/tests-fp16 b/BM/amx/tests-fp16 new file mode 100644 index 00000000..f47188e3 --- /dev/null +++ b/BM/amx/tests-fp16 @@ -0,0 +1,32 @@ +# This file collects the AMX(Advanced Matrix eXtension) FP16 (TDPFP16PS) +# instruction tests on IntelĀ® Architecture-based platforms. +# The tmul binary must be built with FP16 support ("make fp16") so that the +# TDPFP16PS instruction type (-i 5) is available. FP16 support requires +# gcc 13.3 or above (some distros backport it to gcc 12.3). +# @hw_dep: cpuid_check 7 0 0 0 d 24 @ CPU doesn't support AMX-TILE - CPUID.(7.0).EDX[24] +# @hw_dep: cpuid_check 7 0 1 0 a 21 @ CPU doesn't support AMX-FP16 - CPUID.(7.1).EAX[21] +# @hw_dep: cpuid_check d 0 1 0 a 4 @ CPU doesn't support AMX XFD - CPUID.(d.1).EAX[4] +# @other_warn: echo 'int main() { asm volatile("tdpfp16ps %tmm2, %tmm1, %tmm0"); return 0; }' | gcc -x c -o /dev/null - \ +# @ gcc no support AMX_FP16 ins., refer to README for compile option, amx_fp16 related tests can't be executed + +# Usage:./tmul [OPTIONS] +# -b, --break-reason [1 - 5] +# 0: break by nothing +# 1: break by yield +# 2: break by sleep +# 3: break by trap +# 4: break by signal +# 5: break by futex +# -t, --thread-count [Should not be less than 1] +# -c, --cycle-number [Should not be less than 1] +# -i, --instruction-type [0:TDPBF16PS 1:TDPBSSD 2:TDPBSUD 3:TDPBUSD 4:TDPBUUD 5:TDPFP16PS] + +# functional tests +tmul -b 0 -t 10 -c 10 -i 5 +tmul -b 1 -t 10 -c 10 -i 5 +tmul -b 2 -t 10 -c 10 -i 5 +tmul -b 3 -t 10 -c 10 -i 5 +tmul -b 5 -t 10 -c 10 -i 5 + +# signal break test +tmul -b 4 -t 10 -c 100000 -i 5