diff options
author | Yunsup Lee <yunsup@cs.berkeley.edu> | 2013-04-29 18:44:21 -0700 |
---|---|---|
committer | Yunsup Lee <yunsup@cs.berkeley.edu> | 2013-04-29 18:44:21 -0700 |
commit | 23507d668862dff15a898f20e109a46c6e95780d (patch) | |
tree | a3b620e117c1ded337e9508042e353c62a1a97a8 /benchmarks/Makefile | |
parent | f8ea498f79ab4d6495f2966d1e5c3dd42f567752 (diff) | |
download | riscv-tests-23507d668862dff15a898f20e109a46c6e95780d.zip riscv-tests-23507d668862dff15a898f20e109a46c6e95780d.tar.gz riscv-tests-23507d668862dff15a898f20e109a46c6e95780d.tar.bz2 |
benchmarks initial commit
Diffstat (limited to 'benchmarks/Makefile')
-rw-r--r-- | benchmarks/Makefile | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/benchmarks/Makefile b/benchmarks/Makefile new file mode 100644 index 0000000..a0ce377 --- /dev/null +++ b/benchmarks/Makefile @@ -0,0 +1,144 @@ +#======================================================================= +# UCB VLSI FLOW: Makefile for riscv-bmarks +#----------------------------------------------------------------------- +# Yunsup Lee (yunsup@cs.berkeley.edu) +# + +default: all + +bmarkdir = . + +instname = riscv-bmarks +instbasedir = $(UCB_VLSI_HOME)/install + +#-------------------------------------------------------------------- +# Sources +#-------------------------------------------------------------------- + +bmarks = \ + median \ + qsort \ + towers \ + vvadd \ + multiply \ + dgemm \ + dhrystone \ + spmv \ + vec-vvadd \ + vec-cmplxmult \ + vec-matmul \ + mt-vvadd \ + mt-matmul \ + +bmarks_host = \ + median \ + qsort \ + towers \ + vvadd \ + multiply \ + dgemm \ + spmv \ + vec-vvadd \ + vec-cmplxmult \ + vec-matmul \ + +#-------------------------------------------------------------------- +# Build rules +#-------------------------------------------------------------------- + +HOST_OPTS = -std=gnu99 -DPREALLOCATE=0 -DHOST_DEBUG=1 +HOST_COMP = gcc $(HOST_OPTS) + +RISCV_GCC = riscv-gcc +RISCV_GCC_OPTS = -std=gnu99 -DSET_STATS -O2 -nostdlib -nostartfiles -ffast-math +RISCV_LINK = riscv-gcc -T $(bmarkdir)/common/test.ld +RISCV_LINK_MT = riscv-gcc -T $(bmarkdir)/common/test-mt.ld +RISCV_LINK_OPTS = -lc +RISCV_LINK_SYSCALL = $(bmarkdir)/common/syscalls.c -lc +RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data +RISCV_SIM = riscv-isa-run + +VPATH += $(addprefix $(bmarkdir)/, $(bmarks)) +VPATH += $(bmarkdir)/common + +incs += -I. -I./common $(addprefix -I$(bmarkdir)/, $(bmarks)) +objs := + +include $(patsubst %, $(bmarkdir)/%/bmark.mk, $(bmarks)) + +#------------------------------------------------------------ +# Build and run benchmarks on riscv simulator + +bmarks_riscv_bin = $(addsuffix .riscv, $(bmarks)) +bmarks_riscv_dump = $(addsuffix .riscv.dump, $(bmarks)) +bmarks_riscv_hex = $(addsuffix .riscv.hex, $(bmarks)) +bmarks_riscv_out = $(addsuffix .riscv.out, $(bmarks)) + +bmarks_defs = -DPREALLOCATE=1 -DHOST_DEBUG=0 +bmarks_cycles = 80000 + +%.hex: % + elf2hex 16 32768 $< > $@ + +$(bmarks_riscv_dump): %.riscv.dump: %.riscv + $(RISCV_OBJDUMP) $< > $@ + +$(bmarks_riscv_out): %.riscv.out: %.riscv + $(RISCV_SIM) $< > $@ + +%.o: %.c + $(RISCV_GCC) $(RISCV_GCC_OPTS) $(bmarks_defs) \ + -c $(incs) $< -o $@ + +%.o: %.S + $(RISCV_GCC) $(RISCV_GCC_OPTS) $(bmarks_defs) \ + -c $(incs) $< -o $@ + +riscv: $(bmarks_riscv_dump) $(bmarks_riscv_hex) +run-riscv: $(bmarks_riscv_out) + echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \ + $(bmarks_riscv_out); echo; + +junk += $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(bmarks_riscv_hex) $(bmarks_riscv_out) + +#------------------------------------------------------------ +# Build and run benchmarks on host machine + +bmarks_host_bin = $(addsuffix .host, $(bmarks_host)) +bmarks_host_out = $(addsuffix .host.out, $(bmarks_host)) + +$(bmarks_host_out): %.host.out: %.host + ./$< > $@ + +host: $(bmarks_host_bin) +run-host: $(bmarks_host_out) + echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \ + $(bmarks_host_out); echo; + +junk += $(bmarks_host_bin) $(bmarks_host_out) + +#------------------------------------------------------------ +# Default + +all: riscv + +#------------------------------------------------------------ +# Install + +date_suffix = $(shell date +%Y-%m-%d_%H-%M) +install_dir = $(instbasedir)/$(instname)-$(date_suffix) +latest_install = $(shell ls -1 -d $(instbasedir)/$(instname)* | tail -n 1) + +install: + mkdir $(install_dir) + cp -r $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(install_dir) + +install-link: + rm -rf $(instbasedir)/$(instname) + ln -s $(latest_install) $(instbasedir)/$(instname) + +#------------------------------------------------------------ +# Clean up + +clean: + rm -rf $(objs) $(junk) |