summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-07-03 02:44:08 -0400
committerMengchi Zhang <[email protected]>2019-07-03 02:44:08 -0400
commit71eaa4e7b4aba49efef39391f3e1bb3a7e4e1529 (patch)
tree6284a884045b8f2c6b7ef115388c27deae7b69fc
parent3600ed5c59adafe40840524d19f622aa25e60dd6 (diff)
Connect gpgpu_context and GPGPUsim_ctx
Signed-off-by: Mengchi Zhang <[email protected]>
-rw-r--r--libcuda/gpgpu_context.h3
-rw-r--r--src/gpgpusim_entrypoint.cc6
-rw-r--r--src/gpgpusim_entrypoint.h10
3 files changed, 12 insertions, 7 deletions
diff --git a/libcuda/gpgpu_context.h b/libcuda/gpgpu_context.h
index dd8b51d..69341be 100644
--- a/libcuda/gpgpu_context.h
+++ b/libcuda/gpgpu_context.h
@@ -3,6 +3,7 @@
#include "cuda_api_object.h"
#include "../src/cuda-sim/ptx_loader.h"
#include "../src/cuda-sim/ptx_parser.h"
+#include "../src/gpgpusim_entrypoint.h"
class gpgpu_context {
public:
@@ -11,6 +12,7 @@ class gpgpu_context {
api = new cuda_runtime_api();
ptxinfo = new ptxinfo_data();
ptx_parser = new ptx_recognizer();
+ the_gpgpusim = new GPGPUsim_ctx(this);
}
// global list
symbol_table *g_global_allfiles_symbol_table;
@@ -18,6 +20,7 @@ class gpgpu_context {
cuda_runtime_api* api;
ptxinfo_data* ptxinfo;
ptx_recognizer* ptx_parser;
+ GPGPUsim_ctx* the_gpgpusim;
// member function list
void cuobjdumpParseBinary(unsigned int handle);
class symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num );
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc
index 476a9d4..c91a9d1 100644
--- a/src/gpgpusim_entrypoint.cc
+++ b/src/gpgpusim_entrypoint.cc
@@ -43,11 +43,11 @@ static int sg_argc = 3;
static const char *sg_argv[] = {"", "-config","gpgpusim.config"};
-struct GPGPUsim_ctx* the_gpgpusim = NULL;
+GPGPUsim_ctx* the_gpgpusim = NULL;
-struct GPGPUsim_ctx* GPGPUsim_ctx_ptr(){
+GPGPUsim_ctx* GPGPUsim_ctx_ptr(){
if(the_gpgpusim == NULL)
- the_gpgpusim = new GPGPUsim_ctx();
+ the_gpgpusim = GPGPU_Context()->the_gpgpusim;
return the_gpgpusim;
}
diff --git a/src/gpgpusim_entrypoint.h b/src/gpgpusim_entrypoint.h
index a443151..dfb82d0 100644
--- a/src/gpgpusim_entrypoint.h
+++ b/src/gpgpusim_entrypoint.h
@@ -34,11 +34,11 @@
#include <time.h>
//extern time_t g_simulation_starttime;
+class gpgpu_context;
-
-struct GPGPUsim_ctx {
-
- GPGPUsim_ctx() {
+class GPGPUsim_ctx {
+ public:
+ GPGPUsim_ctx(gpgpu_context* ctx) {
g_sim_active = false;
g_sim_done = true;
break_limit = false;
@@ -49,6 +49,7 @@ struct GPGPUsim_ctx {
g_stream_manager=NULL;
the_cude_device=NULL;
the_context=NULL;
+ gpgpu_ctx = ctx;
}
//struct gpgpu_ptx_sim_arg *grid_params;
@@ -65,6 +66,7 @@ struct GPGPUsim_ctx {
struct _cuda_device_id *the_cude_device;
struct CUctx_st* the_context;
+ gpgpu_context* gpgpu_ctx;
pthread_mutex_t g_sim_lock;