summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2020-07-13 20:57:59 -0700
committerGitHub <[email protected]>2020-07-13 20:57:59 -0700
commit707b2e1e86e71fa8b3eac18337f17062422bdd2b (patch)
tree6f2fcdc6f82f09b2469bd4e21a9c17504b5be01a /src/cuda-sim
parent78a52b027e7ca30860fdf8366c08c0590f857810 (diff)
parentce3f02dc00e13ccd0a3929282231c7e0116be4b5 (diff)
Merge pull request #190 from accel-sim/dev
Merging the final bits of the 4.0 release from the ISCA paper.
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda_device_runtime.h1
-rw-r--r--src/cuda-sim/ptx-stats.cc34
-rw-r--r--src/cuda-sim/ptx_ir.h11
-rw-r--r--src/cuda-sim/ptx_loader.cc3
-rw-r--r--src/cuda-sim/ptx_parser.cc5
5 files changed, 34 insertions, 20 deletions
diff --git a/src/cuda-sim/cuda_device_runtime.h b/src/cuda-sim/cuda_device_runtime.h
index 1d661b2..b06dd24 100644
--- a/src/cuda-sim/cuda_device_runtime.h
+++ b/src/cuda-sim/cuda_device_runtime.h
@@ -43,6 +43,7 @@ class cuda_device_runtime {
std::map<void*, device_launch_config_t> g_cuda_device_launch_param_map;
std::list<device_launch_operation_t> g_cuda_device_launch_op;
unsigned g_kernel_launch_latency;
+ unsigned g_TB_launch_latency;
unsigned long long g_max_total_param_size;
bool g_cdp_enabled;
diff --git a/src/cuda-sim/ptx-stats.cc b/src/cuda-sim/ptx-stats.cc
index 9f7e760..3e96984 100644
--- a/src/cuda-sim/ptx-stats.cc
+++ b/src/cuda-sim/ptx-stats.cc
@@ -168,9 +168,10 @@ void ptx_file_line_stats_add_exec_count(const ptx_instruction *pInsn) {
void ptx_stats::ptx_file_line_stats_add_latency(unsigned pc, unsigned latency) {
const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
- ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(),
- pInsn->source_line())]
- .latency += latency;
+ if (pInsn != NULL)
+ ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(),
+ pInsn->source_line())]
+ .latency += latency;
}
// attribute dram traffic to this ptx instruction (specified by the pc)
@@ -179,9 +180,10 @@ void ptx_stats::ptx_file_line_stats_add_dram_traffic(unsigned pc,
unsigned dram_traffic) {
const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
- ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(),
- pInsn->source_line())]
- .dram_traffic += dram_traffic;
+ if (pInsn != NULL)
+ ptx_file_line_stats_tracker[ptx_file_line(pInsn->source_file(),
+ pInsn->source_line())]
+ .dram_traffic += dram_traffic;
}
// attribute the number of shared memory access cycles to a ptx instruction
@@ -191,10 +193,12 @@ void ptx_stats::ptx_file_line_stats_add_smem_bank_conflict(
unsigned pc, unsigned n_way_bkconflict) {
const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
- ptx_file_line_stats &line_stats = ptx_file_line_stats_tracker[ptx_file_line(
- pInsn->source_file(), pInsn->source_line())];
- line_stats.smem_n_way_bank_conflict_total += n_way_bkconflict;
- line_stats.smem_warp_count += 1;
+ if (pInsn != NULL) {
+ ptx_file_line_stats &line_stats = ptx_file_line_stats_tracker[ptx_file_line(
+ pInsn->source_file(), pInsn->source_line())];
+ line_stats.smem_n_way_bank_conflict_total += n_way_bkconflict;
+ line_stats.smem_warp_count += 1;
+ }
}
// attribute a non-coalesced mem access to a ptx instruction
@@ -204,10 +208,12 @@ void ptx_stats::ptx_file_line_stats_add_uncoalesced_gmem(unsigned pc,
unsigned n_access) {
const ptx_instruction *pInsn = gpgpu_ctx->pc_to_instruction(pc);
- ptx_file_line_stats &line_stats = ptx_file_line_stats_tracker[ptx_file_line(
- pInsn->source_file(), pInsn->source_line())];
- line_stats.gmem_n_access_total += n_access;
- line_stats.gmem_warp_count += 1;
+ if (pInsn != NULL) {
+ ptx_file_line_stats &line_stats = ptx_file_line_stats_tracker[ptx_file_line(
+ pInsn->source_file(), pInsn->source_line())];
+ line_stats.gmem_n_access_total += n_access;
+ line_stats.gmem_warp_count += 1;
+ }
}
// a class that tracks the inflight memory instructions of a shader core
diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h
index 8c4ad4d..4243941 100644
--- a/src/cuda-sim/ptx_ir.h
+++ b/src/cuda-sim/ptx_ir.h
@@ -1339,12 +1339,12 @@ class function_info {
memory_space *param_mem, gpgpu_t *gpu, dim3 gridDim,
dim3 blockDim);
- const struct gpgpu_ptx_sim_info *get_kernel_info() const {
+ virtual const struct gpgpu_ptx_sim_info *get_kernel_info() const {
assert(m_kernel_info.maxthreads == maxnt_id);
return &m_kernel_info;
}
- const void set_kernel_info(const struct gpgpu_ptx_sim_info &info) {
+ virtual const void set_kernel_info(const struct gpgpu_ptx_sim_info &info) {
m_kernel_info = info;
m_kernel_info.ptx_version = 10 * get_ptx_version().ver();
m_kernel_info.sm_target = get_ptx_version().target();
@@ -1380,6 +1380,11 @@ class function_info {
// backward pointer
class gpgpu_context *gpgpu_ctx;
+ protected:
+ // Registers/shmem/etc. used (from ptxas -v), loaded from ___.ptxinfo along
+ // with ___.ptx
+ struct gpgpu_ptx_sim_info m_kernel_info;
+
private:
unsigned maxnt_id;
unsigned m_uid;
@@ -1405,7 +1410,7 @@ class function_info {
// Registers/shmem/etc. used (from ptxas -v), loaded from ___.ptxinfo along
// with ___.ptx
- struct gpgpu_ptx_sim_info m_kernel_info;
+ // with ___.ptx
symbol_table *m_symtab;
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index 372bda4..4e91763 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -38,7 +38,8 @@
/// extern prototypes
-extern int ptx_error(yyscan_t yyscanner, const char *s);
+extern int ptx_error(yyscan_t yyscanner, ptx_recognizer *recognizer,
+ const char *s);
extern int ptx_lex_init(yyscan_t *scanner);
extern void ptx_set_in(FILE *_in_str, yyscan_t yyscanner);
extern int ptx_parse(yyscan_t scanner, ptx_recognizer *recognizer);
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index 549c08c..afdb41b 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -36,7 +36,8 @@ typedef void *yyscan_t;
extern int ptx_get_lineno(yyscan_t yyscanner);
extern YYSTYPE *ptx_get_lval(yyscan_t yyscanner);
-extern int ptx_error(yyscan_t yyscanner, const char *s);
+extern int ptx_error(yyscan_t yyscanner, ptx_recognizer *recognizer,
+ const char *s);
extern int ptx_lex_init(yyscan_t *scanner);
extern void ptx_set_in(FILE *_in_str, yyscan_t yyscanner);
extern FILE *ptx_get_in(yyscan_t yyscanner);
@@ -225,7 +226,7 @@ void ptx_recognizer::parse_error_impl(const char *file, unsigned line,
g_error_detected = 1;
printf("%s:%u: Parse error: %s (%s:%u)\n\n", gpgpu_ctx->g_filename,
ptx_get_lineno(scanner), buf, file, line);
- ptx_error(scanner, NULL);
+ ptx_error(scanner, this, NULL);
abort();
exit(1);
}