-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.template
192 lines (143 loc) · 8.57 KB
/
Makefile.template
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
include $(SRCDIR)/Make.conf # compiler paths and flags
include $(SRCDIR)/Makefile.common # build rules
# enumerate files to be compiled from user declared UNROLL1_GCC, UNROLL2_CLANG, .... variables
UNROLL_FACTORS := 1 2 4 8 16 32 64
COMPILERS := GCC CLANG ICC ICX ACK GPP CLANGPP ICPC ICPX
templ_unroll_compiler = UNROLL$(u)_$(compiler)
PROGS_EQCHECKER_GCC := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,GCC, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_CLANG := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,CLANG, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ICC := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,ICC, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ICX := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,ICX, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ACK := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,ACK, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_GPP := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,GPP, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_CLANGPP := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,CLANGPP, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ICPC := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,ICPC, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ICPX := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,ICPX, $($(templ_unroll_compiler))))
PROGS_EQCHECKER_ALL := $(foreach u,$(UNROLL_FACTORS),$(foreach compiler,$(COMPILERS),$($(templ_unroll_compiler))))
# PROGS_UNROLL_CUR_COMPILER specifies command line for gen_eqtest_cmds.pl in the form "unroll1 <unroll1_progs> unroll2 <unroll1_progs> ..."
# specific to CUR_COMPILER and evaluated on demand (note = vs :=)
PROGS_UNROLL_CUR_COMPILER = $(foreach u,$(UNROLL_FACTORS),unroll$(u) $(UNROLL$(u)_$(CUR_COMPILER)))
PROGS_UNROLL_CLANGV = $(foreach u,$(UNROLL_FACTORS),unroll$(u) $(UNROLL$(u)_CLANG))
EQCHECKER_BC32_PROGS := $(foreach opt,O0 O3,$(addsuffix .bc32.eqchecker.$(opt), $(PROGS_EQCHECKER_ALL)))
EQCHECKER_BC64_PROGS := $(foreach opt,O0 O3,$(addsuffix .bc64.eqchecker.$(opt), $(PROGS_EQCHECKER_ALL)))
EQCHECKER_BC32_O3cg_PROGS = $(addsuffix .bc32.eqchecker.O3.cg, $(PROGS_EQCHECKER_ALL))
EQCHECKER_BC64_O3cg_PROGS = $(addsuffix .bc64.eqchecker.O3.cg, $(PROGS_EQCHECKER_ALL))
OPTS := O0 O1 O2 O3
EQCHECKER_I386_GCC_PROGS := $(foreach opt,$(OPTS),$(addsuffix .gcc.eqchecker.$(opt).i386.s, $(PROGS_EQCHECKER_GCC)))
EQCHECKER_X64_GCC_PROGS := $(foreach opt,$(OPTS),$(addsuffix .gcc.eqchecker.$(opt).x64.s, $(PROGS_EQCHECKER_GCC)))
EQCHECKER_I386_CLANG_PROGS := $(foreach opt,$(OPTS),$(addsuffix .clang.eqchecker.$(opt).i386.s, $(PROGS_EQCHECKER_CLANG)))
EQCHECKER_X64_CLANG_PROGS := $(foreach opt,$(OPTS),$(addsuffix .clang.eqchecker.$(opt).x64.s, $(PROGS_EQCHECKER_CLANG)))
EQCHECKER_I386_ICC_PROGS := $(foreach opt,$(OPTS),$(addsuffix .icc.eqchecker.$(opt).i386.s, $(PROGS_EQCHECKER_ICC)))
EQCHECKER_X64_ICC_PROGS := $(foreach opt,$(OPTS),$(addsuffix .icc.eqchecker.$(opt).x64.s, $(PROGS_EQCHECKER_ICC)))
EQCHECKER_I386_ICX_PROGS := $(foreach opt,$(OPTS),$(addsuffix .icx.eqchecker.$(opt).i386.s, $(PROGS_EQCHECKER_ICX)))
EQCHECKER_X64_ICX_PROGS := $(foreach opt,$(OPTS),$(addsuffix .icx.eqchecker.$(opt).x64.s, $(PROGS_EQCHECKER_ICX)))
EQCHECKER_I386_ACK_PROGS := $(foreach opt,O1 O2,$(addsuffix .ack.$(opt).i386, $(PROGS_EQCHECKER_ACK)))
EQCHECKER_I386_CCOMP_PROGS := $(foreach opt,O0 O2,$(addsuffix .ccomp.eqchecker.$(opt).i386, $(PROGS_EQCHECKER_CCOMP)))
PROGS_LL_BC = $(addsuffix .bc, $(PROGS_LL))
BC_PROGS = \
$(EQCHECKER_BC32_PROGS) \
$(EQCHECKER_BC64_PROGS)
BC_PROGS_ASM = $(addsuffix .ll, $(BC_PROGS))
EQCHECKER_I386_PROGS = \
$(EQCHECKER_I386_GCC_PROGS) \
$(EQCHECKER_I386_CLANG_PROGS) \
$(EQCHECKER_I386_ICC_PROGS) \
$(EQCHECKER_I386_ICX_PROGS) \
EQCHECKER_X64_PROGS = \
$(EQCHECKER_X64_GCC_PROGS) \
$(EQCHECKER_X64_CLANG_PROGS) \
$(EQCHECKER_X64_ICC_PROGS) \
$(EQCHECKER_X64_ICX_PROGS) \
EQCHECKER_PROGS = \
$(BC_PROGS) \
$(EQCHECKER_I386_PROGS) \
$(EQCHECKER_X64_PROGS) \
ACK_EQCHECKER_PROGS = \
$(EQCHECKER_I386_ACK_PROGS) \
ALL_PROGS = $(EQCHECKER_PROGS) $(BC_PROGS_ASM) $(PROGS_LL_BC)
EQFLAGS_FILES := $(wildcard $(VPATH)/*.eqflags)
# targets
all: $(ALL_PROGS)
ack-progs: $(ACK_EQCHECKER_PROGS)
eqtest_%.helper:: $(ALL_PROGS) $(SRCDIR)/Makefile.template $(SRCDIR)/scripts/gen_eqtest_cmds.pl $(VPATH)/Makefile Makefile $(EQFLAGS_FILES)
perl $(SRCDIR)/scripts/gen_eqtest_cmds.pl eqcheck $@ $(SUPEROPT_PROJECT_DIR) $(VPATH) $(ARCH) $(shell echo $(CUR_COMPILER) | tr A-Z a-z) $(OPT_LEVEL) "extraflags@$(EXTRA_FLAGS) $(EXTRA_FLAGS_$(CUR_COMPILER))" "expectedfails@$(EXPECTED_FAILS_$(CUR_COMPILER))" "cc-opts@$(CC_OPTS)" $(PROGS_UNROLL_CUR_COMPILER)
eqtest_%_gcc.helper:: CUR_COMPILER=GCC
eqtest_%_gPP.helper:: CUR_COMPILER=GPP
eqtest_%_clang.helper:: CUR_COMPILER=CLANG
eqtest_%_clangPP.helper:: CUR_COMPILER=CLANGPP
eqtest_%_icc.helper:: CUR_COMPILER=ICC
eqtest_%_icpc.helper:: CUR_COMPILER=ICPC
eqtest_%_icx.helper:: CUR_COMPILER=ICX
eqtest_%_icpx.helper:: CUR_COMPILER=ICPX
eqtest_%_ack.helper:: CUR_COMPILER=ACK
eqtest_%_ack.helper:: OPT_LEVEL=O2
eqtest_%_ack.O1.helper:: CUR_COMPILER=ACK
eqtest_%_ack.O1.helper:: OPT_LEVEL=O1
eqtest_i386_O0:: ARCH=i386
eqtest_i386_O0:: OPT_LEVEL=O0
eqtest_i386_O1:: ARCH=i386
eqtest_i386_O1:: OPT_LEVEL=O1
eqtest_i386_O2:: ARCH=i386
eqtest_i386_O2:: OPT_LEVEL=O2
eqtest_i386_O3:: ARCH=i386
eqtest_i386_O3:: OPT_LEVEL=O3
eqtest_x64_O0:: ARCH=x64
eqtest_x64_O0:: OPT_LEVEL=O0
eqtest_x64_O1:: ARCH=x64
eqtest_x64_O1:: OPT_LEVEL=O1
eqtest_x64_O2:: ARCH=x64
eqtest_x64_O2:: OPT_LEVEL=O2
eqtest_x64_O3:: ARCH=x64
eqtest_x64_O3:: OPT_LEVEL=O3
# use .c/.ll files directly
eqtest_srcdst.helper:: CUR_COMPILER=SRCDST
eqtest_srcdst.helper:: ARCH=i386 #use i386 build for src-dst checks
eqtest_srcdst.helper:: OPT_LEVEL=notused
# XXX not required?
eqtest_ll.helper:: CUR_COMPILER=LL
eqtest_ll.helper:: ARCH=x64 #we use the x64 build for llvm-to-llvm checks
eqtest_ll.helper:: OPT_LEVEL=ll
clangv_O0:: OPT_LEVEL=O0
clangv_O1:: OPT_LEVEL=O1
clangv_O2:: OPT_LEVEL=O2
clangv_O3:: OPT_LEVEL=O3
clangv_O1-:: OPT_LEVEL=O1-
clangv_O0 clangv_O1 clangv_O2 clangv_O3 clangv_O1-::
perl $(SRCDIR)/scripts/gen_eqtest_cmds.pl clangv $@ $(SUPEROPT_PROJECT_DIR) $(VPATH) $(ARCH) $(OPT_LEVEL) "extraflags@$(EXTRA_FLAGS) $(EXTRA_FLAGS_CLANGV)" "expectedfails@$(EXPECTED_FAILS_CLANGV)" "cc-opts@$(CC_OPTS)" $(PROGS_UNROLL_CLANGV)
eqtest_i386_O0 eqtest_i386_O1 eqtest_i386_O2 eqtest_i386_O3 eqtest_x64_O0 eqtest_x64_O1 eqtest_x64_O2 eqtest_x64_O3: eqtest_%: eqtest_%_gcc.helper eqtest_%_gPP.helper eqtest_%_clang.helper eqtest_%_clangPP.helper eqtest_%_ack.helper eqtest_%_ack.O1.helper eqtest_%_icx.helper eqtest_%_icpx.helper eqtest_%_icc.helper eqtest_%_icpc.helper
cat $^ > $@
eqtest_i386 eqtest_x64: eqtest_%: eqtest_%_O0 eqtest_%_O1 eqtest_%_O2 eqtest_%_O3
cat $^ > $@
eqtest_ll eqtest_srcdst: eqtest_%: eqtest_%.helper
cat $^ > $@
eqtest: eqtest_i386 eqtest_x64 eqtest_srcdst eqtest_ll
cat $^ > $@
.DEFAULT_GOAL := all
clean:
rm -f *.o *.tmp eqtest* test_i386 $(ALL_PROGS)
BENCH_NAME := $(shell basename $(VPATH))
BENCH_RUN_LOGS_DIR := $(addprefix logs_, $(BENCH_NAME))
ARCHIVE_PREFIX := last_eqrun
ARCHIVE_LAST := $(ARCHIVE_PREFIX)
ARCHIVE_FNAME := $(shell sh $(SUPEROPT_PROJECT_DIR)/superopt/utils/next_avail_fname.sh $(ARCHIVE_PREFIX))
.PHONY: collect_logs
collect_logs:
find -path './eqcheck*/submit*/stdout' -exec python3 $(SUPEROPT_PROJECT_DIR)/superopt/utils/eq_read_log.py {} \; > $(ARCHIVE_FNAME)
ln -sf $(ARCHIVE_FNAME) $(ARCHIVE_LAST)
.PHONY: archive_run
archive_run: collect_logs
find . -type f -path "./eqcheck*" ! -name "*.xml" -print0 | apack -0 $(ARCHIVE_FNAME).zip
ln -sf $(ARCHIVE_FNAME).zip $(ARCHIVE_LAST).zip
csv_%_helper:
@find -path './$(CSV_MATCH_PREFIX)$(CSV_MATCH_TAIL)/submit*/stdout' | python3 ${SUPEROPT_PROJECT_DIR}/superopt/utils/gen_stats -stdin -o $(subst _helper,,$@).csv
csv_%_gcc_O3_helper:: CSV_MATCH_TAIL=.gcc.eqchecker.O3*
csv_%_clang_O1_helper:: CSV_MATCH_TAIL=.clang.eqchecker.O1*
csv_%_clang_O2_helper:: CSV_MATCH_TAIL=.clang.eqchecker.O2*
csv_%_clang_O3_helper:: CSV_MATCH_TAIL=.clang.eqchecker.O3*
csv_%_icc_O3_helper:: CSV_MATCH_TAIL=.icc.eqchecker.O3*
csv_%_clangv_helper:: CSV_MATCH_TAIL=.O1-
csv_eqcheck_normal_%_helper:: CSV_MATCH_PREFIX=eqcheck.*
# csv_eqcheck_slow_%_helper:: CSV_MATCH_PREFIX=eqcheck_slow.*
csv_eqcheck_clangv_helper:: CSV_MATCH_PREFIX=clangv.*
csv_eqcheck_normal_gcc_O3 csv_eqcheck_normal_clang_O3 csv_eqcheck_normal_icc_O3 csv_eqcheck_normal_clang_O1 csv_eqcheck_normal_clang_O2 csv_eqcheck_clangv: %: %_helper # csv_eqcheck_slow_gcc_O3 csv_eqcheck_slow_clang_O3 csv_eqcheck_slow_icc_O3
.PHONY: all clean