From 03606f4d7ee07cf0eb22a286c8246caf644dbab8 Mon Sep 17 00:00:00 2001 From: Adam Chatterley Date: Mon, 9 Sep 2024 13:56:22 +0200 Subject: [PATCH] core: Add option to detect kernel invariants There is already invariant detection in the the compiler, this just exposes it by adding a flag to Core Signed-off-by: Adam Chatterley --- artiq/coredevice/core.py | 9 +++++++-- artiq/dashboard/experiments.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 1e9527ba2..a7d41cc92 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -85,6 +85,8 @@ class Core: (optional). :param analyze_at_run_end: automatically trigger the core device analyzer proxy after the Experiment's run stage finishes. + :param report_invariants: report variables which are not changed inside + kernels and are thus candidates for inclusion in kernel_invariants """ kernel_invariants = { @@ -95,7 +97,8 @@ class Core: host, ref_period, analyzer_proxy=None, analyze_at_run_end=False, ref_multiplier=8, - target="rv32g", satellite_cpu_targets={}): + target="rv32g", satellite_cpu_targets={}, + report_invariants=False): self.ref_period = ref_period self.ref_multiplier = ref_multiplier self.satellite_cpu_targets = satellite_cpu_targets @@ -107,6 +110,7 @@ class Core: self.comm = CommKernel(host) self.analyzer_proxy_name = analyzer_proxy self.analyze_at_run_end = analyze_at_run_end + self.report_invariants = report_invariants self.first_run = True self.dmgr = dmgr @@ -139,7 +143,8 @@ class Core: module = Module(stitcher, ref_period=self.ref_period, - attribute_writeback=attribute_writeback) + attribute_writeback=attribute_writeback, + remarks=self.report_invariants) target = target if target is not None else self.target_cls() library = target.compile_and_link([module]) diff --git a/artiq/dashboard/experiments.py b/artiq/dashboard/experiments.py index 53323b2d4..4be556d79 100644 --- a/artiq/dashboard/experiments.py +++ b/artiq/dashboard/experiments.py @@ -187,6 +187,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow): devarg_override.lineEdit().setPlaceholderText("Override device arguments") devarg_override.lineEdit().setClearButtonEnabled(True) devarg_override.insertItem(0, "core:analyze_at_run_end=True") + devarg_override.insertItem(1, "core:report_invariants=True") self.layout.addWidget(devarg_override, 2, 3) devarg_override.setCurrentText(options["devarg_override"])