Home / Function/ check_graph_breaks() — pytorch Function Reference

check_graph_breaks() — pytorch Function Reference

Architecture documentation for the check_graph_breaks() function in check_graph_breaks.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  c2499662_63b5_de3b_96c4_b5056c5f7e2b["check_graph_breaks()"]
  d15ab6c5_c213_2c26_3c09_0d3b77618de4["main()"]
  d15ab6c5_c213_2c26_3c09_0d3b77618de4 -->|calls| c2499662_63b5_de3b_96c4_b5056c5f7e2b
  99ef966d_922f_ec05_2b7f_c4712248f221["get_field()"]
  c2499662_63b5_de3b_96c4_b5056c5f7e2b -->|calls| 99ef966d_922f_ec05_2b7f_c4712248f221
  style c2499662_63b5_de3b_96c4_b5056c5f7e2b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/check_graph_breaks.py lines 26–117

def check_graph_breaks(actual_csv, expected_csv, expected_filename):
    failed = []
    improved = []

    if "rocm" in expected_filename:
        flaky_models.update(
            {
                "alexnet",
                "demucs",
                "densenet121",
                "detectron2_fcos_r_50_fpn",
                "doctr_det_predictor",
                "doctr_reco_predictor",
                "levit_128",
                "llava",
                "microbench_unbacked_tolist_sum",
                "resnet50",
                "resnet152",
                "sam",
                "sam_fast",
                "stable_diffusion_text_encoder",
                "stable_diffusion_unet",
                "timm_efficientdet",
                "torchrec_dlrm",
                "vgg16",
                # LLM
                "meta-llama/Llama-3.2-1B",
                "google/gemma-2-2b",
                "google/gemma-3-4b-it",
                "openai/whisper-tiny",
                "Qwen/Qwen3-0.6B",
                "mistralai/Mistral-7B-Instruct-v0.3",
                "openai/gpt-oss-20b",
            }
        )

    for model in actual_csv["name"]:
        graph_breaks = get_field(actual_csv, model, "graph_breaks")
        expected_graph_breaks = get_field(expected_csv, model, "graph_breaks")
        flaky = model in flaky_models

        if expected_graph_breaks is None:
            status = "MISSING:"
            improved.append(model)
        elif graph_breaks == expected_graph_breaks:
            status = "PASS_BUT_FLAKY" if flaky else "PASS"
            print(f"{model:34}  {status}")
            continue
        elif graph_breaks > expected_graph_breaks:
            if flaky:
                status = "FAIL_BUT_FLAKY:"
            else:
                status = "FAIL:"
                failed.append(model)
        elif graph_breaks < expected_graph_breaks:
            if flaky:
                status = "IMPROVED_BUT_FLAKY:"
            else:
                status = "IMPROVED:"
                improved.append(model)
        print(
            f"{model:34}  {status:19} graph_breaks={graph_breaks}, expected={expected_graph_breaks}"
        )

    msg = ""
    if failed or improved:
        if failed:
            msg += textwrap.dedent(
                f"""
            Error: {len(failed)} models have new dynamo graph breaks:
                {" ".join(failed)}

            """
            )
        if improved:
            msg += textwrap.dedent(
                f"""
            Improvement: {len(improved)} models have fixed dynamo graph breaks:
                {" ".join(improved)}

            """
            )
        sha = os.getenv("SHA1", "{your CI commit sha}")
        msg += textwrap.dedent(
            f"""
        If this change is expected, you can update `{expected_filename}` to reflect the new baseline.
        from pytorch/pytorch root, run
        `python benchmarks/dynamo/ci_expected_accuracy/update_expected.py {sha}`
        and then `git add` the resulting local changes to expected CSVs to your commit.
        """
        )
    return failed or improved, msg

Subdomains

Calls

Called By

Frequently Asked Questions

What does check_graph_breaks() do?
check_graph_breaks() is a function in the pytorch codebase.
What does check_graph_breaks() call?
check_graph_breaks() calls 1 function(s): get_field.
What calls check_graph_breaks()?
check_graph_breaks() is called by 1 function(s): main.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free