ArmageddonKnight commented on a change in pull request #17376: [MXNET-1404] 
Implement storage tagging, the first half of the memory profiler
URL: https://github.com/apache/incubator-mxnet/pull/17376#discussion_r372047388
 
 

 ##########
 File path: include/mxnet/storage.h
 ##########
 @@ -26,15 +26,52 @@
 #define MXNET_STORAGE_H_
 
 #include <memory>
+#include <string>
 #include "./base.h"
 
 namespace mxnet {
 
+namespace {
+/// \brief Given a path, extract the filename.
+inline std::string __extract_fname(const std::string& path) {
+  std::size_t last_dir_pos = path.find_last_of("/\\");
+  if (last_dir_pos == std::string::npos) {
+    return path;
+  }
+  return path.substr(last_dir_pos + 1);
+}
+}  // namespace anonymous
+
+#if __GNUG__  // if compiled with GCC
+#define MXNET_STORAGE_DEFAULT_NAME_FARG(tag) \
+    std::string(tag) \
+    + "_" + __extract_fname(__FILE__) \
+    + "+" +  std::to_string(__LINE__) \
+    + "_" + __extract_fname(__builtin_FILE()) \
+    + "+" +  std::to_string(__builtin_LINE())
+#else  // !__GNUG__
+#define MXNET_STORAGE_DEFAULT_NAME_FARG(tag) \
+    std::string(tag) \
+    + "_" + __extract_fname(__FILE__) \
+    + "+" +  std::to_string(__LINE__)
+#endif  // __GNUG__
+#define MXNET_STORAGE_DEFAULT_PROFILER_SCOPE_CSTR  "<unk>:"
+
 /*!
  * \brief Storage manager across multiple devices.
  */
 class Storage {
  public:
+  enum class DataStruct {
 
 Review comment:
   Let me just remove this. Since `profiler_scope` contains information 
regarding the purpose of allocation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to