summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan <[email protected]>2018-06-04 16:53:23 -0700
committerJonathan <[email protected]>2018-06-04 16:53:23 -0700
commit73fea7152926dbc41cf008a4ed3402cc1feeefa7 (patch)
tree29dfb7ba55669240336cd191ff9661f5234c0dc7
parent2278609c8e279e7dfba49211256e818e3152318b (diff)
parses through all ptx files, TODO: need to impl dp4a
-rw-r--r--libcuda/cuda_runtime_api.cc1
-rw-r--r--src/cuda-sim/instructions.cc7
-rw-r--r--src/cuda-sim/opcodes.def1
-rw-r--r--src/cuda-sim/ptx.l1
-rw-r--r--src/cuda-sim/ptx_loader.cc13
-rw-r--r--src/cuda-sim/ptx_parser.cc6
6 files changed, 15 insertions, 14 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index ece958e..d03caf7 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -1546,7 +1546,6 @@ void extract_ptx_files_using_cuobjdump(bool g_cdp_enabled){
void cuobjdumpParseBinary(unsigned int handle){
-
if(fatbin_registered[handle]) return;
fatbin_registered[handle] = true;
CUctx_st *context = GPGPUSim_Context();
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 35d1782..37438fa 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -2289,6 +2289,13 @@ void div_impl( const ptx_instruction *pI, ptx_thread_info *thread )
thread->set_operand_value(dst,data, i_type, thread,pI);
}
+void dp4a_impl( const ptx_instruction *pI, ptx_thread_info *thread )
+{
+ printf("instruction not implemented yet");
+ assert(0);
+
+}
+
void ex2_impl( const ptx_instruction *pI, ptx_thread_info *thread )
{
ptx_reg_t src1_data, src2_data, data;
diff --git a/src/cuda-sim/opcodes.def b/src/cuda-sim/opcodes.def
index e1b1422..2dbfb78 100644
--- a/src/cuda-sim/opcodes.def
+++ b/src/cuda-sim/opcodes.def
@@ -60,6 +60,7 @@ OP_DEF(COS_OP,cos_impl,"cos",1,4)
OP_DEF(CVT_OP,cvt_impl,"cvt",1,1)
OP_DEF(CVTA_OP,cvta_impl,"cvta",1,1)
OP_DEF(DIV_OP,div_impl,"div",1,1)
+OP_DEF(DP4A_OP,dp4a_impl,"dp4a",1,1)
OP_DEF(EX2_OP,ex2_impl,"ex2",1,4)
OP_DEF(EXIT_OP,exit_impl,"exit",1,3)
OP_DEF(FMA_OP,fma_impl,"fma",1,2)
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 908c5be..3bb0d17 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -77,6 +77,7 @@ cos TC; ptx_lval.int_value = COS_OP; return OPCODE;
cvt TC; ptx_lval.int_value = CVT_OP; return OPCODE;
cvta TC; ptx_lval.int_value = CVTA_OP; return OPCODE;
div TC; ptx_lval.int_value = DIV_OP; return OPCODE;
+dp4a TC; ptx_lval.int_value = DP4A_OP; return OPCODE;
ex2 TC; ptx_lval.int_value = EX2_OP; return OPCODE;
exit TC; ptx_lval.int_value = EXIT_OP; return OPCODE;
fma TC; ptx_lval.int_value = FMA_OP; return OPCODE;
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index 8deafc6..0348af0 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -188,19 +188,6 @@ symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source
symbol_table *gpgpu_ptx_sim_load_ptx_from_filename( const char *filename )
{
symbol_table *symtab=init_parser(filename);
- int errors = ptx_parse ();
- if ( errors ) {
- char fname[1024];
- snprintf(fname,1024,"_ptx_errors_XXXXXX");
- int fd=mkstemp(fname);
- close(fd);
- printf("GPGPU-Sim PTX: parser error detected, exiting... but first extracting .ptx to \"%s\"\n", fname);
- FILE *ptxfile = fopen(fname,"w");
- fclose(ptxfile);
- abort();
- exit(40);
- }
-
printf("GPGPU-Sim PTX: finished parsing EMBEDDED .ptx file %s\n",filename);
return symtab;
}
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index a180da9..a51799a 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -32,6 +32,8 @@
extern int ptx_error( const char *s );
extern int ptx_lineno;
+extern int ptx_parse();
+extern FILE *ptx_in;
static const struct core_config *g_shader_core_config;
void set_ptx_warp_size(const struct core_config * warp_size)
@@ -135,6 +137,10 @@ symbol_table *init_parser( const char *ptx_filename )
g_ptx_token_decode[generic_space] = "generic_space";
g_ptx_token_decode[instruction_space] = "instruction_space";
+
+ ptx_in = fopen(ptx_filename, "r");
+ ptx_parse();
+ fclose(ptx_in);
return g_global_symbol_table;
}