Skip to content

Commit 901a477

Browse files
committed
Bug Fixes
1 parent 98b37ef commit 901a477

6 files changed

Lines changed: 20 additions & 34 deletions

File tree

backends/qualcomm/debugger/observatory/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def main():
7272
AccuracyLens.register_dataset_patches(install_qnn_dataset_patches)
7373
Observatory.register_lens(AccuracyLens)
7474

75-
from .lenses.per_layer_accuracy import PerLayerAccuracyLens
76-
cls.register_lens(PerLayerAccuracyLens)
75+
from executorch.devtools.observatory.lenses.per_layer_accuracy import PerLayerAccuracyLens
76+
Observatory.register_lens(PerLayerAccuracyLens)
7777

7878

7979

backends/xnnpack/debugger/observatory/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
def main():
26-
from executorch.devtools.observatory.cli import (
26+
from devtools.observatory.cli import (
2727
parse_observatory_args,
2828
run_observatory,
2929
run_visualize,
@@ -52,8 +52,8 @@ def main():
5252
)
5353
obs_flags, script_path, script_argv = parse_observatory_args(usage_str=usage)
5454

55-
from executorch.devtools.observatory.observatory import Observatory
56-
from executorch.devtools.observatory.lenses.pipeline_graph_collector import (
55+
from devtools.observatory.observatory import Observatory
56+
from devtools.observatory.lenses.pipeline_graph_collector import (
5757
PipelineGraphCollectorLens,
5858
)
5959

@@ -65,12 +65,12 @@ def main():
6565
Observatory.register_lens(PipelineGraphCollectorLens)
6666

6767
if obs_flags["--accuracy"]:
68-
from executorch.devtools.observatory.lenses.accuracy import AccuracyLens
68+
from devtools.observatory.lenses.accuracy import AccuracyLens
6969

7070
Observatory.register_lens(AccuracyLens)
7171

72-
from .lenses.per_layer_accuracy import PerLayerAccuracyLens
73-
cls.register_lens(PerLayerAccuracyLens)
72+
from devtools.observatory.lenses.per_layer_accuracy import PerLayerAccuracyLens
73+
Observatory.register_lens(PerLayerAccuracyLens)
7474

7575

7676

devtools/fx_viewer/templates/view_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class ViewerController {
150150
}
151151

152152
zoomToFit() {
153-
const padding = 50;
154153
const rect = this.viewer.canvasContainer.getBoundingClientRect();
154+
const padding = Math.min(50, rect.width/5, rect.height/5);
155155
const availableW = rect.width - padding * 2;
156156
const availableH = rect.height - padding * 2;
157157

devtools/observatory/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,6 @@ return AnalysisResult(per_record_data={"step_1": record_analysis})
241241
| [REFERENCE.md](REFERENCE.md) | Contract tables, API reference, JS callbacks, performance notes |
242242
| [lenses/DEBUG_HANDLE_SYNC_ANALYSIS.md](lenses/DEBUG_HANDLE_SYNC_ANALYSIS.md) | Technical analysis of debug_handle consistency across pipeline stages |
243243

244-
## Demos
245-
246-
1. `examples/demo_graphview_accuracy_compare.py` — custom accuracy lens with per-layer graph overlays
247-
2. `examples/demo_etrecord_auto_collect.py` — ETRecord auto-collection workflow
248-
3. `examples/generate_ui_test_harness.py` — UI testing utilities
249-
250244
## Tests
251245

252246
```bash

devtools/observatory/cli.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,10 @@ def parse_observatory_args(usage_str: str | None = None):
179179
return obs_flags, script_path, script_argv
180180

181181

182-
def infer_report_dir(script_argv: list[str]) -> str:
183-
keys = ("-a", "--artifact", "-o", "--output_dir")
184-
for idx, arg in enumerate(script_argv):
185-
if arg in keys and idx + 1 < len(script_argv):
186-
return script_argv[idx + 1]
187-
if arg.startswith("--artifact="):
188-
return arg.split("=", 1)[1]
189-
if arg.startswith("--output_dir="):
190-
return arg.split("=", 1)[1]
191-
return "."
192-
193-
194182
def resolve_report_paths(
195183
obs_flags: dict[str, object], script_argv: list[str]
196184
) -> tuple[str, str]:
197-
report_dir = obs_flags["--report-dir"] or infer_report_dir(script_argv)
185+
report_dir = obs_flags["--report-dir"]
198186
report_html = obs_flags["--report-html"]
199187
report_json = obs_flags["--report-json"]
200188

devtools/observatory/observatory.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ class Observatory:
5757
_config_stack: List[Dict[str, Any]] = []
5858

5959
@classmethod
60-
def register_lens(cls, lens_cls: Type[Lens]) -> None:
60+
def register_lens(cls, lens_cls: Type[Lens], append=True) -> None:
6161
"""Register lens class and run one-time setup."""
6262

6363
if lens_cls in cls._lens_registry:
6464
return
65-
cls._lens_registry.append(lens_cls)
65+
if append:
66+
cls._lens_registry.append(lens_cls)
67+
else:
68+
cls._lens_registry.insert(0, lens_cls)
6669
try:
6770
lens_cls.setup()
6871
except Exception as exc:
@@ -80,10 +83,11 @@ def _ensure_default_lenses(cls) -> None:
8083
from .lenses.metadata import MetadataLens
8184
from .lenses.stack_trace import StackTraceLens
8285

83-
cls.register_lens(GraphLens)
84-
cls.register_lens(MetadataLens)
85-
cls.register_lens(StackTraceLens)
86-
cls.register_lens(GraphColorLens)
86+
# defaut lenses should stay in front in case other lenses depends on their data
87+
cls.register_lens(GraphColorLens, append=False)
88+
cls.register_lens(StackTraceLens, append=False)
89+
cls.register_lens(GraphLens, append=False)
90+
cls.register_lens(MetadataLens, append=False)
8791
cls._lenses_initialized = True
8892

8993
@classmethod

0 commit comments

Comments
 (0)