Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4469333
Needs to be rebased, fix init to work with github, add DCPerf, add re…
mattweingarten Jul 22, 2025
9ed4f76
Overall run script fixes, add CI workflow
mattweingarten Jul 22, 2025
39c3e55
Bump DCPerf to point to fork
mattweingarten Jul 22, 2025
f622508
Fix type resolver test to work with current libstdc++ version, remove…
mattweingarten Jul 25, 2025
edc98fa
Remove all prebuilt testdata files
mattweingarten Jul 25, 2025
4ead3e8
Read protobuff test cases
mattweingarten Jul 25, 2025
3ea78c8
Fix SPEC cfg, allow --build-spec command in run.sh, add spec dependen…
mattweingarten Jul 26, 2025
fca1a4d
Make CI clone recursively
mattweingarten Jul 27, 2025
40cfed0
Update Dwarfmetadata fetcher to deal with current version of heapallo…
mattweingarten Jul 27, 2025
e9c3ff9
Change logging which breaks run script, add clang build option
mattweingarten Aug 4, 2025
e7854d2
Remove comments from update dwarf
mattweingarten Aug 4, 2025
cd94044
Dwarf metadata heap alloc tag fix
mattweingarten Aug 4, 2025
dd64f3d
Update init script to download bazel properly in github ci
mattweingarten Aug 5, 2025
bf877e6
Add debug mode to CI bazel run to help debugging
mattweingarten Aug 5, 2025
eeeba94
Add clang format file
mattweingarten Aug 12, 2025
63bada8
Add missing testcases to update dwarf, minor fix in dwarf_metadata_fe…
mattweingarten Aug 12, 2025
bdcbdc9
Increase ci runner size to avoid crashes
mattweingarten Aug 14, 2025
4f51ef3
Update to use prebuilt llvm, change init script, update toolchain
mattweingarten Aug 14, 2025
ce0bcee
Try reclaim disk space so runner does not run out of space
mattweingarten Aug 14, 2025
e1ce957
Free up more diskspace
mattweingarten Aug 14, 2025
7672d32
Clang formatting fixes
mattweingarten Aug 14, 2025
d45da37
Fix freeing disk space
mattweingarten Aug 14, 2025
ce93b19
Update memprof toolchain
mattweingarten Aug 14, 2025
0d35836
Remove testdata from initialization script
mattweingarten Aug 14, 2025
d9e3399
Remove testdata from initialization script
mattweingarten Aug 14, 2025
c6353eb
Update update dwarf with env
mattweingarten Aug 14, 2025
e5f834d
Formatting
mattweingarten Aug 15, 2025
1dfb087
Fix toolchain issues with memprof
mattweingarten Aug 15, 2025
0c1e3db
More fixes for ci
mattweingarten Aug 15, 2025
315e84e
Update type resolver be agnostic to namespace changes, so it matches …
mattweingarten Aug 15, 2025
8e8de95
Add aliases to make sure that clang points to right place in ci
mattweingarten Aug 15, 2025
9763daa
Seperate step to generate testdata
mattweingarten Aug 15, 2025
9497817
Fix testdata script name in ci
mattweingarten Aug 15, 2025
c4ef4fd
Make update dwarf work without environment
mattweingarten Aug 15, 2025
75fe1ad
Fix llvm path to point to install instead of build
mattweingarten Aug 15, 2025
def48a2
Fix toolchain issues
mattweingarten Aug 19, 2025
b47c540
Add clang test suite
mattweingarten Aug 19, 2025
5f78f81
Add clang test, formatting
mattweingarten Aug 19, 2025
70d595f
Fix type resolution for different namespace issiues
mattweingarten Aug 19, 2025
c57d3fe
Bump abseil-cpp
mattweingarten Aug 19, 2025
d3bb6f8
Add helper script for uploading prebuilt llvm to s3 bucket for faster CI
mattweingarten Aug 19, 2025
20847cf
Update prebuilt llvm script
mattweingarten Aug 19, 2025
3613ce6
Fix include bug
mattweingarten Aug 19, 2025
5cc972a
Source env in ci
mattweingarten Aug 19, 2025
ae97c6c
Update test generation to use libc++ so that tests are conistent rega…
mattweingarten Aug 19, 2025
0dd5e69
Add dump of memprofraw for debugging CI
mattweingarten Aug 19, 2025
0cbc40f
Fix dumping of show yaml file in update dwarf
mattweingarten Aug 19, 2025
fc39e2f
Add dump to find out diff in ci and local
mattweingarten Aug 19, 2025
2fabc2d
Bump llvm version for correct callstack trimming
mattweingarten Aug 20, 2025
364f600
Remove dump from test
mattweingarten Aug 20, 2025
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
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Run manually to reformat a file:
# clang-format -i --style=file <file>
Language: Cpp
BasedOnStyle: Google
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: llvm-memprof CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Check disk space
run: |
df -h

