summaryrefslogtreecommitdiff
path: root/src/cuda-sim/cuda-sim.cc
diff options
context:
space:
mode:
authorWilson Fung <[email protected]>2011-01-20 18:59:45 -0800
committerWilson Fung <[email protected]>2011-01-20 18:59:45 -0800
commit34149bec142ba633f1e1b26a528ef6d77a05a3f6 (patch)
tree57d6126ef2f1b294dcba69e8607531748ed7a371 /src/cuda-sim/cuda-sim.cc
parentf18e4327b836ac66843a1c21cb429cc71bea9714 (diff)
Integration change. Bug fixes from AMD-CMU trace gen branch.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8389]
Diffstat (limited to 'src/cuda-sim/cuda-sim.cc')
-rw-r--r--src/cuda-sim/cuda-sim.cc41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index e33181f..9555010 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -313,7 +313,7 @@ memory_space_t whichspace( addr_t addr )
{
if( (addr >= GLOBAL_HEAP_START) || (addr < STATIC_ALLOC_LIMIT) ) {
return global_space;
- } else if( addr > SHARED_GENERIC_START ) {
+ } else if( addr >= SHARED_GENERIC_START ) {
return shared_space;
} else {
return local_space;
@@ -851,6 +851,19 @@ void init_inst_classification_stat()
g_inst_op_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,100);
}
+static unsigned get_tex_datasize( const ptx_instruction *pI, ptx_thread_info *thread )
+{
+ const operand_info &src1 = pI->src1(); //the name of the texture
+ std::string texname = src1.name();
+
+ gpgpu_t *gpu = thread->get_gpu();
+ const struct textureReference* texref = gpu->get_texref(texname);
+ const struct textureInfo* texInfo = gpu->get_texinfo(texref);
+
+ unsigned data_size = texInfo->texel_size;
+ return data_size;
+}
+
void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id )
{
bool skip = false;
@@ -960,31 +973,7 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id )
if (pI->get_opcode() == TEX_OP) {
inst.set_addr(lane_id, last_eaddr() );
assert( inst.space == last_space() );
-
- unsigned to_type = pI->get_type();
- switch ( to_type ) {
- case B8_TYPE:
- case S8_TYPE:
- case U8_TYPE:
- inst.data_size = 1; break;
- case B16_TYPE:
- case S16_TYPE:
- case U16_TYPE:
- case F16_TYPE:
- inst.data_size = 2; break;
- case B32_TYPE:
- case S32_TYPE:
- case U32_TYPE:
- case F32_TYPE:
- inst.data_size = 4; break;
- case B64_TYPE:
- case S64_TYPE:
- case U64_TYPE:
- case F64_TYPE:
- case FF64_TYPE:
- inst.data_size = 8; break;
- default: assert(0); break;
- }
+ insn_data_size = get_tex_datasize(pI, this); // texture obtain its data granularity from the texture info
}
// Output register information to file and stdout