From 60cbe3ee45c5edf7eaa385d77886c3b4067b66e5 Mon Sep 17 00:00:00 2001 From: Blaise Tine Date: Tue, 1 Dec 2026 08:14:56 -0800 Subject: [PATCH] review: the assertion macros do not count as stage logic (VX_ASSERT, __assert) The pipeline-stage detector and the SimX/RTL lockstep check drop the assertion and trace macros before they compare a SimX file, but their C list named only `assert`. The project's own assertion macro, `__assert` (sw/common/util.h), and its replacement name, `VX_ASSERT`, were counted as logic. A pure rename of an assertion in a SimX pipeline model was therefore classified R3 (pipeline-stage), with a lockstep warning, although nothing that is built or timed changes. - change-impact.yaml: `VX_ASSERT` and `__assert` join `c_ignore_macros` (pipeline-stage) and `simx_ignore_macros` (simx-rtl-lockstep), next to `assert`. `policy_version` 6 -> 7. - test_change_impact.py: a rename of `__assert` to `VX_ASSERT` in sim/simx/scheduler.cpp raises neither pipeline-stage nor the lockstep warning. It fails on the v6 policy and passes on v7. Checks: - `python3 ci/change_impact.py lint-policy`: OK, policy v7, 9 path rules, 16 detectors, 5 evidence checks. - `python3 -m pytest ci/test_change_impact.py`: 144 passed. - `change_impact.py replay --range origin/master --max-count 300`: R0 28 (9.3%), R1 34 (11.3%), R2 155 (51.7%), R3 83 (27.7%). This is identical to v6: no commit in that window renames an assertion in a stage file. Co-Authored-By: Claude Opus 5.5 --- ci/test_change_impact.py | 15 +++++++++++++++ docs/review/change-impact.yaml | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ci/test_change_impact.py b/ci/test_change_impact.py index 688a654b5a..07745084a2 100644 --- a/ci/test_change_impact.py +++ b/ci/test_change_impact.py @@ -494,6 +494,21 @@ def test_simx_stage_model_change_is_r3(scratch): assert "pipeline-stage" in detectors(r) +def test_simx_stage_assert_rename_is_not_r3(scratch): + repo, _ = scratch + before = SIMX.replace(" delay_ = 2;\n", " __assert(delay_ < 8, \"delay\");\n delay_ = 2;\n") + after = SIMX.replace(" delay_ = 2;\n", " VX_ASSERT(delay_ < 8, \"delay\");\n delay_ = 2;\n") + base = repo.commit({"sim/simx/scheduler.cpp": before}, "assert with the old macro") + head = repo.commit({"sim/simx/scheduler.cpp": after}, "rename the assert macro") + r = ci.Repo(repo.path) + try: + result = ci.classify(r, POLICY, base, head, "pull_request") + finally: + r.close() + assert "pipeline-stage" not in detectors(result) + assert "simx-rtl-lockstep" not in checks(result) + + def test_new_shared_stage_file_is_r3(scratch): r = run(scratch, {"hw/rtl/core/VX_ibuffer.sv": UNIT.replace("VX_unit", "VX_ibuffer")}) assert "shared pipeline stage added" in contract(r, "pipeline-stage") diff --git a/docs/review/change-impact.yaml b/docs/review/change-impact.yaml index 4a74e9d378..55cdec2067 100644 --- a/docs/review/change-impact.yaml +++ b/docs/review/change-impact.yaml @@ -177,7 +177,7 @@ detectors: class: R3 paths: ["hw/rtl/core/VX_scheduler.sv", "hw/rtl/core/VX_warp_sched.sv", "hw/rtl/core/VX_warp_sched_ctx.sv", "hw/rtl/core/VX_split_join.sv", "hw/rtl/core/VX_ipdom_stack.sv", "hw/rtl/core/VX_cta_dispatch.sv", "hw/rtl/core/VX_fetch.sv", "hw/rtl/core/VX_decompressor.sv", "hw/rtl/core/VX_ibuffer.sv", "hw/rtl/core/VX_issue.sv", "hw/rtl/core/VX_issue_slice.sv", "hw/rtl/core/VX_scoreboard.sv", "hw/rtl/core/VX_scoreboard_table.sv", "hw/rtl/core/VX_operands.sv", "hw/rtl/core/VX_opc_unit.sv", "hw/rtl/core/VX_opc_gpr_bank.sv", "hw/rtl/core/VX_dispatcher.sv", "hw/rtl/core/VX_lane_dispatch.sv", "hw/rtl/core/VX_lane_gather.sv", "hw/rtl/core/VX_commit.sv", "hw/rtl/core/VX_commit_slice.sv", "hw/rtl/core/VX_frontend_slice.sv", "hw/rtl/core/VX_frontend_xbar.sv", "hw/rtl/core/VX_compute_slice.sv", "hw/rtl/core/VX_backend_slice.sv", "sim/simx/scheduler.*", "sim/simx/cta_dispatcher.*", "sim/simx/decompressor.*", "sim/simx/scoreboard.*", "sim/simx/operands.*", "sim/simx/opc_unit.*", "sim/simx/dispatcher.*", "sim/simx/core.*"] sv_ignore_macros: ["TRACE", "RUNTIME_ASSERT", "STATIC_ASSERT", "ASSERT", "UNUSED_VAR", "UNUSED_PARAM", "UNUSED_SPARAM", "UNUSED_PIN", "TRACE_ARRAY1D", "TRACE_ARRAY2D"] - c_ignore_macros: ["DT", "DTN", "DTH", "DP", "DPN", "DPH", "assert", "__unused"] + c_ignore_macros: ["DT", "DTN", "DTH", "DP", "DPN", "DPH", "assert", "VX_ASSERT", "__assert", "__unused"] why: "Every configuration builds the shared pipeline stages (docs/guidelines/verilog/pipeline_isolation.md), so a logic change there is paid by all of them in depth, area and verification. It lands only with the V-ISO-6 justification and the maintainer's approval; a fix of the stage's own bug is the usual exception." - id: clocking @@ -197,7 +197,7 @@ evidence: simx: ["sim/simx/**"] simx_exclude: ["sim/simx/gem5/**", "sim/simx/sst/**", "sim/simx/main.cpp", "sim/simx/debug.h", "sim/simx/instr_trace.h", "sim/simx/Makefile"] rtl_ignore_macros: ["TRACE", "RUNTIME_ASSERT", "STATIC_ASSERT", "ASSERT", "UNUSED_VAR", "UNUSED_PARAM", "UNUSED_SPARAM", "UNUSED_PIN", "TRACE_ARRAY1D", "TRACE_ARRAY2D"] - simx_ignore_macros: ["DT", "DTN", "DTH", "DP", "DPN", "DPH", "assert", "__unused"] + simx_ignore_macros: ["DT", "DTN", "DTH", "DP", "DPN", "DPH", "assert", "VX_ASSERT", "__assert", "__unused"] why: "SimX is the RTL's timing model. A cycle-moving change on one side without the other is caught only by model_parity, and only for the cases it runs." - id: golden-provenance