Skip to content

Add rev11 profiler harness, focused rev14 aggregation optimization, and statistical validator#11

Open
nicklasorte wants to merge 1 commit into
mainfrom
codex/create-profiling-driven-optimization-pass
Open

Add rev11 profiler harness, focused rev14 aggregation optimization, and statistical validator#11
nicklasorte wants to merge 1 commit into
mainfrom
codex/create-profiling-driven-optimization-pass

Conversation

@nicklasorte
Copy link
Copy Markdown
Owner

Motivation

  • Provide a real-input, profiling-first workflow to discover the true dominant runtime bottleneck in subchunk_agg_check_maxazi_rev11 and enable a single-surface optimization pass.
  • Ensure any optimization preserves RNG behavior and output semantics and is validated via fail-closed statistical checks that emphasize upper-tail agreement.

Description

  • Add profile_subchunk_agg_check_maxazi_rev11_real.m, a MATLAB profiling harness that runs subchunk_agg_check_maxazi_rev11 on exact real inputs, summarizes top contributors by total/self time, reports explicit timings for key helpers (monte_carlo_Pr_dBm_rev2_app, monte_carlo_super_bs_eirp_dist_rev5, monte_carlo_clutter_rev3_app), exposes off-axis/aggregation path proxies, and emits a single recommended optimization target.
  • Add subchunk_agg_check_maxazi_rev14.m, a focused optimization of rev11 that preserves RNG seeding, helper-call semantics, and function contract while optimizing only the aggregation path by factoring dB-to-linear conversions (precompute off_axis_gain_linear, convert base dBm once per MC, perform mW-domain weighted sums, then convert back with pow2db).
  • Add validate_subchunk_agg_check_maxazi_rev11_rev14_statistical.m, a validator that runs rev11 and rev14 on identical inputs, measures runtime across configurable runs, computes distributional metrics (mean, std, min, max, median, p90, p95, p99, and p99.9 when supported), applies stricter tail thresholds, prints a structured PASS/FAIL summary, and fails closed on drift.
  • All changes are additive (new files only) and constrained to a single measurable optimization surface to keep the change easy to audit.

Testing

  • New files were created and saved in-repo; no MATLAB runtime was available in this environment so the profiler/validator were not executed here.
  • A runtime check for Octave/MATLAB (octave --version) showed no interpreter present, so numeric profiling and statistical validation must be run in a MATLAB-enabled environment to produce timing/profile results.
  • The validator is preconfigured to run opts.NumTimingRuns = 3 and will raise an error on statistical drift (fail-closed) when invoked successfully.
  • Recommended test sequence to run locally in MATLAB: first call profile_subchunk_agg_check_maxazi_rev11_real(...) to identify the bottleneck, then run validate_subchunk_agg_check_maxazi_rev11_rev14_statistical(...) to verify that rev14 preserves behavior and provides the measured speedup.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e126006b0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

off_axis_summary=summarize_rows(tbl,off_axis_rows,wall_runtime_s);

% Aggregation path proxy: db2pow/pow2db/sum/max inside rev11 aggregation loop.
agg_parts={'db2pow','pow2db','sum','max'};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict aggregation proxy pattern matching

The aggregation proxy is built from substring matches and includes 'max', so match_rows will also capture unrelated functions like subchunk_agg_check_maxazi_rev11 (and any other name containing max). This inflates agg_summary.total_time_s and can bias recommended_target toward aggregation even when another helper is the true hotspot, which defeats the profiler harness’s goal of identifying the dominant bottleneck.

Useful? React with 👍 / 👎.


% Focused optimization input for STEP 4:
% convert off-axis gain once to multiplicative mW-domain factor.
off_axis_gain_linear=db2pow(off_axis_gain_matrix);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid doubling full off-axis matrix memory footprint

This line materializes a second full num_bs x num_sim_azi array while off_axis_gain_matrix is still live, which doubles peak memory before Monte Carlo aggregation begins. On large scenarios (the same ones chunking is meant to support), that extra allocation can trigger out-of-memory failures and abort runs; converting per chunk or freeing the original matrix before continuing would avoid this regression.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant