Skip to content

Commit

Permalink
Ensure get_profiler_artifacts_dir respects TT_METAL_HOME by default.
Browse files Browse the repository at this point in the history
Fixes #17939.
  • Loading branch information
jasondavies authored and mo-tenstorrent committed Feb 19, 2025
1 parent 9b5f53a commit e54804e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tt_metal/api/tt-metalium/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ constexpr std::string_view PROFILER_RUNTIME_ROOT_DIR = "generated/profiler/";
constexpr std::string_view PROFILER_LOGS_DIR_NAME = ".logs/";

inline std::string get_profiler_artifacts_dir() {
std::string artifactDir = string(PROFILER_RUNTIME_ROOT_DIR);
const auto PROFILER_ARTIFACTS_DIR = std::getenv("TT_METAL_PROFILER_DIR");
if (PROFILER_ARTIFACTS_DIR != nullptr) {
artifactDir = string(PROFILER_ARTIFACTS_DIR) + "/";
std::string artifacts_dir;
if (std::getenv("TT_METAL_PROFILER_DIR")) {
artifacts_dir = std::string(std::getenv("TT_METAL_PROFILER_DIR")) + "/";
} else {
std::string prefix;
if (std::getenv("TT_METAL_HOME")) {
prefix = std::string(std::getenv("TT_METAL_HOME")) + "/";
}
artifacts_dir = prefix + std::string(PROFILER_RUNTIME_ROOT_DIR);
}
return artifactDir;
return artifacts_dir;
}

inline std::string get_profiler_logs_dir() { return get_profiler_artifacts_dir() + string(PROFILER_LOGS_DIR_NAME); }
inline std::string get_profiler_logs_dir() { return get_profiler_artifacts_dir() + std::string(PROFILER_LOGS_DIR_NAME); }

inline std::string PROFILER_ZONE_SRC_LOCATIONS_LOG = get_profiler_logs_dir() + "zone_src_locations.log";
} // namespace tt_metal
Expand Down

0 comments on commit e54804e

Please sign in to comment.