-
Notifications
You must be signed in to change notification settings - Fork 163
Spinlock detection and fastforwarding for accel-sim #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,403
−23
Merged
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
85d6cf5
add spinlock detection tool
William-An 9a23e6b
use dprintf for debug msg
William-An 6387ede
integrate spinlock fastforwarding with accel-sim tracer
William-An c7e67f4
add custom rundir support for spinlock tool
William-An 30e9c19
add spinlock detection script to the run_hw_trace.py
William-An 7d30c2a
Automated Format
purdue-jenkins 48a09f1
track kernel histogram for every launch in every context by kernel name
William-An b08340e
update tracer tool with per-kernel histogram
William-An 2c68dee
Merge branch 'spinlock_fix' of github.com:purdue-aalp/accel-sim-frame…
William-An ea101fb
format to pass ci
William-An 85d1b87
update test app
William-An 08a6b5b
Merge branch 'dev' into spinlock_fix
William-An f2bcdfa
move test app to gpu-app-collection
William-An 79f819f
update script for spinlock handling
William-An d21015b
update ci to include spinlock tracer run
William-An b577da3
add spinlock test app to accel-sim yaml
William-An 186e1bf
fix a bug when detecting spinlock
William-An cad11ca
fix bug
William-An 1f5a2ed
fix filename too long issue and clean intermediate files by default
William-An 20e5f99
fix path issue
William-An fae2d48
fix histogram path for merged histo and add readme
William-An a10a587
address PR review and update top-level readme
William-An 58d3a63
update CI for PR
William-An 007d1a8
build spinlock
William-An 5595b4a
clone recursively for building GPU ubench
William-An 82a48a2
remove sim compare for spinlock since it takes too long to complete
William-An 3257e47
move spinlock tracer test to weekly and fix a bug in it
William-An db3ed3f
Merge branch 'dev' into spinlock_fix
JRPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ jobs: | |
source ./env-setup/12.8_env_setup.sh | ||
export PATH=/home/tgrogers-raid/a/common/python2:$PATH | ||
rm -rf ./gpu-app-collection/ | ||
git clone [email protected]:accel-sim/gpu-app-collection.git | ||
git clone --recursive [email protected]:accel-sim/gpu-app-collection.git | ||
source ./gpu-app-collection/src/setup_environment | ||
ln -s /home/tgrogers-raid/a/common/data_dirs ./gpu-app-collection/ | ||
make -j8 -C ./gpu-app-collection/src rodinia-3.1 | ||
|
@@ -53,6 +53,24 @@ jobs: | |
ln -s /scratch/tgrogers-disk01/a/common/for-sharing/$USER/nightly-traces ./hw_run | ||
./util/tracer_nvbit/run_hw_trace.py -B rodinia-3.1,GPU_Microbenchmark -D 7 | ||
# ./util/tracer_nvbit/run_hw_trace.py -B rodinia-3.1,GPU_Microbenchmark,parboil,polybench,cutlass_5_trace,Deepbench_nvidia_tencore,Deepbench_nvidia_normal -D 7 | ||
- name: generate-spinlock-traces-spinlock_handling | ||
run: | | ||
source ./env-setup/12.8_env_setup.sh | ||
source ./gpu-app-collection/src/setup_environment | ||
rm -rf ./hw_run/ | ||
./util/tracer_nvbit/run_hw_trace.py -B Spinlock -D 7 --spinlock_handling fast_forward | ||
mv ./hw_run ./hw_run_fast_forward | ||
./util/tracer_nvbit/run_hw_trace.py -B Spinlock -D 7 --spinlock_handling none | ||
mv ./hw_run ./hw_run_none | ||
- name: test-new-traces-spinlock_handling | ||
# Test only fast-forwarded traces as the none one takes too long to run (~2-3 hr) | ||
run: | | ||
source ./env-setup/12.8_env_setup.sh | ||
source ./gpu-simulator/setup_environment.sh | ||
./util/job_launching/run_simulations.py -B Spinlock -C QV100-SASS -T ./hw_run_fast_forward/traces/device-7/ -N spinlock-microbenchmark-$$-fast_forward | ||
./util/job_launching/monitor_func_test.py -I -v -s spinlock-stats-per-app.csv -N spinlock-microbenchmark-$$-fast_forward | ||
# ./util/job_launching/run_simulations.py -B Spinlock -C QV100-SASS -T ./hw_run_none/traces/device-7/ -N spinlock-microbenchmark-$$-none | ||
# ./util/job_launching/monitor_func_test.py -I -v -s spinlock-stats-per-app.csv -N spinlock-microbenchmark-$$-none | ||
SASS-Weekly: | ||
needs: [Tracer-Weekly] | ||
if: github.repository == 'accel-sim/accel-sim-framework' | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
nvbit_release/ | ||
silicon_checkpoint_tool/checkpoint/checkpoint.o | ||
silicon_checkpoint_tool/checkpoint/checkpoint.so | ||
tracer_tool/tracer_tool.o | ||
tracer_tool/tracer_tool.so | ||
tracer_tool/inject_funcs.o | ||
*.o | ||
*.so | ||
tracer_tool/traces-processing/post-traces-processing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
|
||
all: | ||
make -C tracer_tool | ||
make -C tracer_tool/traces-processing | ||
#make -C silicon_checkpoint_tool | ||
$(MAKE) -C tracer_tool | ||
$(MAKE) -C tracer_tool/traces-processing | ||
$(MAKE) -C others/spinlock_tool | ||
#$(MAKE) -C silicon_checkpoint_tool | ||
|
||
clean: | ||
make clean -C tracer_tool | ||
make clean -C tracer_tool/traces-processing | ||
$(MAKE) clean -C tracer_tool | ||
$(MAKE) clean -C tracer_tool/traces-processing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2017 NVIDIA CORPORATION & AFFILIATES. | ||
# All rights reserved. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright notice, this | ||
# list of conditions and the following disclaimer. | ||
# | ||
# 2. Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
NVCC=nvcc -ccbin=$(CXX) -D_FORCE_INLINES | ||
PTXAS=ptxas | ||
|
||
NVCC_VER_REQ=10.1 | ||
NVCC_VER=$(shell $(NVCC) --version | grep release | cut -f2 -d, | cut -f3 -d' ') | ||
NVCC_VER_CHECK=$(shell echo "${NVCC_VER} >= $(NVCC_VER_REQ)" | bc) | ||
|
||
ifeq ($(NVCC_VER_CHECK),0) | ||
$(error ERROR: nvcc version >= $(NVCC_VER_REQ) required to compile an nvbit tool! Instrumented applications can still use lower versions of nvcc.) | ||
endif | ||
|
||
PTXAS_VER_ADD_FLAG=12.3 | ||
PTXAS_VER=$(shell $(PTXAS) --version | grep release | cut -f2 -d, | cut -f3 -d' ') | ||
PTXAS_VER_CHECK=$(shell echo "${PTXAS_VER} >= $(PTXAS_VER_ADD_FLAG)" | bc) | ||
|
||
ifeq ($(PTXAS_VER_CHECK), 0) | ||
MAXRREGCOUNT_FLAG=-maxrregcount=24 | ||
else | ||
MAXRREGCOUNT_FLAG= | ||
endif | ||
|
||
NVBIT_PATH=../../nvbit_release/core | ||
INCLUDES=-I$(NVBIT_PATH) | ||
|
||
LIBS=-L$(NVBIT_PATH) -lnvbit | ||
NVCC_PATH=-L $(subst bin/nvcc,lib64,$(shell which nvcc | tr -s /)) | ||
|
||
SOURCES=$(wildcard *.cu) | ||
|
||
OBJECTS=$(SOURCES:.cu=.o) | ||
ARCH?=all | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path)))) | ||
|
||
NVBIT_TOOL=$(current_dir).so | ||
|
||
all: $(NVBIT_TOOL) | ||
|
||
$(NVBIT_TOOL): $(OBJECTS) $(NVBIT_PATH)/libnvbit.a | ||
$(NVCC) -arch=$(ARCH) -O3 $(OBJECTS) $(LIBS) $(NVCC_PATH) -lcuda -lcudart_static -shared -o $@ | ||
|
||
%.o: %.cu | ||
$(NVCC) -dc -c -std=c++17 $(INCLUDES) -Xptxas -cloning=no -Xcompiler -Wall -arch=$(ARCH) -O3 -Xcompiler -fPIC $< -o $@ | ||
|
||
inject_funcs.o: inject_funcs.cu | ||
$(NVCC) $(INCLUDES) $(MAXRREGCOUNT_FLAG) -Xptxas -astoolspatch --keep-device-functions -arch=$(ARCH) -Xcompiler -Wall -Xcompiler -fPIC -c $< -o $@ | ||
|
||
clean: | ||
rm -f *.so *.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Spinlock tool | ||
|
||
## Description | ||
|
||
This tool is used to detect spinlocks in the kernel code. | ||
|
||
## Usage | ||
|
||
```bash | ||
# Run program first time to get the instruction histogram of the program's kernels | ||
SPINLOCK_PHASE=0 CUDA_INJECTION64_PATH=PATH/TO/spinlock_tool.so program | ||
|
||
# Run program second time to get another instruction histogram of the program's kernels | ||
# At the end of nvbit, this tool will generate a file with the name of spinlock_detection/spinlock_instructions.txt | ||
# containing the instruction indices of the spinlock instructions in the program's kernels | ||
SPINLOCK_PHASE=1 CUDA_INJECTION64_PATH=PATH/TO/spinlock_tool.so program | ||
|
||
# To fast forward the spinlock instructions with accel-sim tracer, you can use the following command | ||
ENABLE_SPINLOCK_FAST_FORWARD=1 CUDA_INJECTION64_PATH=PATH/TO/tracer_tool.so program | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a dedicated "suite" instead of part of uBench? Then can we only run fast forward on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I saw that on gpu-app-collection Spinlock is part of the uBench. Can you move this under ubench suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, but the correlation of it will be terrible with just fast-forwarding when running with the ubench suite, given that this app is acquiring a highly contested lock.
I gave it a dedicated suite as all the atomic kernels also got a dedicated suite, even though they are under the ubench folder in the gpu-app-collection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay valid point