forked from intel/cppnnml
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (61 loc) · 2.18 KB
/
Copy pathMakefile
File metadata and controls
73 lines (61 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Phase 14 perf matrix example.
#
# Builds the same int8 block under several SIMD gate combinations on the
# build host (x86 here) and runs each binary to emit a CSV row. The
# checksum column doubles as a bit-exactness regression: a non-scalar
# row with a different checksum than the scalar row indicates a broken
# SIMD backend.
#
# Cross-compiled backends (NEON, NEON-DOTPROD, SVE, Helium MVE) are not
# built here by default — they need the matching toolchain. Add a
# target per cross-compiler as needed.
MKDIR=mkdir -p ./output
CC=g++
WARN=-Wall -Wextra -Werror -Wpedantic
SOURCES=perf_matrix.cpp
INCLUDES=-I../../cpp -I../../cpp/include -I../../include/
DEFINES=-DTINYMIND_ENABLE_QUANTIZATION=1
OPT=-O3
OUT_SCALAR=./output/perf_matrix_scalar
OUT_AVX2=./output/perf_matrix_avx2
OUT_AVX512F=./output/perf_matrix_avx512f
OUT_AVX512_VNNI=./output/perf_matrix_avx512_vnni
OUT_REPORT=./output/perf_report.csv
.PHONY: default all scalar avx2 avx512f avx512_vnni report clean
default: scalar avx2 avx512f avx512_vnni
all: default
scalar:
$(MKDIR)
$(CC) $(OPT) $(WARN) -o $(OUT_SCALAR) $(SOURCES) $(INCLUDES) $(DEFINES)
avx2:
$(MKDIR)
$(CC) $(OPT) $(WARN) -mavx2 -mssse3 -o $(OUT_AVX2) $(SOURCES) $(INCLUDES) $(DEFINES) -DTINYMIND_ENABLE_SIMD_AVX2=1
avx512f:
$(MKDIR)
$(CC) $(OPT) $(WARN) -mavx512f -mavx512bw -o $(OUT_AVX512F) $(SOURCES) $(INCLUDES) $(DEFINES) -DTINYMIND_ENABLE_SIMD_AVX512F=1
avx512_vnni:
$(MKDIR)
$(CC) $(OPT) $(WARN) -mavx512f -mavx512bw -mavx512vnni -o $(OUT_AVX512_VNNI) $(SOURCES) $(INCLUDES) $(DEFINES) -DTINYMIND_ENABLE_SIMD_AVX512F=1 -DTINYMIND_ENABLE_SIMD_AVX512_VNNI=1
# Run every binary that exists and concatenate their CSV rows. Header is
# emitted once.
report: default
@$(MKDIR)
@true > $(OUT_REPORT)
@printed_header=0; \
for b in $(OUT_SCALAR) $(OUT_AVX2) $(OUT_AVX512F) $(OUT_AVX512_VNNI); do \
if [ -x $$b ]; then \
out=$$($$b); \
if [ $$printed_header -eq 0 ]; then \
echo "$$out" >> $(OUT_REPORT); \
printed_header=1; \
else \
echo "$$out" | tail -n +2 >> $(OUT_REPORT); \
fi; \
fi; \
done
@cat $(OUT_REPORT)
run: report
clean:
rm -f ./output/*
plot: report
python3 plot.py