Skip to content

Commit c748f82

Browse files
Liyang90awaelchliBorda
authored
Fix action_name usage in XLAProfiler (#15886)
* Fix `action_name` usage in `XLAProfiler` * add changelog * Update src/pytorch_ligh * Update xla.py Co-authored-by: awaelchli <[email protected]> Co-authored-by: Jirka Borovec <[email protected]>
1 parent a72d268 commit c748f82

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
8686
- Enhanced `reduce_boolean_decision` to accommodate `any`-analogous semantics expected by the `EarlyStopping` callback ([#15253](https://github.com/Lightning-AI/lightning/pull/15253))
8787

8888

89+
- Fixed the `XLAProfiler` not recording anything due to mismatching of action names ([#15885](https://github.com/Lightning-AI/lightning/pull/15885))
90+
91+
8992
## [1.8.4] - 2022-12-08
9093

9194
### Changed

src/pytorch_lightning/profilers/xla.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ def __init__(self, port: int = 9012) -> None:
5050
def start(self, action_name: str) -> None:
5151
import torch_xla.debug.profiler as xp
5252

53-
if action_name in self.RECORD_FUNCTIONS:
53+
# The action name is formatted as '[TYPE]{class name}.{hook name}'
54+
# Example: [LightningModule]BoringModel.training_step
55+
if action_name.split(".")[-1] in self.RECORD_FUNCTIONS:
5456
if not self._start_trace:
5557
self.server = xp.start_server(self.port)
5658
self._start_trace = True
5759

58-
if action_name in self.STEP_FUNCTIONS:
60+
if action_name.split(".")[-1] in self.STEP_FUNCTIONS:
5961
step = self._get_step_num(action_name)
6062
recording = xp.StepTrace(action_name, step_num=step)
6163
else:

0 commit comments

Comments
 (0)