Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623703740
  • Loading branch information
tensorflower-gardener committed Apr 11, 2024
1 parent 003e79e commit 54bc723
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions tensorflow/core/profiler/utils/gpu_event_stats.h
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#define TENSORFLOW_CORE_PROFILER_UTILS_GPU_EVENT_STATS_H_

#include <cstdint>
#include <optional>
#include <vector>

#include "absl/strings/string_view.h"
Expand Down Expand Up @@ -44,15 +45,15 @@ struct GpuEventStats {
// Stats from XLA.
std::vector<absl::string_view> hlo_op_names;
absl::string_view hlo_module_name;
absl::optional<uint64_t> program_id;
std::optional<uint64_t> program_id;

// Stats from CUPTI.
absl::string_view kernel_details;
absl::string_view memcpy_details;
absl::optional<int64_t> correlation_id;
std::optional<int64_t> correlation_id;

// Stats derived by grouping.
absl::optional<int64_t> group_id;
std::optional<int64_t> group_id;
bool is_eager = false;
};

Expand All @@ -65,11 +66,11 @@ struct LaunchEventStats {
}

// Stats from CUPTI.
absl::optional<int64_t> device_id;
absl::optional<int64_t> correlation_id;
std::optional<int64_t> device_id;
std::optional<int64_t> correlation_id;

// Stat derived by grouping.
absl::optional<int64_t> group_id;
std::optional<int64_t> group_id;
};

} // namespace profiler
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/core/profiler/utils/op_metrics_db_utils.cc
Expand Up @@ -275,15 +275,15 @@ void AddIdleOp(OpMetricsDb& db) {
SetIdleOp(idle_time_ps, *db.add_metrics_db());
}

absl::optional<double> HostInfeedEnqueueRatio(const OpMetricsDb& db) {
std::optional<double> HostInfeedEnqueueRatio(const OpMetricsDb& db) {
if (db.total_host_infeed_enq_start_timestamp_ps_diff() > 0) {
// We use total_host_infeed_enq_start_timestamp_ps_diff to approximate the
// total host time.
return tsl::profiler::SafeDivide(
db.total_host_infeed_enq_duration_ps(),
db.total_host_infeed_enq_start_timestamp_ps_diff());
}
return absl::nullopt;
return std::nullopt;
}

OpMetricsDb CreateTfMetricsDbFromDeviceOpMetricsDb(
Expand Down

0 comments on commit 54bc723

Please sign in to comment.