Skip to content

Commit

Permalink
per stream stats (accel-sim#326)
Browse files Browse the repository at this point in the history
* Passed cuda_stream_id from accelsim to gpgpusim

* Fixed for (auto k : kernels_info) in main() for multi-stream app

* Passed streamID of last finished kernel to gpgpu_sim::print_stats

* checkout correct gpgpu-sim branch for multi stream stats

* Move Jenkins to bak

* Adding merge_group trigger to worklow

* rename jenkinsfile

* Automated clang-format

* update formatter

* correct format script path

---------

Co-authored-by: Justin Qiao <[email protected]>
Co-authored-by: JRPan <[email protected]>
  • Loading branch information
3 people authored Aug 31, 2024
1 parent 8253fd6 commit f783a4c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 28 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/short-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,22 @@ jobs:
- name: Run Simulation
run: echo "skipped Tracer-Simulation. Will perform in merge queue"
format-code:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
runs-on: tgrogers-raid
needs: [SASS-Simulation, PTX-Simulation, Tracer-Tool]

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:
- uses: actions/checkout@v4
# Other steps that change files in the repository go here
#
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
ssh-key: ''

- name: Run clang-format
run: |
sudo apt-get install -y clang-format
./gpu-simulator/format-code.sh
./util/tracer_nvbit/tracer_tool/format-code.sh
- uses: stefanzweifel/git-auto-commit-action@v5
with:
# Optional. Commit message for the created commit.
# Defaults to "Apply automatic changes"
commit_message: Automated clang-format
# Optional. Option used by `git-status` to determine if the repository is
# dirty. See https://git-scm.com/docs/git-status#_options
status_options: '--untracked-files=no'
git config user.name "purdue-jenkins"
git config user.email "[email protected]"
git remote set-url origin [email protected]:${{github.event.pull_request.head.repo.full_name}}
git remote -v
/bin/bash ./gpu-simulator/format-code.sh
/bin/bash ./util/tracer_nvbit/tracer_tool/format-code.sh
if git status --untracked-files=no | grep -q "nothing to commit"; then echo "No changes to commit."; else git commit -a -m "Automated Format"; git push; fi
8 changes: 6 additions & 2 deletions gpu-simulator/accel-sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ void accel_sim_framework::simulation_loop() {
if (!stream_busy && m_gpgpu_sim->can_start_kernel() &&
!k->was_launched()) {
std::cout << "launching kernel name: " << k->get_name()
<< " uid: " << k->get_uid() << std::endl;
<< " uid: " << k->get_uid()
<< " cuda_stream_id: " << k->get_cuda_stream_id()
<< std::endl;
m_gpgpu_sim->launch(k);
k->set_launched();
busy_streams.push_back(k->get_cuda_stream_id());
Expand Down Expand Up @@ -119,12 +121,14 @@ void accel_sim_framework::parse_commandlist() {

void accel_sim_framework::cleanup(unsigned finished_kernel) {
trace_kernel_info_t *k = NULL;
unsigned long long finished_kernel_cuda_stream_id = -1;
for (unsigned j = 0; j < kernels_info.size(); j++) {
k = kernels_info.at(j);
if (k->get_uid() == finished_kernel ||
m_gpgpu_sim->cycle_insn_cta_max_hit() || !m_gpgpu_sim->active()) {
for (unsigned int l = 0; l < busy_streams.size(); l++) {
if (busy_streams.at(l) == k->get_cuda_stream_id()) {
finished_kernel_cuda_stream_id = k->get_cuda_stream_id();
busy_streams.erase(busy_streams.begin() + l);
break;
}
Expand All @@ -138,7 +142,7 @@ void accel_sim_framework::cleanup(unsigned finished_kernel) {
}
}
assert(k);
m_gpgpu_sim->print_stats();
m_gpgpu_sim->print_stats(finished_kernel_cuda_stream_id);
}

unsigned accel_sim_framework::simulate() {
Expand Down
2 changes: 1 addition & 1 deletion gpu-simulator/accel-sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class accel_sim_framework {
unsigned window_size;
unsigned commandlist_index;

std::vector<unsigned long> busy_streams;
std::vector<unsigned long long> busy_streams;
std::vector<trace_kernel_info_t *> kernels_info;
std::vector<trace_command> commandlist;

Expand Down
3 changes: 2 additions & 1 deletion gpu-simulator/trace-driven/trace_driven.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ trace_kernel_info_t::trace_kernel_info_t(dim3 gridDim, dim3 blockDim,
trace_parser *parser,
class trace_config *config,
kernel_trace_t *kernel_trace_info)
: kernel_info_t(gridDim, blockDim, m_function_info) {
: kernel_info_t(gridDim, blockDim, m_function_info,
kernel_trace_info->cuda_stream_id) {
m_parser = parser;
m_tconfig = config;
m_kernel_trace_info = kernel_trace_info;
Expand Down
2 changes: 1 addition & 1 deletion gpu-simulator/trace-driven/trace_driven.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class trace_kernel_info_t : public kernel_info_t {
void get_next_threadblock_traces(
std::vector<std::vector<inst_trace_t> *> threadblock_traces);

unsigned long get_cuda_stream_id() {
unsigned long long get_cuda_stream_id() {
return m_kernel_trace_info->cuda_stream_id;
}

Expand Down
2 changes: 1 addition & 1 deletion gpu-simulator/trace-parser/trace_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ kernel_trace_t *trace_parser::parse_kernel_info(
} else if (string1 == "nregs") {
sscanf(line.c_str(), "-nregs = %d", &kernel_info->nregs);
} else if (string1 == "cuda" && string2 == "stream") {
sscanf(line.c_str(), "-cuda stream id = %lu",
sscanf(line.c_str(), "-cuda stream id = %llu",
&kernel_info->cuda_stream_id);
} else if (string1 == "binary" && string2 == "version") {
sscanf(line.c_str(), "-binary version = %d",
Expand Down
2 changes: 1 addition & 1 deletion gpu-simulator/trace-parser/trace_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct kernel_trace_t {
unsigned tb_dim_z;
unsigned shmem;
unsigned nregs;
unsigned long cuda_stream_id;
unsigned long long cuda_stream_id;
unsigned binary_verion;
unsigned enable_lineinfo;
unsigned trace_verion;
Expand Down

0 comments on commit f783a4c

Please sign in to comment.