Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions hta/common/trace_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ def _parse_trace_dataframe_ijson(
else:
df = _parse_trace_events_ijson(trace_file_path)

if df["ts"].dtype == np.dtype("float64"):
logger.warning(
f"Rounding down ns resolution events due to issue with events overlapping."
f" ts dtype = {df['ts'].dtype}, dur dtype = {df['dur'].dtype}."
f"Please see https://github.com/pytorch/pytorch/pull/122425"
)
# Don't floor directly, first find the end
df["end"] = df["ts"] + df["dur"]

df["ts"] = df[~df["ts"].isnull()]["ts"].apply(lambda x: math.ceil(x))
df["end"] = df[~df["end"].isnull()]["end"].apply(lambda x: math.floor(x))
df["dur"] = df["end"] - df["ts"]

# assign an index to each event
df.reset_index(inplace=True)
df["index"] = pd.to_numeric(df["index"], downcast="integer")
Expand Down