summaryrefslogtreecommitdiff
path: root/libcuda
diff options
context:
space:
mode:
Diffstat (limited to 'libcuda')
-rw-r--r--libcuda/cuda_api_object.h5
-rw-r--r--libcuda/cuda_runtime_api.cc2
-rw-r--r--libcuda/gpgpu_context.h2
3 files changed, 6 insertions, 3 deletions
diff --git a/libcuda/cuda_api_object.h b/libcuda/cuda_api_object.h
index 0054697..db5e6a4 100644
--- a/libcuda/cuda_api_object.h
+++ b/libcuda/cuda_api_object.h
@@ -169,9 +169,10 @@ private:
class cuda_runtime_api {
public:
- cuda_runtime_api() {
+ cuda_runtime_api( gpgpu_context* ctx ) {
g_glbmap = NULL;
g_active_device = 0; //active gpu that runs the code
+ gpgpu_ctx = ctx;
}
// global list
std::list<cuobjdumpSection*> cuobjdumpSectionList;
@@ -187,6 +188,8 @@ class cuda_runtime_api {
std::map<void *, size_t> pinned_memory_size;
glbmap_entry_t* g_glbmap;
int g_active_device; //active gpu that runs the code
+ // backward pointer
+ class gpgpu_context* gpgpu_ctx;
// member function list
void cuobjdumpInit();
void extract_code_using_cuobjdump();
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 43c5e1f..43c8bae 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -3545,7 +3545,7 @@ kernel_info_t * cuda_runtime_api::gpgpu_cuda_ptx_sim_init_grid( const char *host
}
entry->finalize(result->get_param_memory());
- g_ptx_kernel_count++;
+ gpgpu_ctx->func_sim->g_ptx_kernel_count++;
fflush(stdout);
if(g_debug_execution >= 4){
diff --git a/libcuda/gpgpu_context.h b/libcuda/gpgpu_context.h
index 2e21009..a2ae7b6 100644
--- a/libcuda/gpgpu_context.h
+++ b/libcuda/gpgpu_context.h
@@ -10,7 +10,7 @@ class gpgpu_context {
public:
gpgpu_context() {
g_global_allfiles_symbol_table = NULL;
- api = new cuda_runtime_api();
+ api = new cuda_runtime_api(this);
ptxinfo = new ptxinfo_data(this);
ptx_parser = new ptx_recognizer(this);
the_gpgpusim = new GPGPUsim_ctx(this);