- name: Free disk space
run: |
set -euxo pipefail
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
df -h
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive

- name: Environment Setup
shell: bash
run: |
set -euo pipefail
./init.sh --prebuilt-llvm
source env.sh
bazel --version
echo $TOP_DIR
echo $SCRIPTS_DIR
whereis clang
whereis clang++
whereis llvm-dwarfdump
whereis llvm-symbolizer
whereis llvm-profdata
whereis lld
whereis bazel

- name: DwarfMetadata Fetcher Test
run: |
source env.sh
bazel run //src:dwarf_metadata_fetcher_test --verbose_failures --sandbox_debug

- name: Type Resolver Unit Test
run: |
source env.sh
bazel run //src:type_resolver_unit_test --verbose_failures --sandbox_debug

- name: Type Resolver Test
run: |
source env.sh
bazel run //src:type_resolver_test --verbose_failures --sandbox_debug

- name: Histogram Builder Test
run: |
source env.sh
bazel run //src:histogram_builder_test --verbose_failures --sandbox_debug
23 changes: 23 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Clang Format Check

on:
pull_request:
paths:
- 'src/**/*.cc'
- 'src/**/*.h'
- '!src/testdata/**'

jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run clang-format Lint Action
uses: DoozyX/clang-format-lint-action@v0.18.2
with:
source: './src'
extensions: 'cc,h,cpp,hpp'
clangFormatVersion: 16
style: file
inplace: false
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@
[submodule "third_party/fleetbench"]
path = third_party/fleetbench
url = git@github.com:google/fleetbench.git
[submodule "third_party/DCPerf"]
path = third_party/DCPerf
url = git@github.com:mattweingarten/DCPerf.git
[submodule "testsuite/clang-memprof"]
path = testsuite/clang-memprof
url = git@github.com:mattweingarten/llvm-project.git
branch = heapalloc
32 changes: 23 additions & 9 deletions cfg/memprof.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ bind7 = numactl -m 0 --physcpubind=7
#------- Compilers ------------------------------------------------------------
default:
# EDIT paths to LLVM and libraries:
BASE_DIR = /usr/local/google/home/weingartenmatt/Workspace/
BASE_DIR = -
# LLVM_PATH specifies the directory path containing required LLVM files and
# potentially multiple LLVM versions.
LLVM_PATH = $[BASE_DIR]/llvm-project/
LLVM_PATH = <path-to-llvm>
# LLVM_ROOT_PATH specifies the directory path to the LLVM version to be
# used. EDIT: Change llvm-v390 to appropriate directory name.
LLVM_ROOT_PATH = $[LLVM_PATH]/build
Expand Down Expand Up @@ -247,6 +247,13 @@ default:# data model applies to all benchmarks
EXTRA_PORTABILITY = -DSPEC_LP64
%endif

# Memprof Specific flags

MEMPROF_FLAGS = -g -fstandalone-debug -fuse-ld=lld -Wl,--no-rosegment -fdebug-info-for-profiling -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie -fmemory-profile=. -fprofile-generate=. -mllvm -memprof-histogram

# We have to set this because parest will not compile without the changes. We can run without this if we do not run parest.
strict_rundir_verify = 0

# Benchmark-specific portability (ordered by last 2 digits of bmark number)

500.perlbench_r,600.perlbench_s: #lang='C'
Expand All @@ -257,12 +264,18 @@ default:# data model applies to all benchmarks
%endif
PORTABILITY = -DSPEC_%{os}_%{suffix}

508.namd_r: #lang='CXX'
CXXPORTABILITY = -std=c++14

520.omnetpp_r,620.omnetpp_s: #lang='CXX'
CXXPORTABILITY = -std=c++14

521.wrf_r,621.wrf_s: #lang='F,C'
CPORTABILITY = -DSPEC_CASE_FLAG
FPORTABILITY = -fconvert=big-endian

