summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-07-11 11:01:27 -0400
committerMengchi Zhang <[email protected]>2019-07-11 11:01:27 -0400
commit8019833f6c9d9552c70739dc2bf45e53655666ec (patch)
tree0e4b32437b5a72fd3920774e473ece11a5ad6261 /src
parentbfd493e03d52def57152bc9195c88eef8d0a2580 (diff)
Move g_total_param_size
Signed-off-by: Mengchi Zhang <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.cc3
-rw-r--r--src/cuda-sim/cuda_device_runtime.cc3
-rw-r--r--src/cuda-sim/cuda_device_runtime.h4
-rw-r--r--src/cuda-sim/instructions.cc4
4 files changed, 8 insertions, 6 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc
index ef09051..0f4291d 100644
--- a/src/abstract_hardware_model.cc
+++ b/src/abstract_hardware_model.cc
@@ -771,8 +771,7 @@ bool kernel_info_t::children_all_finished() {
void kernel_info_t::notify_parent_finished() {
if(m_parent_kernel) {
- extern unsigned long long g_total_param_size;
- g_total_param_size -= ((m_kernel_entry->get_args_aligned_size() + 255)/256*256);
+ m_kernel_entry->gpgpu_ctx->device_runtime->g_total_param_size -= ((m_kernel_entry->get_args_aligned_size() + 255)/256*256);
m_parent_kernel->remove_child(this);
g_stream_manager()->register_finished_kernel(m_parent_kernel->get_uid());
}
diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc
index 354fa79..22304db 100644
--- a/src/cuda-sim/cuda_device_runtime.cc
+++ b/src/cuda-sim/cuda_device_runtime.cc
@@ -5,7 +5,6 @@
#include <iostream>
#include <map>
-unsigned long long g_total_param_size = 0;
unsigned long long g_max_total_param_size = 0;
@@ -70,7 +69,7 @@ std::list<device_launch_operation_t> g_cuda_device_launch_op;
//Handling device runtime api:
//void * cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize)
-void gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func)
+void cuda_device_runtime::gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func)
{
DEV_RUNTIME_REPORT("Calling cudaGetParameterBufferV2");
diff --git a/src/cuda-sim/cuda_device_runtime.h b/src/cuda-sim/cuda_device_runtime.h
index 851fed2..dd908ae 100644
--- a/src/cuda-sim/cuda_device_runtime.h
+++ b/src/cuda-sim/cuda_device_runtime.h
@@ -3,7 +3,6 @@
#if (CUDART_VERSION >= 5000)
#pragma once
-void gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
void gpgpusim_cuda_streamCreateWithFlags(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
#endif
@@ -14,10 +13,13 @@ class gpgpu_context;
class cuda_device_runtime {
public:
cuda_device_runtime( gpgpu_context* ctx ) {
+ g_total_param_size = 0;
gpgpu_ctx = ctx;
}
+ unsigned long long g_total_param_size;
// backward pointer
class gpgpu_context* gpgpu_ctx;
+ void gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
void launch_all_device_kernels();
void launch_one_device_kernel();
};
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 46a262d..a72bc0c 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -56,6 +56,8 @@ class ptx_recognizer;
#include "cuda_device_runtime.h"
#include <stdarg.h>
+#include "../../libcuda/gpgpu_context.h"
+
using half_float::half;
unsigned ptx_instruction::g_num_ptx_inst_uid=0;
@@ -2095,7 +2097,7 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
#if (CUDART_VERSION >= 5000)
//Jin: handle device runtime apis for CDP
else if(fname == "cudaGetParameterBufferV2") {
- gpgpusim_cuda_getParameterBufferV2(pI, thread, target_func);
+ target_func->gpgpu_ctx->device_runtime->gpgpusim_cuda_getParameterBufferV2(pI, thread, target_func);
return;
}
else if(fname == "cudaLaunchDeviceV2") {