-
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
Changes from 22 commits
85d6cf5
9a23e6b
6387ede
c7e67f4
30e9c19
7d30c2a
48a09f1
b08340e
2c68dee
ea101fb
85d1b87
08a6b5b
f2bcdfa
79f819f
d21015b
b577da3
186e1bf
cad11ca
1f5a2ed
20e5f99
fae2d48
a10a587
58d3a63
007d1a8
5595b4a
82a48a2
3257e47
db3ed3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,14 @@ GPU_Atomic: | |
- args: 16 | ||
accel-sim-mem: 1G | ||
|
||
Spinlock: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. okay valid point |
||
exec_dir: "$GPUAPPS_ROOT/bin/$CUDA_VERSION/release/" | ||
data_dirs: "$GPUAPPS_ROOT/data_dirs/" | ||
execs: | ||
- spinlock_simple: | ||
- args: | ||
accel-sim-mem: 1G | ||
|
||
Atomic_Profile: | ||
exec_dir: "$GPUAPPS_ROOT/bin/$CUDA_VERSION/release/" | ||
data_dirs: "$GPUAPPS_ROOT/data_dirs/" | ||
|
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 |
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 |
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 |
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 | ||
``` |
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.
This would run every thing twice, including the builds. Can we just run the tracer twice? And how is CI determining if fast forward is correct? Just by functionally passing the test?
Uh oh!
There was an error while loading. Please reload this page.
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 also change the CI script to run and trace the spinlock app, and then test to check if the total number of instructions is reduced or not.