summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.cc1
-rw-r--r--src/abstract_hardware_model.h7
-rw-r--r--src/gpgpu-sim/shader.cc4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc
index a7da2ff..19c3091 100644
--- a/src/abstract_hardware_model.cc
+++ b/src/abstract_hardware_model.cc
@@ -316,6 +316,7 @@ void warp_inst_t::memory_coalescing_arch_13( bool is_write, mem_access_type acce
// local memory can only be accessed in 4B chunks by one thread
unsigned data_size_coales = (space.get_type() == local_space || space.get_type() == param_space_local ) ? 4 : data_size;
unsigned num_accesses = (space.get_type() == local_space || space.get_type() == param_space_local ) ? data_size/4 : 1;
+ assert(num_accesses <= MAX_ACCESSES_PER_INSN_PER_THREAD);
for(unsigned access=0; access<num_accesses; access++) {
new_addr_type addr = m_per_scalar_thread[thread].memreqaddr[access];
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 8d4d009..97b243e 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -632,6 +632,8 @@ enum divergence_support_t {
NUM_SIMD_MODEL
};
+const unsigned MAX_ACCESSES_PER_INSN_PER_THREAD = 8;
+
class warp_inst_t: public inst_t {
public:
// constructors
@@ -684,6 +686,7 @@ public:
m_per_scalar_thread.resize(m_config->warp_size);
m_per_scalar_thread_valid=true;
}
+ assert(num_addrs <= MAX_ACCESSES_PER_INSN_PER_THREAD);
for(unsigned i=0; i<num_addrs; i++)
m_per_scalar_thread[n].memreqaddr[i] = addr[i];
}
@@ -782,11 +785,11 @@ protected:
struct per_thread_info {
per_thread_info() {
- for(unsigned i=0; i<8; i++)
+ for(unsigned i=0; i<MAX_ACCESSES_PER_INSN_PER_THREAD; i++)
memreqaddr[i] = 0;
}
dram_callback_t callback;
- new_addr_type memreqaddr[8]; // effective address, upto 8 different requests (to support 32B access in 8 chunks of 4B each)
+ new_addr_type memreqaddr[MAX_ACCESSES_PER_INSN_PER_THREAD]; // effective address, upto 8 different requests (to support 32B access in 8 chunks of 4B each)
};
bool m_per_scalar_thread_valid;
std::vector<per_thread_info> m_per_scalar_thread;
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index b37ceef..7ef5140 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -608,7 +608,7 @@ void shader_core_ctx::func_exec_inst( warp_inst_t &inst )
if( inst.has_callback(t) )
m_warp[inst.warp_id()].inc_n_atomic();
if (inst.space.is_local() && (inst.is_load() || inst.is_store())) {
- new_addr_type localaddrs[8];
+ new_addr_type localaddrs[MAX_ACCESSES_PER_INSN_PER_THREAD];
unsigned num_addrs;
num_addrs = translate_local_memaddr(inst.get_addr(t), tid, m_config->n_simt_clusters*m_config->n_simt_cores_per_cluster,
inst.data_size, (new_addr_type*) localaddrs );
@@ -797,7 +797,7 @@ unsigned shader_core_ctx::translate_local_memaddr( address_type localaddr, unsig
assert(datasize%4 == 0);
assert(datasize >= 4);
- assert(datasize <= 32); // max 32B
+ assert(datasize/4 <= MAX_ACCESSES_PER_INSN_PER_THREAD); // max 32B
assert(localaddr%4 == 0); // Required if accessing 4B per request, otherwise access will overflow into next thread's space
for(unsigned i=0; i<datasize/4; i++) {
address_type local_word = localaddr/4 + i;