summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-08-08 07:20:16 -0800
committerTor Aamodt <[email protected]>2010-08-08 07:20:16 -0800
commit6ef41cd4671ebb8d79d3b8a2cdb33b518ec2e6cf (patch)
treee8787bd962f204c677e789dc81aa6034c7409c9e /src
parent34f6823f1ca28a0e99cd810061bbbf833f803b9c (diff)
refactoring: start moving prototypes into headers
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 7164]
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.h6
-rw-r--r--src/cuda-sim/cuda-sim.cc2
-rw-r--r--src/cuda-sim/cuda-sim.h26
-rw-r--r--src/cuda-sim/ptx_ir.cc8
-rw-r--r--src/cuda-sim/ptx_sim.h4
-rw-r--r--src/gpgpusim_entrypoint.cc6
-rw-r--r--src/gpgpusim_entrypoint.h73
7 files changed, 110 insertions, 15 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 3b3d07e..612c46d 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -3,6 +3,12 @@
#ifdef __cplusplus
+#if !defined(__VECTOR_TYPES_H__)
+struct dim3 {
+ unsigned int x, y, z;
+};
+#endif
+
class core_t {
public:
virtual ~core_t() {}
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 5f568b4..4acefe5 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -62,6 +62,8 @@
* Vancouver, BC V6T 1Z4
*/
+#include "cuda-sim.h"
+
#include "instructions.h"
#include "ptx_ir.h"
#include "ptx_sim.h"
diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h
index 83e274a..25b0cb2 100644
--- a/src/cuda-sim/cuda-sim.h
+++ b/src/cuda-sim/cuda-sim.h
@@ -1,8 +1,34 @@
#ifndef CUDASIM_H_INCLUDED
#define CUDASIM_H_INCLUDED
+#include "../abstract_hardware_model.h"
+#include <stdlib.h>
+
class memory_space;
+extern const char *g_gpgpusim_version_string;
+extern int g_ptx_sim_mode;
extern memory_space *g_global_mem;
+extern void gpgpu_ptx_sim_add_ptxstring( const char *ptx, const char *source_fname );
+extern void gpgpu_ptx_sim_main_func( const char *kernel_key, dim3 gridDim, dim3 blockDim, struct gpgpu_ptx_sim_arg *);
+extern void* gpgpu_ptx_sim_malloc( size_t count );
+extern void* gpgpu_ptx_sim_mallocarray( size_t count );
+extern void gpgpu_ptx_sim_memcpy_to_gpu( size_t dst_start_addr, const void *src, size_t count );
+extern void gpgpu_ptx_sim_memcpy_from_gpu( void *dst, size_t src_start_addr, size_t count );
+extern void gpgpu_ptx_sim_memcpy_gpu_to_gpu( size_t dst, size_t src, size_t count );
+extern void gpgpu_ptx_sim_memset( size_t dst_start_addr, int c, size_t count );
+extern void gpgpu_ptx_sim_init_memory();
+extern void gpgpu_ptx_sim_load_gpu_kernels();
+extern void gpgpu_ptx_sim_register_kernel(const char *hostFun, const char *deviceFun);
+extern void gpgpu_ptx_sim_register_const_variable(void*, const char *deviceName, size_t size );
+extern void gpgpu_ptx_sim_register_global_variable(void *hostVar, const char *deviceName, size_t size );
+extern void gpgpu_ptx_sim_memcpy_symbol(const char *hostVar, const void *src, size_t count, size_t offset, int to );
+
+extern void gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* texref, const struct cudaArray* array);
+extern void gpgpu_ptx_sim_bindNameToTexture(const char* name, const struct textureReference* texref);
+extern int gpgpu_ptx_sim_sizeofTexture(const char* name);
+extern const char* gpgpu_ptx_sim_findNamefromTexture(const struct textureReference* texref);
+extern const struct textureReference* gpgpu_ptx_sim_accessTextureofName(const char* name);
+
#endif
diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc
index e0f2316..b2c8552 100644
--- a/src/cuda-sim/ptx_ir.cc
+++ b/src/cuda-sim/ptx_ir.cc
@@ -71,14 +71,10 @@
#include <algorithm>
#include <stdarg.h>
+#include "cuda-sim.h"
+
extern unsigned g_max_regs_per_thread;
extern "C" int ptx_error( const char *s );
-void gpgpu_ptx_sim_bindTextureToArray(const struct textureReference* texref, struct cudaArray* array); //texture functions
-struct cudaArray* gpgpu_ptx_sim_accessArrayofTexture(struct textureReference* texref);
-void gpgpu_ptx_sim_bindNameToTexture(const char* name, struct textureReference* texref);
-struct textureReference* gpgpu_ptx_sim_accessTextureofName(const char* name);
-const char* gpgpu_ptx_sim_findNamefromTexture(const struct textureReference* texref);
-int gpgpu_ptx_sim_sizeofTexture(const char* name);
// the program intermediate representation...
symbol_table *g_global_symbol_table = NULL;
diff --git a/src/cuda-sim/ptx_sim.h b/src/cuda-sim/ptx_sim.h
index c2bb533..12075c8 100644
--- a/src/cuda-sim/ptx_sim.h
+++ b/src/cuda-sim/ptx_sim.h
@@ -71,10 +71,6 @@
#include "../abstract_hardware_model.h"
-struct dim3 {
- unsigned int x, y, z;
-};
-
struct gpgpu_ptx_sim_arg {
const void *m_start;
size_t m_nbytes;
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc
index b6770ea..5f0be61 100644
--- a/src/gpgpusim_entrypoint.cc
+++ b/src/gpgpusim_entrypoint.cc
@@ -62,18 +62,14 @@
* Vancouver, BC V6T 1Z4
*/
+#include "gpgpusim_entrypoint.h"
#include <stdio.h>
#include <time.h>
#include "option_parser.h"
-//#include "gpgpu-sim/gpu-sim.h"
#define MAX(a,b) (((a)>(b))?(a):(b))
-struct dim3 {
- unsigned int x, y, z;
-};
-
struct gpgpu_ptx_sim_arg *grid_params;
int g_grid_num=0;
int g_argc = 3;
diff --git a/src/gpgpusim_entrypoint.h b/src/gpgpusim_entrypoint.h
new file mode 100644
index 0000000..8de05c7
--- /dev/null
+++ b/src/gpgpusim_entrypoint.h
@@ -0,0 +1,73 @@
+/*
+ * gpgpusim_entrypoint.h
+ *
+ * Copyright © 2009 by Tor M. Aamodt, Wilson W. L. Fung, Ali Bakhoda,
+ * George L. Yuan and the University of British Columbia, Vancouver,
+ * BC V6T 1Z4, All Rights Reserved.
+ *
+ * THIS IS A LEGAL DOCUMENT BY DOWNLOADING GPGPU-SIM, YOU ARE AGREEING TO THESE
+ * TERMS AND CONDITIONS.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * NOTE: The files libcuda/cuda_runtime_api.c and src/cuda-sim/cuda-math.h
+ * are derived from the CUDA Toolset available from http://www.nvidia.com/cuda
+ * (property of NVIDIA). The files benchmarks/BlackScholes/ and
+ * benchmarks/template/ are derived from the CUDA SDK available from
+ * http://www.nvidia.com/cuda (also property of NVIDIA). The files from
+ * src/intersim/ are derived from Booksim (a simulator provided with the
+ * textbook "Principles and Practices of Interconnection Networks" available
+ * from http://cva.stanford.edu/books/ppin/). As such, those files are bound by
+ * the corresponding legal terms and conditions set forth separately (original
+ * copyright notices are left in files from these sources and where we have
+ * modified a file our copyright notice appears before the original copyright
+ * notice).
+ *
+ * Using this version of GPGPU-Sim requires a complete installation of CUDA
+ * which is distributed seperately by NVIDIA under separate terms and
+ * conditions. To use this version of GPGPU-Sim with OpenCL requires a
+ * recent version of NVIDIA's drivers which support OpenCL.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the University of British Columbia nor the names of
+ * its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * 4. This version of GPGPU-SIM is distributed freely for non-commercial use only.
+ *
+ * 5. No nonprofit user may place any restrictions on the use of this software,
+ * including as modified by the user, by any other authorized user.
+ *
+ * 6. GPGPU-SIM was developed primarily by Tor M. Aamodt, Wilson W. L. Fung,
+ * Ali Bakhoda, George L. Yuan, at the University of British Columbia,
+ * Vancouver, BC V6T 1Z4
+ */
+
+#ifndef GPGPUSIM_ENTRYPOINT_H_INCLUDED
+#define GPGPUSIM_ENTRYPOINT_H_INCLUDED
+
+#include "abstract_hardware_model.h"
+
+void gpgpu_ptx_sim_init_perf();
+int gpgpu_ptx_sim_main_perf( const char *kernel_key, struct dim3 gridDim, struct dim3 blockDim, struct gpgpu_ptx_sim_arg *grid_params );
+
+#endif