Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
clamchowder committed Oct 21, 2023
2 parents fee0cee + 64e7951 commit 06354be
Show file tree
Hide file tree
Showing 64 changed files with 3,985 additions and 954 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
name: Build benchmarks on Ubuntu
on: [push, pull_request]
name: Build Benchmarks on Ubuntu
on: [push]
jobs:
BuildBenchmarks:
# Only Ubuntu for now.
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update
- run: sudo apt-get install -y build-essential ocl-icd-opencl-dev opencl-headers libnuma-dev
- name: Install prerequisites
run: sudo apt update && sudo apt -qq --assume-yes full-upgrade && sudo apt install -qq -y build-essential crossbuild-essential-arm64 gcc-riscv64-linux-gnu ocl-icd-opencl-dev opencl-headers libnuma-dev b3sum unzip
- name: Wild tomfoolery attempt
run: eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew install mingw-w64
- name: Check out repository code
uses: actions/checkout@v3
- name: Try to build all benchmarks with a Makefile
run: make -j4 all
- name: Build all benchmarks
run: eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && make ci
- name: Package benchmarks
run: make package
- name: b3sum
run: b3sum clammarks.txz
- name: Upload package
env:
UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }}
UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
run: curl -X PUT -T clammarks.txz -H "$UPLOAD_KEY" "$UPLOAD_URL"
2 changes: 1 addition & 1 deletion AsmGen/tests/MixIntVec128RfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public MixIntVec128RfTest(int low, int high, int step)
public override bool SupportsIsa(IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64) return true;
if (isa == IUarchTest.ISA.aarch64) return true;
if (isa == IUarchTest.ISA.aarch64) return false;
return false;
}

Expand Down
10 changes: 8 additions & 2 deletions CoherencyLatency/CoherencyLatency.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include <stdio.h>
#include <stdint.h>
#include <sys\timeb.h>

#ifndef __MINGW32__
#include <sys\timeb.h>
#else
#include <sys/timeb.h>
#endif

#include <intrin.h>
#include <windows.h>

Expand Down Expand Up @@ -227,4 +233,4 @@ DWORD WINAPI ReadLatencyTestThread(LPVOID param) {
}

return current;
}
}
26 changes: 26 additions & 0 deletions CoherencyLatency/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include ../Common/arch_detect.mk

CFLAGS = -pthread -O3

all: $(TARGET)

amd64:
$(CC) $(CFLAGS) PThreadsCoherencyLatency.c -o CoherencyLatency_amd64 $(LDFLAGS)

aarch64:
$(CC) $(CFLAGS) PThreadsCoherencyLatency.c -o CoherencyLatency_aarch64 $(LDFLAGS)

riscv64:
$(CC) $(CFLAGS) PThreadsCoherencyLatency.c -o CoherencyLatency_riscv64 $(LDFLAGS)

w64:
$(CC) $(CFLAGS) CoherencyLatency.cpp -o CoherencyLatency_w64.exe $(LDFLAGS)

# w64 can build with mingw 11, which isn't available on jammy

ci: amd64 aarch64 riscv64

clean:
rm -rf *.o *.zip "ocl-icd-libopencl1*" "OpenCL-SDK*" && find . -type f -executable -delete

.PHONY: all ci clean
28 changes: 28 additions & 0 deletions Common/arch_detect.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TARGET ?= amd64

ifeq ($(OS),Windows_NT)
TARGET = w64
else
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),x86_64)
TARGET = amd64
endif
ifeq ($(UNAME_M),aarch64)
TARGET = aarch64
endif
ifeq ($(UNAME_M),riscv64)
TARGET = riscv64
endif
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
TARGET = darwin
endif
endif

amd64: CC = x86_64-linux-gnu-gcc
amd64_numa: CC = x86_64-linux-gnu-gcc
aarch64: CC := aarch64-linux-gnu-gcc
aarch64_numa: CC = aarch64-linux-gnu-gcc
riscv64: CC = riscv64-linux-gnu-gcc
w64: CC = x86_64-w64-mingw32-gcc
darwin: CC = clang
35 changes: 35 additions & 0 deletions Common/ci_gpumemlatency.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

make_all () {
make amd64
make clean-obj
LDFLAGS="-lm -L ocl-icd-arm64/usr/lib/aarch64-linux-gnu -lOpenCL" make aarch64
make clean-obj
LDFLAGS="-lm -L ocl-icd-riscv64/usr/lib/riscv64-linux-gnu -lOpenCL" make riscv64
make clean-obj
CPPFLAGS="-I OpenCL-SDK-${OCL_VER}-Win-x64/include" LDFLAGS="-lm -L OpenCL-SDK-${OCL_VER}-Win-x64/lib -lOpenCL" make w64
make clean-obj
}

linux_deps () {
for ARCH in arm64 riscv64; do
if ! grep -q $ARCH /etc/apt/sources.list; then
echo "deb [arch=${ARCH}] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s) universe" | sudo tee -a /etc/apt/sources.list
echo "deb-src [arch=${ARCH}] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s) universe" | sudo tee -a /etc/apt/sources.list
sudo apt update
fi
apt-get download "ocl-icd-libopencl1:${ARCH}"
find . -type f -name "*${ARCH}*.deb" -exec dpkg-deb -x {} "ocl-icd-${ARCH}" \;
done
cp ocl-icd-arm64/usr/lib/aarch64-linux-gnu/libOpenCL.so.1 ocl-icd-arm64/usr/lib/aarch64-linux-gnu/libOpenCL.so
cp ocl-icd-riscv64/usr/lib/riscv64-linux-gnu/libOpenCL.so.1 ocl-icd-riscv64/usr/lib/riscv64-linux-gnu/libOpenCL.so
}

