From c94744abf5f26010e50a3f0aff152a0785dcede1 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 10 Nov 2026 08:41:45 +0000 Subject: [PATCH] Inspect native code for unfavorable tiering-off scope control (refs #442) --- .github/scripts/test_frozen_scope_control.py | 35 ++++++++++++++++++++ .github/workflows/frozen-scope-control.yml | 13 +++----- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.github/scripts/test_frozen_scope_control.py b/.github/scripts/test_frozen_scope_control.py index e18b9dd88..e77004859 100644 --- a/.github/scripts/test_frozen_scope_control.py +++ b/.github/scripts/test_frozen_scope_control.py @@ -126,6 +126,41 @@ def execute(command, **kwargs): protocol = json.loads((root / 'output/protocol.json').read_text()) self.assertEqual(protocol['tieredCompilation'], setting) + def test_tiering_off_code_capture_keeps_both_controls_and_excludes_timings(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + environments = [] + + def execute(command, **kwargs): + environment = kwargs['env'] + environments.append(environment) + kwargs['stdout'].write(COMPLETE) + Path(environment['DOTNET_JitStdOutFile']).write_text( + '; Assembly listing for method Example:ScopeOnly()\n') + + parent = {'DOTNET_TieredCompilation': '1'} + with patch('sys.argv', ['control', directory, str(root / 'output'), + '--tiered-compilation', 'off', '--jit-disassembly']), \ + patch('frozen_scope_control.os.environ', parent), \ + patch('frozen_scope_control.verify', return_value='commit') as verify, \ + patch('frozen_scope_control.executable', side_effect=lambda path, scoped: (path / 'runner.dll', '4')), \ + patch('frozen_scope_control.subprocess.run', side_effect=execute): + main() + self.assertEqual(verify.call_count, 6) + self.assertEqual(len(environments), 8) + self.assertTrue(all(env['DOTNET_TieredCompilation'] == '0' for env in environments)) + self.assertTrue(all(env['DOTNET_JitDisasm'] == '*' for env in environments)) + self.assertEqual(parent, {'DOTNET_TieredCompilation': '1'}) + outcomes = json.loads((root / 'output/outcomes.json').read_text()) + self.assertEqual([item['side'] for item in outcomes], ['baseline', 'candidate', 'candidate', 'baseline'] * 2) + self.assertTrue(all(item['runtimeEnvironment'] == {'DOTNET_TieredCompilation': '0'} for item in outcomes)) + self.assertTrue(all('disassembly' in item and 'error' not in item for item in outcomes)) + self.assertTrue(all('meanNs' not in item and 'bytesPerOperation' not in item for item in outcomes)) + self.assertTrue(all('WorkloadResult' in path.read_text() for path in (root / 'output').glob('*.log'))) + protocol = json.loads((root / 'output/protocol.json').read_text()) + self.assertEqual(protocol['tieredCompilation'], 'off') + self.assertTrue(protocol['jitDisassembly']) + def test_invalid_archive_never_launches(self): with tempfile.TemporaryDirectory() as directory, \ patch('sys.argv', ['control', directory, str(Path(directory) / 'output')]), \ diff --git a/.github/workflows/frozen-scope-control.yml b/.github/workflows/frozen-scope-control.yml index ad7ca7f3f..3531badd2 100644 --- a/.github/workflows/frozen-scope-control.yml +++ b/.github/workflows/frozen-scope-control.yml @@ -34,16 +34,11 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh run download 42772012652 --name performance-42772012652-1 --dir inputs - # Same hosted job and original images; no cross-host comparison or gate retry. - - name: Observe default-tiering ABBA before runtime control + # Timing controls are retained in run 42779203851. Inspect native code in + # the unfavorable tiering-off condition; diagnostic timings are excluded. + - name: Capture native code with tiered compilation disabled if: success() || failure() - run: python3 .github/scripts/frozen_scope_control.py inputs results/default-before - - name: Observe ABBA with native tiered compilation disabled - if: success() || failure() - run: python3 .github/scripts/frozen_scope_control.py inputs results/tiering-off --tiered-compilation off - - name: Observe default-tiering ABBA after runtime control - if: success() || failure() - run: python3 .github/scripts/frozen_scope_control.py inputs results/default-after + run: python3 .github/scripts/frozen_scope_control.py inputs results/tiering-off-code --tiered-compilation off --jit-disassembly - name: Retain all outcomes and executable inputs if: always() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2