diff --git a/kernel_perf_agent/kernel_opt/profiler/ncu_profiler.py b/kernel_perf_agent/kernel_opt/profiler/ncu_profiler.py index 350c1e1..69a3a69 100644 --- a/kernel_perf_agent/kernel_opt/profiler/ncu_profiler.py +++ b/kernel_perf_agent/kernel_opt/profiler/ncu_profiler.py @@ -361,7 +361,10 @@ def load_ncu_metrics( # Drop the units row (first row often contains units like "%", "inst", etc.) if len(sub) > 0: - first_row_str = sub.iloc[0].astype(str).str.lower() + # ``.str.lower()`` propagates NaN/pd.NA cells back to float NaN, which + # would crash the ``tok in x`` substring check below. ``fillna("")`` + # makes the detection NaN-safe without changing the matching logic. + first_row_str = sub.iloc[0].astype(str).str.lower().fillna("") unit_tokens = ("%", "inst", "cycle", "block", "register", "register/thread") if first_row_str.apply(lambda x: any(tok in x for tok in unit_tokens)).any(): sub = sub.iloc[1:].reset_index(drop=True)