Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/scripts/frozen_bdn_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
LAUNCHES = ("baseline", "candidate", "candidate", "baseline")
# Explicit original generated runner selectors; ConsumptionModel.Queue=0, Log=1.
CASES = {
"composed-consumer-unscoped": ("ConsumePipelineBenchmarks", "ComposedConsumer", "instance.ScopedHandler = false;", 1),
"concurrent": ("EndToEndBenchmarks", "ConcurrentRoundTrip", None, 8),
"scope-only-unscoped": ("ConsumePipelineBenchmarks", "ScopeOnly", "instance.ScopedHandler = false;", 1),
"scope-only": ("ConsumePipelineBenchmarks", "ScopeOnly", "instance.ScopedHandler = true;", 1),
Expand Down Expand Up @@ -113,7 +114,7 @@ def main():
parser.error("--jit-method requires a nonempty native method filter without NUL")
if not args.native_executor or args.trace_tool or args.allocation_profiler:
parser.error("--jit-method requires the native parent without other instrumentation")
if args.native_executor and (args.case not in ("concurrent", "scoped-dispatch", "scope-only", "scope-only-unscoped", "scope-resolution", "failure-dispatch-sync") or args.trace_tool):
if args.native_executor and (args.case not in ("concurrent", "scoped-dispatch", "scope-only", "scope-only-unscoped", "scope-resolution", "failure-dispatch-sync", "composed-consumer-unscoped") or args.trace_tool):
parser.error("Native parent requires a supported retained runner without an external trace launcher")
if args.allocation_profiler and args.case != "concurrent":
parser.error("Exact allocation callbacks support only the concurrent benchmark")
Expand Down Expand Up @@ -267,9 +268,9 @@ def main():
text = (args.output / f"{index}-{side}-native.log").read_text()
# Independently bind the parent's receipt to the selected original
# runner, including the parameterized ScopeOnly benchmark name.
scope_parameter = "False" if args.case == "scope-only-unscoped" else "True"
scope_parameter = "False" if args.case in ("scope-only-unscoped", "composed-consumer-unscoped") else "True"
name_argument = (f'"{benchmark}(ScopedHandler: {scope_parameter})"'
if args.case in ("scope-only", "scope-only-unscoped", "scope-resolution")
if args.case in ("scope-only", "scope-only-unscoped", "scope-resolution", "composed-consumer-unscoped")
else f'"{benchmark}(SuspendHandler: False)"' if args.case == "failure-dispatch-sync"
else benchmark)
expected = f"--benchmarkName {name_argument} --job Default --benchmarkId {runners[side][1]}"
Expand Down
36 changes: 36 additions & 0 deletions .github/scripts/test_frozen_bdn_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,42 @@ def execute(command, **kwargs):
main()
self.assertEqual(len(calls), 4)

def test_unscoped_composed_native_identity_and_all_outcomes(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
for side in ("baseline", "candidate"):
source, image = self.fixture(root / "performance-builds" / side)
text = source.read_text().replace("EndToEndBenchmarks", "ConsumePipelineBenchmarks").replace("ConcurrentRoundTrip()", "ComposedConsumer()").replace("OperationsPerInvoke = 8", "OperationsPerInvoke = 1").replace("workloadDelegate =", "instance.ScopedHandler = false; workloadDelegate =")
source.write_text(text + text.replace("Runnable_10", "Runnable_11").replace("ScopedHandler = false", "ScopedHandler = true"))
self.assertEqual(executable(root / "performance-builds" / side, "composed-consumer-unscoped"), (image.resolve(), "10"))
output = root / "results"
calls = []

def execute(command, **kwargs):
calls.append(command)
self.assertEqual(command[-1], "composed-consumer-unscoped")
Path(command[-2]).write_text(json.dumps({"FoundExecutable": True, "ExitCode": 0,
"IsSuccess": True, "Errors": [],
"benchmarkArguments": '--benchmarkName "Relayer.Benchmarks.ConsumePipelineBenchmarks.ComposedConsumer(ScopedHandler: False)" --job Default --benchmarkId 10',
"selectedCase": "composed-consumer-unscoped", "operationsPerInvoke": 1}))
Path(command[-3]).write_text(COMPLETE.replace("65536", "9"))
if len(calls) == 2:
raise subprocess.CalledProcessError(1, command)

with patch("sys.argv", ["control", str(root), str(output), "--case", "composed-consumer-unscoped",
"--native-executor", str(root / "host.dll")]), \
patch("frozen_bdn_control.verify", return_value="frozen"), \
patch("frozen_bdn_control.subprocess.run", side_effect=execute):
with self.assertRaisesRegex(SystemExit, "launches failed"):
main()
self.assertEqual(len(calls), 4)
outcomes = json.loads((output / "outcomes.json").read_text())
self.assertIn("error", outcomes[1])
self.assertEqual([row["operations"] for row in outcomes if "error" not in row], [9, 9, 9])
source.write_text(text.replace("ScopedHandler = false", "ScopedHandler = true"))
with self.assertRaisesRegex(ValueError, "selected parameter"):
executable(root / "performance-builds" / "candidate", "composed-consumer-unscoped")

def test_unscoped_scope_selector_rejects_true_parameter(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/frozen-bdn-control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
- scope-only
- scope-only-unscoped
- scoped-dispatch
- composed-consumer-unscoped
- log-composed
- queue-composed
- queue-native
Expand Down
7 changes: 4 additions & 3 deletions tools/FrozenNativeHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if (args.Length is not (5 or 6))
{
Console.Error.WriteLine("Usage: FrozenNativeHost <original-image> <benchmark-id> <dotnet-wrapper> <native-log> <receipt> [concurrent|scoped-dispatch|scope-only|scope-only-unscoped|scope-resolution|failure-dispatch-sync]");
Console.Error.WriteLine("Usage: FrozenNativeHost <original-image> <benchmark-id> <dotnet-wrapper> <native-log> <receipt> [concurrent|scoped-dispatch|scope-only|scope-only-unscoped|scope-resolution|failure-dispatch-sync|composed-consumer-unscoped]");
return 2;
}

Expand All @@ -27,6 +27,7 @@
var selectedCase = args.Length == 6 ? args[5] : "concurrent";
var (owner, methodName, operations) = selectedCase switch
{
"composed-consumer-unscoped" => ("ConsumePipelineBenchmarks", "ComposedConsumer", 1),
"concurrent" => ("EndToEndBenchmarks", "ConcurrentRoundTrip", 8),
"scope-only" or "scope-only-unscoped" => ("ConsumePipelineBenchmarks", "ScopeOnly", 1),
"scope-resolution" => ("ConsumePipelineBenchmarks", "ScopeAndHandlerResolution", 1),
Expand All @@ -39,8 +40,8 @@
// The inventoried generated runner ID selects the parameter and original job.
// The descriptor supplies only the method name required by the native executor.
var descriptor = new Descriptor(type, method, operationsPerInvoke: operations);
var scopeOnly = selectedCase is "scope-only" or "scope-only-unscoped" or "scope-resolution";
var scopedHandler = selectedCase != "scope-only-unscoped";
var scopeOnly = selectedCase is "scope-only" or "scope-only-unscoped" or "scope-resolution" or "composed-consumer-unscoped";
var scopedHandler = selectedCase is not ("scope-only-unscoped" or "composed-consumer-unscoped");
ParameterInstance[] parameters = scopeOnly
? [new(new ParameterDefinition("ScopedHandler", false, [scopedHandler], false, typeof(bool), 0), scopedHandler, BenchmarkDotNet.Reports.SummaryStyle.Default)]
: selectedCase == "failure-dispatch-sync"
Expand Down
21 changes: 21 additions & 0 deletions website/docs/contributing/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,27 @@ or prove the raw-client 5% or zero-allocation budgets. Use allocation stacks and
appropriate controls before assigning bytes to a particular component. Document
remaining uncertainty rather than changing thresholds to make a signal pass.

The **Frozen original BenchmarkDotNet engine control** workflow accepts
`benchmark_case=composed-consumer-unscoped` with `parent=native`,
`performance_run=43456694323` and `runtime_version=10.0.15` through
`workflow_dispatch`. Use `same_image=abba` for a separately predeclared
baseline/candidate/candidate/baseline sequence. This reuses the original generated
runner, default job, native pipe parent and exact runtime selection. All three
original build inventories are checked before and after execution; the final A
slot repeats the first baseline image. Retain every launch log, native receipt,
operation count, timing, allocation observation and failure with the executable
inputs. These new executions cannot identify the historical cause or establish
throughput equivalence; host drift and adaptive operation counts remain
limitations. This does not rerun or relax the strict regression gate.

For a separately declared code-generation question, use the same workflow.
Its optional `jit_method` captures native JIT listings in the child only; `*`
retains all emitted methods, including async state machines. Retain all four
outcomes and listings. Exclude instrumented timings and allocations from
performance comparisons. Listings cannot reconstruct historical code, prove
which tier executed during measurements, or establish completeness for inlined,
precompiled or interleaved methods.

Startup allocation totals remain visible but are informational. D18 sets an
allocation budget per message and a time budget for startup. Building frozen
dispatch tables can allocate different bucket layouts across processes because
Expand Down
Loading