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.h113
1 files changed, 98 insertions, 15 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index d0af1ea..2350db4 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -36,11 +36,16 @@ class kernel_info_t;
#define MAX_CTA_PER_SHADER 32
#define MAX_BARRIERS_PER_CTA 16
+//After expanding the vector input and output operands
+#define MAX_INPUT_VALUES 24
+#define MAX_OUTPUT_VALUES 8
+
enum _memory_space_t {
undefined_space=0,
reg_space,
local_space,
shared_space,
+ sstarr_space,
param_space_unclassified,
param_space_kernel, /* global to all threads in a kernel : read-only */
param_space_local, /* local to a thread : read-writable */
@@ -77,8 +82,12 @@ enum uarch_op_t {
NO_OP=-1,
ALU_OP=1,
SFU_OP,
+ TENSOR_CORE_OP,
+ DP_OP,
ALU_SFU_OP,
LOAD_OP,
+ TENSOR_CORE_LOAD_OP,
+ TENSOR_CORE_STORE_OP,
STORE_OP,
BRANCH_OP,
BARRIER_OP,
@@ -132,7 +141,9 @@ typedef enum special_operations_t special_ops; // Required to identify for the p
enum operation_pipeline_t {
UNKOWN_OP,
SP__OP,
+ DP__OP,
SFU__OP,
+ TENSOR_CORE__OP,
MEM__OP
};
typedef enum operation_pipeline_t operation_pipeline;
@@ -235,6 +246,10 @@ public:
m_next_tid.z=0;
}
dim3 get_next_cta_id() const { return m_next_cta; }
+ unsigned get_next_cta_id_single() const
+ {
+ return m_next_cta.x + m_grid_dim.x*m_next_cta.y + m_grid_dim.x*m_grid_dim.y*m_next_cta.z;
+ }
bool no_more_ctas_to_run() const
{
return (m_next_cta.x >= m_grid_dim.x || m_next_cta.y >= m_grid_dim.y || m_next_cta.z >= m_grid_dim.z );
@@ -303,6 +318,8 @@ public:
unsigned long long start_cycle;
unsigned long long end_cycle;
unsigned m_launch_latency;
+
+ mutable bool volta_cache_config_set;
};
struct core_config {
@@ -342,6 +359,7 @@ struct core_config {
unsigned gpgpu_cache_constl1_linesize;
unsigned gpgpu_max_insn_issue_per_warp;
+ bool gmem_skip_L1D; // on = global memory access always skip the L1 cache
};
// bounded stack that implements simt reconvergence using pdom mechanism from MICRO'07 paper
@@ -362,7 +380,9 @@ public:
const simt_mask_t &get_active_mask() const;
void get_pdom_stack_top_info( unsigned *pc, unsigned *rpc ) const;
unsigned get_rp() const;
- void print(FILE*fp) const;
+ void print(FILE *fp) const;
+ void resume(char * fname) ;
+ void print_checkpoint (FILE *fout) const;
protected:
unsigned m_warp_id;
@@ -393,6 +413,7 @@ protected:
#define LOCAL_MEM_SIZE_MAX (8*1024)
#define MAX_STREAMING_MULTIPROCESSORS 64
#define MAX_THREAD_PER_SM 2048
+#define MAX_WARP_PER_SM 64
#define TOTAL_LOCAL_MEM_PER_SM (MAX_THREAD_PER_SM*LOCAL_MEM_SIZE_MAX)
#define TOTAL_SHARED_MEM (MAX_STREAMING_MULTIPROCESSORS*SHARED_MEM_SIZE_MAX)
#define TOTAL_LOCAL_MEM (MAX_STREAMING_MULTIPROCESSORS*MAX_THREAD_PER_SM*LOCAL_MEM_SIZE_MAX)
@@ -481,14 +502,28 @@ public:
const char* get_ptx_inst_debug_file() const { return g_ptx_inst_debug_file; }
int get_ptx_inst_debug_thread_uid() const { return g_ptx_inst_debug_thread_uid; }
unsigned get_texcache_linesize() const { return m_texcache_linesize; }
-
+ int get_checkpoint_option() const {return checkpoint_option; }
+ int get_checkpoint_kernel() const {return checkpoint_kernel; }
+ int get_checkpoint_CTA() const {return checkpoint_CTA; }
+ int get_resume_option() const {return resume_option; }
+ int get_resume_kernel() const {return resume_kernel; }
+ int get_resume_CTA() const {return resume_CTA; }
+ int get_checkpoint_CTA_t() const {return checkpoint_CTA_t; }
+ int get_checkpoint_insn_Y() const {return checkpoint_insn_Y; }
private:
// PTX options
int m_ptx_convert_to_ptxplus;
int m_ptx_use_cuobjdump;
int m_experimental_lib_support;
unsigned m_ptx_force_max_capability;
-
+ int checkpoint_option;
+ int checkpoint_kernel;
+ int checkpoint_CTA;
+ int resume_option;
+ int resume_kernel;
+ int resume_CTA;
+ int checkpoint_CTA_t;
+ int checkpoint_insn_Y;
int g_ptx_inst_debug_to_file;
char* g_ptx_inst_debug_file;
int g_ptx_inst_debug_thread_uid;
@@ -500,6 +535,14 @@ private:
class gpgpu_t {
public:
gpgpu_t( const gpgpu_functional_sim_config &config );
+ int checkpoint_option;
+ int checkpoint_kernel;
+ int checkpoint_CTA;
+ int resume_option;
+ int resume_kernel;
+ int resume_CTA;
+ int checkpoint_CTA_t;
+ int checkpoint_insn_Y;
void* gpu_malloc( size_t size );
void* gpu_mallocarray( size_t count );
void gpu_memset( size_t dst_start_addr, int c, size_t count );
@@ -573,6 +616,7 @@ struct gpgpu_ptx_sim_info
int cmem;
int gmem;
int regs;
+ unsigned maxthreads;
unsigned ptx_version;
unsigned sm_target;
};
@@ -610,6 +654,7 @@ public:
return false;
}
enum _memory_space_t get_type() const { return m_type; }
+ void set_type( enum _memory_space_t t ) { m_type = t; }
unsigned get_bank() const { return m_bank; }
void set_bank( unsigned b ) { m_bank = b; }
bool is_const() const { return (m_type == const_space) || (m_type == param_space_kernel); }
@@ -623,6 +668,9 @@ private:
const unsigned MAX_MEMORY_ACCESS_SIZE = 128;
typedef std::bitset<MAX_MEMORY_ACCESS_SIZE> mem_access_byte_mask_t;
+const unsigned SECTOR_CHUNCK_SIZE = 4; //four sectors
+const unsigned SECTOR_SIZE = 32 ; //sector is 32 bytes width
+typedef std::bitset<SECTOR_CHUNCK_SIZE> mem_access_sector_mask_t;
#define NO_PARTIAL_WRITE (mem_access_byte_mask_t())
#define MEM_ACCESS_TYPE_TUP_DEF \
@@ -658,6 +706,7 @@ enum cache_operator_type {
CACHE_ALL, // .ca
CACHE_LAST_USE, // .lu
CACHE_VOLATILE, // .cv
+ CACHE_L1, // .nc
// loads and stores
CACHE_STREAMING, // .cs
@@ -687,8 +736,9 @@ public:
unsigned size,
bool wr,
const active_mask_t &active_mask,
- const mem_access_byte_mask_t &byte_mask )
- : m_warp_mask(active_mask), m_byte_mask(byte_mask)
+ const mem_access_byte_mask_t &byte_mask,
+ const mem_access_sector_mask_t &sector_mask)
+ : m_warp_mask(active_mask), m_byte_mask(byte_mask), m_sector_mask(sector_mask)
{
init();
m_type = type;
@@ -704,6 +754,7 @@ public:
bool is_write() const { return m_write; }
enum mem_access_type get_type() const { return m_type; }
mem_access_byte_mask_t get_byte_mask() const { return m_byte_mask; }
+ mem_access_sector_mask_t get_sector_mask() const { return m_sector_mask; }
void print(FILE *fp) const
{
@@ -737,6 +788,7 @@ private:
mem_access_type m_type;
active_mask_t m_warp_mask;
mem_access_byte_mask_t m_byte_mask;
+ mem_access_sector_mask_t m_sector_mask;
static unsigned sm_next_access_uid;
};
@@ -756,7 +808,7 @@ public:
};
// the maximum number of destination, source, or address uarch operands in a instruction
-#define MAX_REG_OPERANDS 8
+#define MAX_REG_OPERANDS 32
struct dram_callback_t {
dram_callback_t() { function=NULL; instruction=NULL; thread=NULL; }
@@ -803,8 +855,8 @@ public:
{
fprintf(fp," [inst @ pc=0x%04x] ", pc );
}
- bool is_load() const { return (op == LOAD_OP || memory_op == memory_load); }
- bool is_store() const { return (op == STORE_OP || memory_op == memory_store); }
+ bool is_load() const { return (op == LOAD_OP ||op==TENSOR_CORE_LOAD_OP || memory_op == memory_load); }
+ bool is_store() const { return (op == STORE_OP ||op==TENSOR_CORE_STORE_OP || memory_op == memory_store); }
unsigned get_num_operands() const {return num_operands;}
unsigned get_num_regs() const {return num_regs;}
void set_num_regs(unsigned num) {num_regs=num;}
@@ -831,8 +883,10 @@ public:
address_type reconvergence_pc; // -1 => not a branch, -2 => use function return address
- unsigned out[4];
- unsigned in[4];
+ unsigned out[8];
+ unsigned outcount;
+ unsigned in[24];
+ unsigned incount;
unsigned char is_vectorin;
unsigned char is_vectorout;
int pred; // predicate register number
@@ -843,7 +897,7 @@ public:
int src[MAX_REG_OPERANDS];
} arch_reg;
//int arch_reg[MAX_REG_OPERANDS]; // register number for bank conflict evaluation
- unsigned latency; // operation latency
+ unsigned latency; // operation latency
unsigned initiation_interval;
unsigned data_size; // what is the size of the word being operated on?
@@ -931,7 +985,18 @@ public:
for(unsigned i=0; i<num_addrs; i++)
m_per_scalar_thread[n].memreqaddr[i] = addr[i];
}
-
+ void print_m_accessq(){
+
+ if(accessq_empty())
+ return;
+ else{
+ printf("Printing mem access generated\n");
+ std::list<mem_access_t>::iterator it;
+ for (it = m_accessq.begin(); it != m_accessq.end(); ++it){
+ printf("MEM_TXN_GEN:%s:%x, Size:%d \n",mem_access_type_str(it->get_type()), it->get_addr(),it->get_size());
+ }
+ }
+ }
struct transaction_info {
std::bitset<4> chunks; // bitmask: 32-byte chunks accessed
mem_access_byte_mask_t bytes;
@@ -946,9 +1011,9 @@ public:
};
void generate_mem_accesses();
- void memory_coalescing_arch_13( bool is_write, mem_access_type access_type );
- void memory_coalescing_arch_13_atomic( bool is_write, mem_access_type access_type );
- void memory_coalescing_arch_13_reduce_and_send( bool is_write, mem_access_type access_type, const transaction_info &info, new_addr_type addr, unsigned segment_size );
+ void memory_coalescing_arch( bool is_write, mem_access_type access_type );
+ void memory_coalescing_arch_atomic( bool is_write, mem_access_type access_type );
+ void memory_coalescing_arch_reduce_and_send( bool is_write, mem_access_type access_type, const transaction_info &info, new_addr_type addr, unsigned segment_size );
void add_callback( unsigned lane_id,
void (*function)(const class inst_t*, class ptx_thread_info*),
@@ -986,6 +1051,10 @@ public:
assert( !m_empty );
return m_warp_id;
}
+ unsigned warp_id_func() const // to be used in functional simulations only
+ {
+ return m_warp_id;
+ }
unsigned dynamic_warp_id() const
{
assert( !m_empty );
@@ -1065,7 +1134,21 @@ public:
void move_warp( warp_inst_t *&dst, warp_inst_t *&src );
size_t get_kernel_code_size( class function_info *entry );
+class checkpoint
+{
+public:
+
+ checkpoint();
+ ~checkpoint(){
+ printf("clasfsfss destructed\n");
+ }
+
+ void load_global_mem(class memory_space *temp_mem, char * f1name);
+ void store_global_mem(class memory_space *mem, char * fname , char * format);
+ unsigned radnom;
+
+};
/*
* This abstract class used as a base for functional and performance and simulation, it has basic functional simulation
* data structures and procedures.