summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorJRPan <[email protected]>2025-08-18 23:09:47 -0700
committerGitHub <[email protected]>2025-08-19 06:09:47 +0000
commit21b18be3832b80b00d4890f041818bac431866e7 (patch)
tree4a8801a93a6dde20b747ef6db509215894c9f3ec /src/cuda-sim
parent33644740f15e0fa9f3d64ff98956569b2acf47bc (diff)
running formatter (#126)
* running formatter * consolidate CI runs * use cluster to run formatter * use cluster to run formatter * Add a CI-Success step
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc4
-rw-r--r--src/cuda-sim/cuda-sim.h4
-rw-r--r--src/cuda-sim/cuda_device_printf.cc2
-rw-r--r--src/cuda-sim/half.h27
-rw-r--r--src/cuda-sim/ptx_sim.cc4
-rw-r--r--src/cuda-sim/ptx_sim.h4
6 files changed, 29 insertions, 16 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 69d1eb7..14ae504 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -2782,7 +2782,9 @@ void print_ptxinfo() {
}
}
-struct gpgpu_ptx_sim_info get_ptxinfo() { return g_ptxinfo; }
+struct gpgpu_ptx_sim_info get_ptxinfo() {
+ return g_ptxinfo;
+}
std::map<unsigned, const char *> get_duplicate() { return g_duplicate; }
diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h
index b1caf0c..21e1ca0 100644
--- a/src/cuda-sim/cuda-sim.h
+++ b/src/cuda-sim/cuda-sim.h
@@ -101,8 +101,8 @@ class functionalCoreSim : public core_t {
bool *m_warpAtBarrier;
};
-#define RECONVERGE_RETURN_PC ((address_type) - 2)
-#define NO_BRANCH_DIVERGENCE ((address_type) - 1)
+#define RECONVERGE_RETURN_PC ((address_type)-2)
+#define NO_BRANCH_DIVERGENCE ((address_type)-1)
address_type get_return_pc(void *thd);
const char *get_ptxinfo_kname();
void print_ptxinfo();
diff --git a/src/cuda-sim/cuda_device_printf.cc b/src/cuda-sim/cuda_device_printf.cc
index 69ebc63..ef780e9 100644
--- a/src/cuda-sim/cuda_device_printf.cc
+++ b/src/cuda-sim/cuda_device_printf.cc
@@ -65,7 +65,7 @@ void my_cuda_printf(const char *fmtstr, const char *arg_list) {
fprintf(fp, buf, *((unsigned *)ptr));
arg_offset += 4;
} else if (c == 'f') {
- if (acc%2) {
+ if (acc % 2) {
arg_offset += 4;
ptr = (void *)&arg_list[arg_offset];
}
diff --git a/src/cuda-sim/half.h b/src/cuda-sim/half.h
index 67e607b..fab1a22 100644
--- a/src/cuda-sim/half.h
+++ b/src/cuda-sim/half.h
@@ -846,8 +846,10 @@ uint16 int2half_impl(T value) {
bits |= 0x7BFF + (R != std::round_toward_zero);
} else if (value) {
unsigned int m = value, exp = 24;
- for (; m < 0x400; m <<= 1, --exp);
- for (; m > 0x7FF; m >>= 1, ++exp);
+ for (; m < 0x400; m <<= 1, --exp)
+ ;
+ for (; m > 0x7FF; m >>= 1, ++exp)
+ ;
bits |= (exp << 10) + m;
if (exp > 24) {
if (R == std::round_to_nearest)
@@ -1272,7 +1274,8 @@ inline double half2float_impl(uint16 value, double, true_type) {
int abs = value & 0x7FFF;
if (abs) {
hi |= 0x3F000000 << static_cast<unsigned>(abs >= 0x7C00);
- for (; abs < 0x400; abs <<= 1, hi -= 0x100000);
+ for (; abs < 0x400; abs <<= 1, hi -= 0x100000)
+ ;
hi += static_cast<uint32>(abs) << 10;
}
uint64 bits = static_cast<uint64>(hi) << 32;
@@ -2113,7 +2116,8 @@ struct functions {
static half frexp(half arg, int *exp) {
int m = arg.data_ & 0x7FFF, e = -14;
if (m >= 0x7C00 || !m) return *exp = 0, arg;
- for (; m < 0x400; m <<= 1, --e);
+ for (; m < 0x400; m <<= 1, --e)
+ ;
return *exp = e + (m >> 10),
half(binary, (arg.data_ & 0x8000) | 0x3800 | (m & 0x3FF));
}
@@ -2131,7 +2135,8 @@ struct functions {
unsigned int mask = (1 << (25 - e)) - 1, m = arg.data_ & mask;
iptr->data_ = arg.data_ & ~mask;
if (!m) return half(binary, arg.data_ & 0x8000);
- for (; m < 0x400; m <<= 1, --e);
+ for (; m < 0x400; m <<= 1, --e)
+ ;
return half(binary, static_cast<uint16>((arg.data_ & 0x8000) | (e << 10) |
(m & 0x3FF)));
}
@@ -2143,7 +2148,8 @@ struct functions {
static half scalbln(half arg, long exp) {
unsigned int m = arg.data_ & 0x7FFF;
if (m >= 0x7C00 || !m) return arg;
- for (; m < 0x400; m <<= 1, --exp);
+ for (; m < 0x400; m <<= 1, --exp)
+ ;
exp += m >> 10;
uint16 value = arg.data_ & 0x8000;
if (exp > 30) {
@@ -2185,7 +2191,8 @@ struct functions {
if (abs < 0x7C00) {
int exp = (abs >> 10) - 15;
if (abs < 0x400)
- for (; abs < 0x200; abs <<= 1, --exp);
+ for (; abs < 0x200; abs <<= 1, --exp)
+ ;
return exp;
}
if (abs > 0x7C00) return FP_ILOGBNAN;
@@ -2201,11 +2208,13 @@ struct functions {
if (abs < 0x7C00) {
int exp = (abs >> 10) - 15;
if (abs < 0x400)
- for (; abs < 0x200; abs <<= 1, --exp);
+ for (; abs < 0x200; abs <<= 1, --exp)
+ ;
uint16 bits = (exp < 0) << 15;
if (exp) {
unsigned int m = std::abs(exp) << 6, e = 18;
- for (; m < 0x400; m <<= 1, --e);
+ for (; m < 0x400; m <<= 1, --e)
+ ;
bits |= (e << 10) + m;
}
return half(binary, bits);
diff --git a/src/cuda-sim/ptx_sim.cc b/src/cuda-sim/ptx_sim.cc
index 9a22d02..d0de1ca 100644
--- a/src/cuda-sim/ptx_sim.cc
+++ b/src/cuda-sim/ptx_sim.cc
@@ -203,8 +203,8 @@ unsigned ptx_thread_info::get_builtin(int builtin_id, unsigned dim_mod) {
return (unsigned)(m_gpu->gpu_sim_cycle + m_gpu->gpu_tot_sim_cycle);
case CLOCK64_REG:
// Change return value to unsigned long long?
- // Currently returns 32-bit unsigned, which may cause truncation for large values.
- // GPGPUSim clock is 4 times slower - multiply by 4
+ // Currently returns 32-bit unsigned, which may cause truncation for large
+ // values. GPGPUSim clock is 4 times slower - multiply by 4
return (m_gpu->gpu_sim_cycle + m_gpu->gpu_tot_sim_cycle) * 4;
case HALFCLOCK_ID:
// GPGPUSim clock is 4 times slower - multiply by 4
diff --git a/src/cuda-sim/ptx_sim.h b/src/cuda-sim/ptx_sim.h
index 7128f8e..8eec922 100644
--- a/src/cuda-sim/ptx_sim.h
+++ b/src/cuda-sim/ptx_sim.h
@@ -340,7 +340,9 @@ class ptx_thread_info {
dim3 get_ctaid() const { return m_ctaid; }
dim3 get_tid() const { return m_tid; }
dim3 get_ntid() const { return m_ntid; }
- class gpgpu_sim *get_gpu() { return (gpgpu_sim *)m_gpu; }
+ class gpgpu_sim *get_gpu() {
+ return (gpgpu_sim *)m_gpu;
+ }
unsigned get_hw_tid() const { return m_hw_tid; }
unsigned get_hw_ctaid() const { return m_hw_ctaid; }
unsigned get_hw_wid() const { return m_hw_wid; }