analytical_roofline#

Helpers for the agent-derived analytical roofline target.

The analytical-roofline skill (see skills/analytical-roofline) asks a one-shot agent session to derive an ideal, hardware-instruction-count-independent roofline target (FLOPs and bytes moved) from a task’s reference math and benchmark shapes. These helpers build that agent’s prompt and parse/validate its output; see _compute_analytical_roofline() for how the agent session itself is run.

Functions

build_analytical_roofline_prompt(task)

Build the prompt for the one-shot roofline-analysis agent.

collate_reference_profiler_feedback(task)

Textual summary of the reference's profiler data.

read_analytical_roofline_output(task_data_dir)

Parse and validate the JSON the roofline-analysis agent should have written.

read_user_supplied_analytical_roofline(task)

Check whether the task package already ships a hand-authored analytical_roofline.json.

kernelfoundry.algorithm.utils.analytical_roofline.collate_reference_profiler_feedback(task: Task) → str | None[source]#

Textual summary of the reference’s profiler data. Handed to the roofline-analysis agent just for reference.

Returns None if no reference trace data is available.

kernelfoundry.algorithm.utils.analytical_roofline.build_analytical_roofline_prompt(task: Task) → str[source]#

Build the prompt for the one-shot roofline-analysis agent.

Appends the reference’s measured profiler feedback (if available) as a sanity-check signal - see collate_reference_profiler_feedback().

kernelfoundry.algorithm.utils.analytical_roofline.read_analytical_roofline_output(task_data_dir: Path) → dict | None[source]#

Parse and validate the JSON the roofline-analysis agent should have written.

Returns None (triggering a fallback to the instruction-count roofline) if the file is missing or fails validation - this number gates an automated stopping criterion, so an unparsable or malformed agent output must never be trusted silently.

kernelfoundry.algorithm.utils.analytical_roofline.read_user_supplied_analytical_roofline(task: Task) → dict | None[source]#

Check whether the task package already ships a hand-authored analytical_roofline.json.