summaryrefslogtreecommitdiff
path: root/src/abstract_hardware_model.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/abstract_hardware_model.h')
-rw-r--r--src/abstract_hardware_model.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 9a29bc3..883e122 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -29,7 +29,9 @@
#define ABSTRACT_HARDWARE_MODEL_INCLUDED
-
+// Forward declarations
+class gpgpu_sim;
+class kernel_info_t;
enum _memory_space_t {
undefined_space=0,
@@ -964,23 +966,49 @@ size_t get_kernel_code_size( class function_info *entry );
*/
class core_t {
public:
- virtual ~core_t() {}
+ core_t( gpgpu_sim *gpu,
+ kernel_info_t *kernel,
+ unsigned warp_size,
+ unsigned threads_per_shader )
+ : m_gpu( gpu ),
+ m_kernel( kernel ),
+ m_simt_stack( NULL ),
+ m_thread( NULL ),
+ m_warp_size( warp_size )
+ {
+ m_warp_count = threads_per_shader/m_warp_size;
+ // Handle the case where the number of threads is not a
+ // multiple of the warp size
+ if ( threads_per_shader % m_warp_size != 0 ) {
+ m_warp_count += 1;
+ }
+ assert( m_warp_count * m_warp_size > 0 );
+ m_thread = ( ptx_thread_info** )
+ calloc( m_warp_count * m_warp_size,
+ sizeof( ptx_thread_info* ) );
+ initilizeSIMTStack(m_warp_count,m_warp_size);
+ }
+ virtual ~core_t() { free(m_thread); }
virtual void warp_exit( unsigned warp_id ) = 0;
virtual bool warp_waiting_at_barrier( unsigned warp_id ) const = 0;
virtual void checkExecutionStatusAndUpdate(warp_inst_t &inst, unsigned t, unsigned tid)=0;
class gpgpu_sim * get_gpu() {return m_gpu;}
- void execute_warp_inst_t(warp_inst_t &inst, unsigned warpSize, unsigned warpId =(unsigned)-1);
+ void execute_warp_inst_t(warp_inst_t &inst, unsigned warpId =(unsigned)-1);
bool ptx_thread_done( unsigned hw_thread_id ) const ;
- void updateSIMTStack(unsigned warpId, unsigned warpSize, warp_inst_t * inst);
- void initilizeSIMTStack(unsigned warps, unsigned warpsSize);
+ void updateSIMTStack(unsigned warpId, warp_inst_t * inst);
+ void initilizeSIMTStack(unsigned warp_count, unsigned warps_size);
+ void deleteSIMTStack();
warp_inst_t getExecuteWarp(unsigned warpId);
void get_pdom_stack_top_info( unsigned warpId, unsigned *pc, unsigned *rpc ) const;
kernel_info_t * get_kernel_info(){ return m_kernel;}
+ unsigned get_warp_size() const { return m_warp_size; }
protected:
class gpgpu_sim *m_gpu;
kernel_info_t *m_kernel;
simt_stack **m_simt_stack; // pdom based reconvergence context for each warp
- class ptx_thread_info ** m_thread;
+ class ptx_thread_info ** m_thread;
+ unsigned m_warp_size;
+ unsigned m_warp_count;
};