523.xalancbmk_r,623.xalancbmk_s: #lang='CXX'
PORTABILITY = -DSPEC_%{os}
PORTABILITY = -DSPEC_%{os} -fdelayed-template-parsing

526.blender_r: #lang='CXX,C'
CPORTABILITY = -funsigned-char
Expand All @@ -275,11 +288,12 @@ default:# data model applies to all benchmarks
CPORTABILITY = -DSPEC_CASE_FLAG
FPORTABILITY = -fconvert=big-endian


#-------- Baseline Tuning Flags ----------------------------------------------
default=base:
COPTIMIZE = -mllvm -memprof-use-callbacks=true -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie -fmemory-profile=. -fprofile-generate=.
CXXOPTIMIZE = -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wno-c++11-narrowing -Wno-reserved-user-defined-literal -fmemory-profile=. -memprof-use-callbacks=true
FOPTIMIZE = -O2 -memprof-use-callbacks=true -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fmemory-profile=. -fprofile-generate=.
COPTIMIZE = $[MEMPROF_FLAGS] -O2
CXXOPTIMIZE = $[MEMPROF_FLAGS] -O2
FOPTIMIZE = $[MEMPROF_FLAGS] -O2
EXTRA_FFLAGS = -fplugin=$(DRAGONEGG_PATH)/dragonegg.so
EXTRA_FLIBS = -lgfortran -lm
LDOPTIMIZE = -z muldefs
Expand Down Expand Up @@ -318,9 +332,9 @@ intrate,fprate:

#-------- Peak Tuning Flags ----------------------------------------------
default=peak:
COPTIMIZE = -O2 -mllvm -memprof-use-callbacks=true -fPIC -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie -fmemory-profile=. -fprofile-generate=.
CXXOPTIMIZE = -O2 -mllvm -memprof-use-callbacks=true -fPIC -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie -fmemory-profile=. -fprofile-generate=.
FOPTIMIZE = -O2 -mllvm -memprof-use-callbacks=true -fPIC -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie -fmemory-profile=. -fprofile-generate=.
COPTIMIZE = $[MEMPROF_FLAGS] -O2
CXXOPTIMIZE = $[MEMPROF_FLAGS] -O2
FOPTIMIZE = $[MEMPROF_FLAGS] -O2
EXTRA_FLIBS = -lgfortran -lm
EXTRA_FFLAGS = -fplugin=$(DRAGONEGG_PATH)/dragonegg.so

Expand Down
26 changes: 24 additions & 2 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,34 @@ export TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
# Subdirs
export SCRIPTS_DIR="${TOP_DIR}/scripts"
export FLAMEGRAPH_DIR="${TOP_DIR}/third_party/FlameGraph"
export LLVM_BIN_DIR="${TOP_DIR}/third_party/llvm-project/build/bin"
export LLVM_BIN_DIR="${TOP_DIR}/third_party/llvm-project/install/bin"
export TESTSUITE_DIR="${TOP_DIR}/testsuite/"

#Change open file limit for DCPerf.
ulimit -n 65535

export PATH="${LLVM_BIN_DIR}:${PATH}"
export PATH="${LLVM_BIN_DIR}:$PATH"
export CC="${LLVM_BIN_DIR}/clang"
export CXX="${LLVM_BIN_DIR}/clang++"
export LD="${LLVM_BIN_DIR}/lld"
export AR="${LLVM_BIN_DIR}/llvm-ar"
export NM="${LLVM_BIN_DIR}/llvm-nm"
export RANLIB="${LLVM_BIN_DIR}/llvm-ranlib"
export STRIP="${LLVM_BIN_DIR}/llvm-strip"

alias clang="${CC}"
alias clang++="${CXX}"
alias lld="${LD}"
alias llvm-ar="${AR}"
alias llvm-nm="${NM}"
alias llvm-ranlib="${RANLIB}"
alias llvm-profdata="${LLVM_BIN_DIR}/llvm-profdata"
alias llvm-dwarfdump="${LLVM_BIN_DIR}/llvm-dwarfdump"
alias readelf="${LLVM_BIN_DIR}/llvm-readelf"
alias objdump="${LLVM_BIN_DIR}/llvm-objdump"

# Python venv
if [ -f "${TOP_DIR}/.venv/bin/activate" ]; then
source "${TOP_DIR}/.venv/bin/activate"
fi

Loading