Skip to content

Commit

Permalink
remove unused & unintilized variables & format automation (#69)
Browse files Browse the repository at this point in the history
* run formatter only on PR

* remove unused & unintilized variables

* fix signed & unsigned comparison warning

* enable merge queue

* resolve conflict

* in formatter, checkout the forked repo, not the base repo in PR

* Try to use jenkins for formatter

* Automated Format

---------

Co-authored-by: purdue-jenkins <[email protected]>
  • Loading branch information
JRPan and purdue-jenkins authored Aug 16, 2024
1 parent 081da0a commit 42a0cde
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: Short-Tests

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the mydev branch
push:
branches-ignore:
- "gh-readonly-queue**"
Expand Down Expand Up @@ -86,25 +85,21 @@ jobs:
- name: Run Simulation
run: /bin/bash $GITHUB_WORKSPACE/short-tests.sh
format-code:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
runs-on: tgrogers-raid
needs: [build-TITANV, build-TITANV-LOCALXBAR, build-QV100, build-2060, build-3070]
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
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 ./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'
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
16 changes: 8 additions & 8 deletions src/cuda-sim/instructions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5442,33 +5442,33 @@ void shfl_impl(const ptx_instruction *pI, core_t *core, warp_inst_t inst) {
}

void shf_impl(const ptx_instruction *pI, ptx_thread_info *thread) {
ptx_reg_t a,b,c,d;
ptx_reg_t a, b, c, d;
const operand_info &dst = pI->dst();
const operand_info &src1 = pI->src1();
const operand_info &src2 = pI->src2();
const operand_info &src3 = pI->src3();

// Only b32 is allowed
// Only b32 is allowed
unsigned i_type = pI->get_type();
a = thread->get_operand_value(src1, dst, i_type, thread, 1);
b = thread->get_operand_value(src2, dst, i_type, thread, 1);
c = thread->get_operand_value(src3, dst, i_type, thread, 1);

if(i_type != B32_TYPE)
if (i_type != B32_TYPE)
printf("Only the b32 data_type is allowed per the ISA\n");

unsigned clamp_mode = pI->clamp_mode();
unsigned n = c.u32 & 0x1f;
if(clamp_mode) {
if(c.u32 < 32)
if (clamp_mode) {
if (c.u32 < 32)
n = c;
else
n = 32;
}
if(pI->left_mode())
d.u32 = (b.u32 << n) | (a.u32 >> (32-n));
if (pI->left_mode())
d.u32 = (b.u32 << n) | (a.u32 >> (32 - n));
else
d.u32 = (b.u32 << (32-n)) | (a.u32 >> n);
d.u32 = (b.u32 << (32 - n)) | (a.u32 >> n);

thread->set_operand_value(dst, d, i_type, thread, pI);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cuda-sim/ptx_ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class ptx_instruction : public warp_inst_t {
unsigned cache_option() const { return m_cache_option; }
unsigned rounding_mode() const { return m_rounding_mode; }
unsigned saturation_mode() const { return m_saturation_mode; }
unsigned clamp_mode() const {return m_clamp_mode;}
unsigned clamp_mode() const { return m_clamp_mode; }
unsigned left_mode() const { return m_left_mode; }
unsigned dimension() const { return m_geom_spec; }
unsigned barrier_op() const { return m_barrier_op; }
Expand Down
6 changes: 3 additions & 3 deletions src/gpgpu-sim/gpu-sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ struct power_config {

// NOTE: After changing the nonlinear model to only scaling idle core,
// NOTE: The min_inc_per_active_sm is not used any more
if (g_use_nonlinear_model)
sscanf(gpu_nonlinear_model_config, "%lf:%lf", &gpu_idle_core_power,
&gpu_min_inc_per_active_sm);
// if (g_use_nonlinear_model)
// sscanf(gpu_nonlinear_model_config, "%lf:%lf", &gpu_idle_core_power,
// &gpu_min_inc_per_active_sm);
}
void reg_options(class OptionParser *opp);

Expand Down
4 changes: 2 additions & 2 deletions src/gpgpu-sim/shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class shd_warp_t {
m_waiting_ldgsts = false;

// Ni: Clear m_ldgdepbar_buf
for (int i = 0; i < m_ldgdepbar_buf.size(); i++) {
for (unsigned i = 0; i < m_ldgdepbar_buf.size(); i++) {
m_ldgdepbar_buf[i].clear();
}
m_ldgdepbar_buf.clear();
Expand Down Expand Up @@ -165,7 +165,7 @@ class shd_warp_t {
m_waiting_ldgsts = false;

// Ni: Clear m_ldgdepbar_buf
for (int i = 0; i < m_ldgdepbar_buf.size(); i++) {
for (unsigned i = 0; i < m_ldgdepbar_buf.size(); i++) {
m_ldgdepbar_buf[i].clear();
}
m_ldgdepbar_buf.clear();
Expand Down

0 comments on commit 42a0cde

Please sign in to comment.