changeset e034a4566653 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e034a4566653
description:
        ruby: guard usage of GPUCoalescer code in Profiler

        the GPUCoalescer code is used in the ruby profiler regardless of
        whether or not the coalescer code has been compiled, which can
        lead to link/run time errors. here we add #ifdefs to guard the
        usage of GPUCoalescer code. eventually we should refactor this
        code to use probe points.

diffstat:

 SConstruct                        |   3 +++
 src/mem/ruby/profiler/Profiler.cc |  22 +++++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)

diffs (71 lines):

diff -r f61fbb7ceb88 -r e034a4566653 SConstruct
--- a/SConstruct        Thu Jan 19 11:59:10 2017 -0500
+++ b/SConstruct        Thu Jan 19 11:59:34 2017 -0500
@@ -1502,6 +1502,9 @@
                 "target ISA combination"
             env['USE_KVM'] = False
 
+    if env['BUILD_GPU']:
+        env.Append(CPPDEFINES=['BUILD_GPU'])
+
     # Warn about missing optional functionality
     if env['USE_KVM']:
         if not main['HAVE_PERF_ATTR_EXCLUDE_HOST']:
diff -r f61fbb7ceb88 -r e034a4566653 src/mem/ruby/profiler/Profiler.cc
--- a/src/mem/ruby/profiler/Profiler.cc Thu Jan 19 11:59:10 2017 -0500
+++ b/src/mem/ruby/profiler/Profiler.cc Thu Jan 19 11:59:34 2017 -0500
@@ -56,7 +56,24 @@
 #include "mem/protocol/RubyRequest.hh"
 #include "mem/ruby/network/Network.hh"
 #include "mem/ruby/profiler/AddressProfiler.hh"
+
+/**
+ * the profiler uses GPUCoalescer code even
+ * though the GPUCoalescer is not built for
+ * all ISAs, which can lead to run/link time
+ * errors. here we guard the coalescer code
+ * with ifdefs as there is no easy way to
+ * refactor this code without removing
+ * GPUCoalescer stats from the profiler.
+ *
+ * eventually we should use probe points
+ * here, but until then these ifdefs will
+ * serve.
+ */
+#ifdef BUILD_GPU
 #include "mem/ruby/system/GPUCoalescer.hh"
+#endif
+
 #include "mem/ruby/system/Sequencer.hh"
 
 using namespace std;
@@ -361,10 +378,12 @@
             if (seq != NULL) {
                 m_outstandReqHistSeqr.add(seq->getOutstandReqHist());
             }
+#ifdef BUILD_GPU
             GPUCoalescer *coal = ctr->getGPUCoalescer();
             if (coal != NULL) {
                 m_outstandReqHistCoalsr.add(coal->getOutstandReqHist());
             }
+#endif
         }
     }
 
@@ -423,7 +442,7 @@
                     }
                 }
             }
-
+#ifdef BUILD_GPU
             GPUCoalescer *coal = ctr->getGPUCoalescer();
             if (coal != NULL) {
                 // add all the latencies
@@ -464,6 +483,7 @@
                     }
                 }
             }
+#endif
         }
     }
 }
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to