w64_deps () {
curl -fssLO "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/${OCL_VER}/OpenCL-SDK-${OCL_VER}-Win-x64.zip"
unzip "OpenCL-SDK-${OCL_VER}-Win-x64.zip"
}

linux_deps
w64_deps
make_all
17 changes: 17 additions & 0 deletions Common/ci_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

PKG="clammarks-$(git rev-parse --short HEAD)"
rm -rf "$PKG" "clammarks.txz"
mkdir -p "$PKG"

for TARGET in "amd64" "aarch64" "riscv64" "w64"; do
mkdir "$PKG/$TARGET"
for COMPONENT in CoherencyLatency MemoryLatency MemoryBandwidth InstructionRate Meshsim CoreClockChecker GpuMemLatency; do
find "$COMPONENT" -type f -name "*$TARGET*" -executable -exec cp {} "$PKG/$TARGET" \;
done
find "GpuMemLatency" -type f -name "*.cl" -exec cp {} "$PKG/$TARGET" \;
done

cp "LICENSE" "$PKG"

tar caf "clammarks.txz" "$PKG"
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions CoreClockChecker/BoostClockChecker_arm.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
.text
.global clktsctest

.global _clktsctest

.balign 4

/* x0 = iterations, return elapsed TSC in x0 */
_clktsctest:
clktsctest:
sub sp, sp, #0x40
stp x10, x11, [sp, #0x10]
Expand Down
File renamed without changes.
29 changes: 22 additions & 7 deletions CoreClockChecker/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
include ../Common/arch_detect.mk

CFLAGS = -O3
LDFLAGS = -lm

all: $(TARGET)

amd64:
x86_64-linux-gnu-gcc -pthread -O3 CoreClockChecker.c CoreClockChecker_x86.s -o CoreClockChecker -lm
win64:
x86_64-w64-mingw32-gcc -pthread -O3 CoreClockChecker.c CoreClockChecker_x86.s -o CoreClockChecker -lm
boostclockchecker:
gcc -O3 BoostClockChecker.c BoostClockChecker.s -o BoostClockChecker
win64boostclockchecker:
x86_64-w64-mingw32-gcc BoostClockChecker.c BoostClockChecker.s -o BoostClockChecker.exe
$(CC) $(CFLAGS) -pthread CoreClockChecker.c CoreClockChecker_x86.s -o CoreClockChecker_amd64 $(LDFLAGS)
$(CC) $(CFLAGS) BoostClockChecker.c BoostClockChecker_x86.s -o BoostClockChecker_amd64 $(LDFLAGS)

aarch64:
$(CC) $(CFLAGS) BoostClockChecker.c BoostClockChecker_arm.s -o BoostClockChecker_aarch64 $(LDFLAGS)

w64:
$(CC) $(CFLAGS) BoostClockChecker.c BoostClockChecker_x86.s -o BoostClockChecker_w64.exe $(LDFLAGS)

ci: amd64 aarch64 w64

clean:
rm -f *.o && find . -type f -executable -delete

.PHONY: all ci clean
56 changes: 44 additions & 12 deletions GpuMemLatency/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
UNAME_S := $(shell uname -s)
CC = gcc
CFLAGS = -O3
DEPS = ../common/timings.h
OBJ = opencltest.o latency_test.o bw_test.o common.o atomic_test.o instruction_rate.o timing.o
include ../Common/arch_detect.mk

OCL_VER = v2023.04.17
CI_SCRIPT = ../Common/ci_gpumemlatency.sh

ifeq ($(UNAME_S),Darwin)
LDFLAGS += -framework OpenCL
else
LDFLAGS += -lOpenCL
CFLAGS = -O3 -I ../Common
DEPS = ../Common/timings.h
OBJ = opencltest.o latency_test.o bw_test.o common.o atomic_test.o instruction_rate.o timing.o
LDFLAGS ?= -lm -lOpenCL
ifeq ($(TARGET), Darwin)
LDFLAGS = -lm -framework OpenCL
endif

opencltest: $(OBJ)
gcc $(CFLAGS) $^ -o $@ -lm $(LDFLAGS)
all: $(TARGET)

GpuMemLatency: $(OBJ)
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)

%.o: %.c $(DEPS)
$(CC) $(CFLAGS) -c -o $@ $<

timing.o:
$(CC) $(CFLAGS) -c ../common/timing.c -o timing.o
$(CC) $(CFLAGS) -c ../Common/timing.c -o timing.o

amd64: $(OBJ)
$(CC) $(CFLAGS) $^ -o GpuMemLatency_amd64 $(LDFLAGS)

aarch64: $(OBJ)
$(CC) $(CFLAGS) $^ -o GpuMemLatency_aarch64 $(LDFLAGS)

riscv64: $(OBJ)
$(CC) $(CFLAGS) $^ -o GpuMemLatency_riscv64 $(LDFLAGS)

w64: $(OBJ)
$(CC) $(CFLAGS) $^ -o GpuMemLatency_w64.exe $(LDFLAGS)

darwin: $(OBJ)
$(CC) $(CFLAGS) $^ -o GpuMemLatency_darwin $(LDFLAGS)

ci: clean
@OCL_VER=$(OCL_VER) sh $(CI_SCRIPT)

clean-ci:
rm -rf "*.deb" "*.zip" "ocl-icd-*" "OpenCL-SDK-*"

clean-obj:
rm -f *.o

clean: clean-ci clean-obj
find . -type f -executable -delete

.PHONY: all ci clean-ci clean-obj clean
Loading

0 comments on commit 06354be

Please sign in to comment.