-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (42 loc) · 1.37 KB
/
Copy pathMakefile
File metadata and controls
56 lines (42 loc) · 1.37 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
NVCC = nvcc
ARCHS = 75 80 86
GENCODE = $(foreach a,$(ARCHS),-gencode arch=compute_$(a),code=sm_$(a))
FLAGS = -O3 $(GENCODE) -Xcompiler -fopenmp -lgomp
SRC = memtest mmvq_bench arithmtest arithmtest_gen
all: $(addprefix bin/,$(SRC)) bin/mmvq_bench_nodp4a bin/mmvq_bench_dp2a_prmt bin/mmvq_bench_dp2a_wide ptx
# ---- binaries ----
bin/%: src/%.cu | bin
$(NVCC) $(FLAGS) -o $@ $<
bin/mmvq_bench_nodp4a: src/mmvq_bench.cu | bin
$(NVCC) $(FLAGS) -DDISABLE_DP4A -o $@ $<
# old mmvq_bench_dp2a (-DDP4A_REPL_DP2A) removed: its int8->int16 repack was
# numerically wrong (packed two s8 into one s16 lane). Replaced by:
bin/mmvq_bench_dp2a_prmt: src/mmvq_bench.cu | bin
$(NVCC) $(FLAGS) -DDP2A_PRMT -o $@ $<
bin/mmvq_bench_dp2a_wide: src/mmvq_bench.cu | bin
$(NVCC) $(FLAGS) -DDP2A_WIDE_ACT -o $@ $<
# ---- PTX targets ----
# Generate explicit rules for each (source, arch) pair
define ptx_rule
ptx_dump/$(1)_sm$(2).ptx: src/$(1).cu | ptx_dump
$(NVCC) -O3 -gencode arch=compute_$(2),code=compute_$(2) -ptx -o $$@ $$<
endef
# Create all PTX targets and their rules
PTX_TARGETS :=
$(foreach s,$(SRC),\
$(foreach a,$(ARCHS),\
$(eval $(call ptx_rule,$(s),$(a)))\
$(eval PTX_TARGETS += ptx_dump/$(s)_sm$(a).ptx)\
)\
)
ptx: $(PTX_TARGETS)
# directories
bin:
mkdir -p bin
ptx_dump:
mkdir -p ptx_dump
# misc
gen: gen_arithm.py
python gen_arithm.py --gen-only
clean:
rm -f bin/* ptx_dump/*