summaryrefslogtreecommitdiff
path: root/src/cuda-sim/ptx_parser.cc
diff options
context:
space:
mode:
authorTim Rogers <[email protected]>2018-11-05 21:50:40 -0500
committerGitHub <[email protected]>2018-11-05 21:50:40 -0500
commit0265d747b06c18d0a1ee00fb1641032201425c97 (patch)
tree9547bddfcc1c124deac5334dfae85a4a051002c4 /src/cuda-sim/ptx_parser.cc
parent42d8d8c9b5b0eb93ff228a877fd6a5bed5cf956d (diff)
parentb150969498792d50583674947d7c240cd6a11a68 (diff)
Merge pull request #80 from AamirRaihan/dev
Merging Tensor Cores code
Diffstat (limited to 'src/cuda-sim/ptx_parser.cc')
-rw-r--r--src/cuda-sim/ptx_parser.cc47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index 6dc1f40..cf40365 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -72,6 +72,7 @@ symbol *g_label;
int g_opcode = -1;
std::list<operand_info> g_operands;
std::list<int> g_options;
+std::list<int> g_wmma_options;
std::list<int> g_scalar_type;
#define PTX_PARSE_DPRINTF(...) \
@@ -162,6 +163,7 @@ void init_instruction_state()
g_label = NULL;
g_opcode = -1;
g_options.clear();
+ g_wmma_options.clear();
g_return_var = operand_info();
init_directive_state();
}
@@ -300,6 +302,7 @@ void add_instruction()
g_operands,
g_return_var,
g_options,
+ g_wmma_options,
g_scalar_type,
g_space_spec,
g_filename,
@@ -440,6 +443,20 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
g_last_symbol->set_address( addr+addr_pad );
g_current_symbol_table->alloc_shared( num_bits/8 + addr_pad );
break;
+ case sstarr_space:
+ printf("GPGPU-Sim PTX: allocating sstarr region for \"%s\" ",
+ identifier);
+ fflush(stdout);
+ assert( (num_bits%8) == 0 );
+ addr = g_current_symbol_table->get_sstarr_next();
+ addr_pad = pad_address(addr, num_bits/8, 128);
+ printf("from 0x%x to 0x%lx (sstarr memory space)\n",
+ addr+addr_pad,
+ addr+addr_pad + num_bits/8);
+ fflush(stdout);
+ g_last_symbol->set_address( addr+addr_pad );
+ g_current_symbol_table->alloc_sstarr( num_bits/8 + addr_pad );
+ break;
case const_space:
if( array_ident == ARRAY_IDENTIFIER_NO_DIM ) {
printf("GPGPU-Sim PTX: deferring allocation of constant region for \"%s\" (need size information)\n", identifier );
@@ -615,7 +632,7 @@ void add_scalar_type_spec( int type_spec )
g_scalar_type.push_back( type_spec );
if ( g_scalar_type.size() > 1 ) {
parse_assert( (g_opcode == -1) || (g_opcode == CVT_OP) || (g_opcode == SET_OP) || (g_opcode == SLCT_OP)
- || (g_opcode == TEX_OP),
+ || (g_opcode == TEX_OP)|| (g_opcode==MMA_OP),
"only cvt, set, slct, and tex can have more than one type specifier.");
}
g_scalar_type_spec = type_spec;
@@ -655,7 +672,11 @@ void add_option( int option )
PTX_PARSE_DPRINTF("add_option");
g_options.push_back( option );
}
-
+void add_wmma_option( int option )
+{
+ PTX_PARSE_DPRINTF("add_option");
+ g_wmma_options.push_back( option );
+}
void add_double_operand( const char *d1, const char *d2 )
{
//operands that access two variables.
@@ -711,6 +732,28 @@ void add_4vector_operand( const char *d1, const char *d2, const char *d3, const
if ( s4 == null_op ) s4 = NULL;
g_operands.push_back( operand_info(s1,s2,s3,s4) );
}
+void add_8vector_operand( const char *d1, const char *d2, const char *d3, const char *d4,const char *d5,const char *d6,const char *d7,const char *d8 )
+{
+ PTX_PARSE_DPRINTF("add_8vector_operand");
+ const symbol *s1 = g_current_symbol_table->lookup(d1);
+ const symbol *s2 = g_current_symbol_table->lookup(d2);
+ const symbol *s3 = g_current_symbol_table->lookup(d3);
+ const symbol *s4 = g_current_symbol_table->lookup(d4);
+ const symbol *s5 = g_current_symbol_table->lookup(d5);
+ const symbol *s6 = g_current_symbol_table->lookup(d6);
+ const symbol *s7 = g_current_symbol_table->lookup(d7);
+ const symbol *s8 = g_current_symbol_table->lookup(d8);
+ parse_assert( s1 != NULL && s2 != NULL && s3 != NULL && s4 != NULL && s5 !=NULL && s6 !=NULL && s7 !=NULL && s8 !=NULL, "v4 component(s) missing declarations.");
+ const symbol *null_op = g_current_symbol_table->lookup("_");
+ if ( s2 == null_op ) s2 = NULL;
+ if ( s3 == null_op ) s3 = NULL;
+ if ( s4 == null_op ) s4 = NULL;
+ if ( s5 == null_op ) s5 = NULL;
+ if ( s6 == null_op ) s6 = NULL;
+ if ( s7 == null_op ) s7 = NULL;
+ if ( s8 == null_op ) s8 = NULL;
+ g_operands.push_back( operand_info(s1,s2,s3,s4,s5,s6,s7,s8) );
+}
void add_builtin_operand( int builtin, int dim_modifier )
{