diff options
| author | Tor Aamodt <[email protected]> | 2010-10-08 07:21:51 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-10-08 07:21:51 -0800 |
| commit | 8c2954c263b4cfd756188362919c1a16a7189788 (patch) | |
| tree | e4827655db3edb26d4668fc42e78f1e5731afa02 /src/abstract_hardware_model.h | |
| parent | 474e6d99c8efa9e3b8518eecb059546364370fd9 (diff) | |
1. refactoring cuda api code for loading PTX (removing external PTX loading entirely)
2. some bug fixes for warp_inst_t
3. creating a new class, gpgpu_t, which contains the functional "memory" state visible
to all threads running on a GPU (doing this as part of my continuing effort to hunt
down and eradicate every global variable that is not the top level "the gpu")
4. other misc. changes
Almost passing CUDA 3.1 regression? oclHistogram keeps failing under torque, but
does not fail when run on the command line from the same directory.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 7827]
Diffstat (limited to 'src/abstract_hardware_model.h')
| -rw-r--r-- | src/abstract_hardware_model.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index 15a7296..c90d56e 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -139,6 +139,44 @@ public: virtual class gpgpu_sim *get_gpu() = 0; }; +#define GLOBAL_HEAP_START 0x80000000 + // start allocating from this address (lower values used for allocating globals in .ptx file) +#define SHARED_MEM_SIZE_MAX (64*1024) +#define LOCAL_MEM_SIZE_MAX (16*1024) +#define MAX_STREAMING_MULTIPROCESSORS 64 +#define MAX_THREAD_PER_SM 1024 +#define TOTAL_LOCAL_MEM_PER_SM (MAX_THREAD_PER_SM*LOCAL_MEM_SIZE_MAX) +#define TOTAL_SHARED_MEM (MAX_STREAMING_MULTIPROCESSORS*SHARED_MEM_SIZE_MAX) +#define TOTAL_LOCAL_MEM (MAX_STREAMING_MULTIPROCESSORS*MAX_THREAD_PER_SM*LOCAL_MEM_SIZE_MAX) +#define SHARED_GENERIC_START (GLOBAL_HEAP_START-TOTAL_SHARED_MEM) +#define LOCAL_GENERIC_START (SHARED_GENERIC_START-TOTAL_LOCAL_MEM) +#define STATIC_ALLOC_LIMIT (GLOBAL_HEAP_START - (TOTAL_LOCAL_MEM+TOTAL_SHARED_MEM)) + +class gpgpu_t { +public: + gpgpu_t(); + void* gpgpu_ptx_sim_malloc( size_t size ); + void* gpgpu_ptx_sim_mallocarray( size_t count ); + void gpgpu_ptx_sim_memcpy_to_gpu( size_t dst_start_addr, const void *src, size_t count ); + void gpgpu_ptx_sim_memcpy_from_gpu( void *dst, size_t src_start_addr, size_t count ); + void gpgpu_ptx_sim_memcpy_gpu_to_gpu( size_t dst, size_t src, size_t count ); + void gpgpu_ptx_sim_memset( size_t dst_start_addr, int c, size_t count ); + + class memory_space *get_global_memory() { return g_global_mem; } + class memory_space *get_tex_memory() { return g_tex_mem; } + class memory_space *get_surf_memory() { return g_surf_mem; } + class memory_space *get_param_memory() { return g_param_mem; } + +protected: + // functional simulation state + class memory_space *g_global_mem; + class memory_space *g_tex_mem; + class memory_space *g_surf_mem; + class memory_space *g_param_mem; + + unsigned long long g_dev_malloc; +}; + struct gpgpu_ptx_sim_kernel_info { // Holds properties of the kernel (Kernel's resource use). @@ -306,6 +344,24 @@ public: m_per_scalar_thread[lane_id].callback.instruction = inst; m_per_scalar_thread[lane_id].callback.thread = thread; } + void set_active( std::vector<unsigned> &active ) + { + warp_active_mask.reset(); + for( std::vector<unsigned>::iterator i=active.begin(); i!=active.end(); ++i ) { + unsigned t = *i; + assert( t < m_warp_size ); + warp_active_mask.set(t); + } + if( m_isatomic ) { + for( unsigned i=0; i < m_warp_size; i++ ) { + if( !warp_active_mask.test(i) ) { + m_per_scalar_thread[i].callback.function = NULL; + m_per_scalar_thread[i].callback.instruction = NULL; + m_per_scalar_thread[i].callback.thread = NULL; + } + } + } + } // accessors virtual void print_insn(FILE *fp) const |
