Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ check_static:
.PHONY: check_license
check_license:
@echo "Confirming source files have license headers..."
@for f in `find . -type f ! -path './perfspect_202*' ! -path './tools/bin/*' ! -path './internal/script/resources/*' ! -path './scripts/.venv/*' ! -path './test/output/*' ! -path './debug_out/*' ! -path './tools/perf-archive/*' \( -name "*.go" -o -name "*.s" -o -name "*.html" -o -name "Makefile" -o -name "*.sh" -o -name "*.Dockerfile" -o -name "*.py" \)`; do \
@for f in `find . -type f ! -path './perfspect_202*' ! -path './tools/bin/*' ! -path './internal/script/resources/*' ! -path './scripts/.venv/*' ! -path './test/output/*' ! -path './debug_out/*' ! -path './tools/perf-archive/*' ! -path './tools/avx-turbo/*' \( -name "*.go" -o -name "*.s" -o -name "*.html" -o -name "Makefile" -o -name "*.sh" -o -name "*.Dockerfile" -o -name "*.py" \)`; do \
if ! grep -E 'SPDX-License-Identifier: BSD-3-Clause' "$$f" >/dev/null; then echo "Error: license not found: $$f"; fail=1; fi; \
done; if [ -n "$$fail" ]; then exit 1; fi

Expand Down
8 changes: 1 addition & 7 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,8 @@ endif
tar -xf async-profiler-$(ASYNC_PROFILER_VERSION)-linux-x64.tar.gz && mv async-profiler-$(ASYNC_PROFILER_VERSION)-linux-x64 async-profiler
endif

AVX_TURBO_VERSION := "threadcpuid"
# Use a local copy of avx-turbo source until the upstream makes the required changes
avx-turbo:
ifeq ("$(wildcard avx-turbo)","")
git clone https://github.com/harp-intel/avx-turbo.git
else
cd avx-turbo && git checkout master && git pull
endif
cd avx-turbo && git checkout $(AVX_TURBO_VERSION) && git pull
cd avx-turbo && make

# if you change the version, check the sed hacks below
Expand Down
39 changes: 39 additions & 0 deletions tools/avx-turbo/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
cpp_compiler: [g++, g++-7, g++-8, g++-9, clang++, clang++-9]
include:
- c_compiler: gcc
- cpp_compiler: g++-7
c_compiler: gcc-7
- cpp_compiler: g++-8
c_compiler: gcc-8
- cpp_compiler: g++-9
c_compiler: gcc-9
- cpp_compiler: clang++
c_compiler: clang
- cpp_compiler: clang++-9
c_compiler: clang-9
steps:
- name: Install C Compiler
if: ${{ startsWith(matrix.c_compiler, 'gcc-') || startsWith(matrix.c_compiler, 'clang-') }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.c_compiler }}
- name: Install C++ Compiler
if: ${{ startsWith(matrix.cpp_compiler, 'g++-') || startsWith(matrix.cpp_compiler, 'clang++-') }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.cpp_compiler }}
- uses: actions/checkout@v2
- run: lscpu
- run: make -j2 CC=${{ matrix.c_compiler }} CXX=${{ matrix.cpp_compiler }}
- run: ./unit-test
- run: ./avx-turbo --no-pin --max-threads 2

59 changes: 59 additions & 0 deletions tools/avx-turbo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
avx-turbo
unit-test

# Eclipse CDT artifacts
.cproject
.project
.settings

# nasm listing file
*.list

# libpfm4 directory
libpfm-4*/*

# core files
/core*
/vgcore*

# perf files
/perf.*

/tmp/*

dummy.rebuild

# local make config file
local.mk
70 changes: 70 additions & 0 deletions tools/avx-turbo/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
dist: xenial
language: cpp
sudo: false
branches:
except:
- /^(wip\/)?(appveyor|msvc|mingw|windows)(\-.+)?$/

addons:
apt:
sources: &default_sources
- ubuntu-toolchain-r-test

# the anchors element doesn't do anything but itself except define some anchors to be used later as aliases
anchors:
- &unit_command ./unit-test
- &uarch_command ./uarch-bench --test-tag=~slow

matrix:
include:
# clang-5.0 is the default installed on travis VMs
- compiler: clang-default
env: TRUE_CC=clang TRUE_CXX=clang++ CXXFLAGS=-stdlib=libc++
addons:
apt:
sources:
- *default_sources
- llvm-toolchain-trusty-5.0
packages:
- libc++abi1
- libc++1
- compiler: gcc-4.9
env: TRUE_CC=gcc-4.9 TRUE_CXX=g++-4.9
addons:
apt:
sources:
- *default_sources
packages:
- gcc-4.9
- g++-4.9
- compiler: gcc-6
env: TRUE_CC=gcc-6 TRUE_CXX=g++-6
addons:
apt:
sources:
- *default_sources
packages:
- gcc-6
- g++-6
- compiler: clang-6.0
env: TRUE_CC=clang-6.0 TRUE_CXX=clang++-6.0
addons:
apt:
sources:
- *default_sources
- llvm-toolchain-xenial-6.0
packages:
- clang-6.0
- clang++-6.0

before_install:
# Travis will set CC and CXX after the env commands specified in the matrix are run, overwriting whatever
# we've specified there, so we need to reset them here. See also https://github.com/travis-ci/travis-ci/issues/6633 .
- CC="${TRUE_CC:-$CC}"
- CXX="${TRUE_CXX:-$CXX}"


script:
- set -e && echo "CC is ${CC}, CXX is ${CXX}" && ${CC} --version && ${CXX} --version
- make
- ./avx-turbo --no-pin --max-threads 2
21 changes: 21 additions & 0 deletions tools/avx-turbo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 travisdowns

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions tools/avx-turbo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
include config.mk

# rebuild when makefile changes
-include dummy.rebuild

.PHONY: all clean

ASM_FLAGS ?= -DNASM_ENABLE_DEBUG=$(NASM_DEBUG) -w+all -l x86_methods.list

ifneq ($(CPU_ARCH),)
ARCH_FLAGS := -march=$(CPU_ARCH)
endif
O_LEVEL ?= -O2

COMMON_FLAGS := -MMD -Wall -Wextra -Wundef $(ARCH_FLAGS) -g $(O_LEVEL)
CPPFLAGS := $(COMMON_FLAGS)
CFLAGS := $(COMMON_FLAGS)

SRC_FILES := $(wildcard *.cpp) $(wildcard *.c)

OBJECTS := $(SRC_FILES:.cpp=.o) asm-methods.o
OBJECTS := $(OBJECTS:.c=.o)
DEPFILES = $(OBJECTS:.o=.d)
# $(info OBJECTS=$(OBJECTS))

VPATH = test

###########
# Targets #
###########

all: avx-turbo unit-test

-include $(DEPFILES) unit-test.d

clean:
rm -f *.d *.o avx-turbo

dist-clean: clean $(CLEAN_TARGETS)

unit-test: unit-test.o unit-test-main.o cpuid.o
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) -std=c++11 $^ -o $@

avx-turbo: $(OBJECTS)
$(CXX) $(OBJECTS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) -std=c++11 -lpthread -o $@

%.o : %.c
$(CC) $(CFLAGS) -c -std=c11 -o $@ $<

%.o : %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -std=c++11 -o $@ $<

%.o: %.asm nasm-utils-inc.asm
$(ASM) $(ASM_FLAGS) -f elf64 $<

LOCAL_MK = $(wildcard local.mk)

# https://stackoverflow.com/a/3892826/149138
dummy.rebuild: Makefile config.mk $(LOCAL_MK)
touch $@
$(MAKE) -s clean
Loading