summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsspenst <[email protected]>2016-07-08 14:51:44 -0700
committersspenst <[email protected]>2016-07-08 14:51:44 -0700
commit6c1fb702e17b00fd7de72ac7dd4a31584d5978b9 (patch)
treed9ec9e297afabe0878c19a520f01e4ca123a75f1 /src
parent877cbd077ffaf112b68973fdb7db8f10505303ee (diff)
Made gridDim and blockDim global variables so that they can be accessed from sst_impl
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.h3
-rw-r--r--src/cuda-sim/instructions.cc3
-rw-r--r--src/cuda-sim/opcodes.def2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 6ed9b8e..46c3279 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -162,6 +162,9 @@ struct dim3 {
};
#endif
+extern dim3 gridDim;
+extern dim3 blockDim;
+
void increment_x_then_y_then_z( dim3 &i, const dim3 &bound);
class kernel_info_t {
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 8bdb94f..fd3b1fa 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -3772,7 +3772,7 @@ void sst_impl( const ptx_instruction *pI, ptx_thread_info *thread )
thread->m_last_dram_callback.function = bar_callback;
thread->m_last_dram_callback.instruction = cpI;
- int NUM_THREADS = 8; // (how do you get this dynamically?)
+ int NUM_THREADS = blockDim.x * blockDim.y * blockDim.z;
if (src2_data.s64 == NUM_THREADS-1) {
// pick only one thread to load all of the data back from sstarr memory
unsigned offset = 0;
@@ -3809,7 +3809,6 @@ void sst_impl( const ptx_instruction *pI, ptx_thread_info *thread )
// fill the rest of the array with zeros (dst should always have a 0 in it)
while (offset < NUM_THREADS) {
mem->write(addr+(offset*4),size/8,&dst_data.s64,thread,pI);
- mem->write(addr+((NUM_THREADS+offset)*4),size/8,&dst_data.s64,thread,pI);
offset++;
}
diff --git a/src/cuda-sim/opcodes.def b/src/cuda-sim/opcodes.def
index 0c0eda9..1af04ea 100644
--- a/src/cuda-sim/opcodes.def
+++ b/src/cuda-sim/opcodes.def
@@ -103,7 +103,7 @@ OP_DEF(SHR_OP,shr_impl,"shr",1,1)
OP_DEF(SIN_OP,sin_impl,"sin",1,4)
OP_DEF(SLCT_OP,slct_impl,"slct",1,1)
OP_DEF(SQRT_OP,sqrt_impl,"sqrt",1,4)
-OP_DEF(SST_OP,sst_impl,"sst",1,1)
+OP_DEF(SST_OP,sst_impl,"sst",1,5)
OP_DEF(SSY_OP,ssy_impl,"ssy",0,3)
OP_DEF(ST_OP,st_impl,"st",0,5)
OP_DEF(SUB_OP,sub_impl,"sub",1,1)