AVX-512 First Attempt

This commit is contained in:
[Quy Anh] «Elliot» Nguyen
2026-05-25 00:59:19 +02:00
committed by Linus Baumberger
parent 174d167b9a
commit 7b3d554117
5 changed files with 467 additions and 13 deletions
+16 -9
View File
@@ -47,6 +47,13 @@ CXXFLAGS := -O3 -march=native -std=c++23 -Wall -Wextra -flto
VARIANT ?= baseline
# sleef is only needed for the avx512 variant (used by SLEEF intrinsics there)
ifeq ($(ARCH),x86_64)
ifneq ($(filter avx512_%,$(VARIANT)),)
CXXFLAGS += -lsleef
endif
endif
VARIANT_SRC := ./variants/variant_$(VARIANT).cpp
ifneq ($(filter float_%,$(VARIANT)),)
@@ -95,7 +102,7 @@ ROOFLINE ?= 0
CXXFLAGS += -DROOFLINE=$(ROOFLINE)
# Benchmark suite parameters.
BENCH_SIZES ?= 50 100 200 500 1000 2000 5000 10000
BENCH_SIZES ?= 50 100 200 500 1000
BENCH_ITER ?= 1000
# Verification parameters
@@ -116,7 +123,7 @@ all: main
# make main : compile the main executable with benchmarking disabled.
main: clean
$(CXX) $(CXXFLAGS) $(SRC) -o $(TARGET)
$(CXX) $(SRC) -o $(TARGET) $(CXXFLAGS)
# make run : compile the code and run the simulation without generating a video.
run: main
@@ -137,7 +144,7 @@ verify: main
# make bench : compile the main executable with benchmarking enabled.
bench: CXXFLAGS += -DBENCHMARK=1
bench: clean
$(SUDO_BENCH) $(CXX) $(CXXFLAGS) $(SRC) -o $(TARGET)
$(SUDO_BENCH) $(CXX) $(SRC) -o $(TARGET) $(CXXFLAGS)
# make run-bench : compile and run benchmark measurements.
run-bench: bench
@@ -160,7 +167,7 @@ video: run
# make test : compile and run all unit tests.
test: clean
$(CXX) $(CXXFLAGS) $(TEST_SRC) $(TEST_LIBS) -o $(TEST_TARGET)
$(CXX) $(TEST_SRC) $(TEST_LIBS) -o $(TEST_TARGET) $(CXXFLAGS)
./$(TEST_TARGET)
# make asm : compile and generate assembly files.
@@ -172,19 +179,19 @@ ASM_SRCS := $(ASM_CPP_SRCS) $(ASM_HPP_SRCS)
ASM_TARGETS := $(patsubst %.cpp,%.s,$(patsubst %.hpp,%.s,$(ASM_SRCS)))
asm: clean
$(foreach src,$(ASM_CPP_SRCS),$(CXX) -O3 -march=native -std=c++23 -Wall -Wextra -DRANDOM_SEED=$(RANDOM_SEED) -S $(src) -o $(src:.cpp=.s); )
$(foreach src,$(ASM_HPP_SRCS),$(CXX) -O3 -march=native -std=c++23 -Wall -Wextra -DRANDOM_SEED=$(RANDOM_SEED) -x c++ -S $(src) -o $(src:.hpp=.s); )
$(foreach src,$(ASM_CPP_SRCS),$(CXX) -S $(src) -o $(src:.cpp=.s) $(CXXFLAGS); )
$(foreach src,$(ASM_HPP_SRCS),$(CXX) -x c++ -S $(src) -o $(src:.hpp=.s) $(CXXFLAGS); )
%.s: %.cpp $(HEADERS)
$(CXX) -O3 -march=native -std=c++23 -Wall -Wextra -DRANDOM_SEED=$(RANDOM_SEED) -S $< -o $@
$(CXX) -S $< -o $@ $(CXXFLAGS)
# make clean : delete generated files from previous builds.
clean:
rm -f main_* $(TEST_TARGET) *.o *.s
rm -f main_* $(SIZES_TARGET) $(TEST_TARGET) *.o *.s variants/*.s variants/*.o headers/*.s headers/*.o
# make clean-all : delete all generated files from previous builds and runs.
# WARNING: this deletes all *.csv and *.mp4 files in this directory.
# Move any output files you want to keep to another directory before running it.
clean-all: clean
rm -f *.csv *.mp4
rm -f *.csv *.mp4