Skip to content

Apply repository-wide Ruff formatting and minimal lint cleanup for PR #49#50

Draft
gaoziqian123 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-ci-failure-formatting-check
Draft

Apply repository-wide Ruff formatting and minimal lint cleanup for PR #49#50
gaoziqian123 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-ci-failure-formatting-check

Conversation

Copilot AI commented May 26, 2026

Copy link
Copy Markdown

PR #49 is blocked by the CI lint workflow because ruff format --check reports 25 non-compliant files, including the tooling files called out in the failing job logs. This update brings the branch in line with the repository’s Ruff formatting/lint expectations with mechanical changes only.

  • Scope: formatting alignment with CI

    • Ran Ruff formatting across the repository paths flagged by CI.
    • Updated all 25 reported files, including:
      • transactional_emulator/tools/test_data_gen.py
      • transactional_emulator/tools/trace_gp.py
      • transactional_emulator/tools/view_mem.py
      • affected TVM testbench files under transactional_emulator/testbench/
  • Minimal lint-only follow-ups required by Ruff

    • Kept follow-ups strictly to Ruff-driven fixes (unused imports/vars, quoted annotations, newline/whitespace cleanup, minor string prefix cleanup).
    • No behavioral or architectural changes were introduced.
  • Representative mechanical adjustment

    # before
    _, seq, head, hlen = x.shape
    
    # after
    _, seq, head, _hlen = x.shape
Original prompt

Fix the failing CI for pull request #49 in repository AICrossSim/PLENA_Simulator.

Context:

  • A failing job was identified: GitHub Actions job 77863879002 from workflow CI.
  • The job log shows the failure is in the formatting check step:
    • uv run ruff format --check .
    • Log excerpt:
      • Would reformat: transactional_emulator/tools/test_data_gen.py
      • Would reformat: transactional_emulator/tools/trace_gp.py
      • Would reformat: transactional_emulator/tools/view_mem.py
      • 25 files would be reformatted, 8 files already formatted
      • Process completed with exit code 1
  • The workflow definition is in .github/workflows/ci.yml and confirms the failing lint job runs:
    • checkout
    • setup uv
    • uv python install 3.12
    • uv sync --no-install-project
    • uv run ruff format --check .
    • uv run ruff check .

Goal:

  • Create a pull request that fixes the CI failure by applying the repository's required Ruff formatting.
  • Focus on formatting-related changes only unless a formatting command reveals additional minimal lint issues that must also be fixed for CI to pass.
  • Use the existing PR branch if appropriate, or otherwise create a suitable fix branch from the repository default branch.

Files directly mentioned by the log and worth checking first:

  • transactional_emulator/tools/test_data_gen.py
  • transactional_emulator/tools/trace_gp.py
  • transactional_emulator/tools/view_mem.py

Important guidance:

  • Start by reproducing the formatting issue locally in the repo environment.
  • Run Ruff formatting across the repository, not just the three named files, because the log says 25 files would be reformatted.
  • After formatting, run both:
    • uv run ruff format --check .
    • uv run ruff check .
  • Keep the change set as small and mechanical as possible.
  • The outcome should be a PR that resolves the failing formatting job for PR Gw/integrate tilelang tvm #49.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for failing job 77863879002. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failing job is the format check, not a test or runtime failure.

Root cause

In the CI workflow, the failing step is:

- name: Run ruff format check
  run: uv run ruff format --check .

The logs show:

  • Would reformat: transactional_emulator/tools/test_data_gen.py
  • Would reformat: transactional_emulator/tools/trace_gp.py
  • Would reformat: transactional_emulator/tools/view_mem.py
  • 25 files would be reformatted
  • Process completed with exit code 1

So the solution is to apply the project formatter and commit the result.

Files directly referenced by the failure

Recommended fix

Run this locally at the repo root:

uv sync --no-install-project
uv run ruff format .
uv run ruff check .

Then commit the formatting changes.

Code suggestions

These files mostly fail on style/layout, not logic. Typical fixes Ruff will apply here include:

transactional_emulator/tools/test_data_gen.py

Likely reorder imports and normalize spacing around function definitions/default args.

Suggested formatted shape:

import os

import torch
from torch import nn


def generate_and_save_random_weights(
    input_dim, output_dim, filename="model_weights.pth"
):
    """
    Generates random weights for a Linear layer with the given input and output
    dimensions, and saves them in .pth format so they can be loaded with
    torch.load and used with m.load_state_dict(saved_weights).
    """
    model = nn.Linear(input_dim, output_dim)
    state_dict = model.state_dict()
    torch.save(state_dict, filename)
    print(f"Random weights saved to {filename}")


def get_weights_path(filename="model_weights.pth"):
    """
    Returns the absolute path to the weights file in the current directory.
    """
    return os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)


if __name__ == "__main__":
    generate_and_save_random_weights(128, 128, get_weights_path("model_weights.pth"))

transactional_emulator/tools/trace_gp.py

This f...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix CI failure due to formatting check Apply repository-wide Ruff formatting and minimal lint cleanup for PR #49 May 26, 2026
Copilot AI requested a review from gaoziqian123 May 26, 2026 13:10
booth-algo added a commit that referenced this pull request May 29, 2026
- PLENA_Compiler -> fix/clm60m-mlen256-mask-nan (#50): finite score-mask
  (fp_preload[2] -inf -> -6e4) eliminates the MLEN>=256 NaN; comparison_params
  spans column blocks at the physical-row stride.
- PLENA_Tools -> fix/native-mlen256-comparison (#4): reorder_stride_mode
  col_block_stride + logical-width slice + compact golden-parser support.
- emulator_runner: thread physical_rows from comparison_params into
  compare_vram_with_golden (needed by the col-block reorder).
- smolvlm2_256m.yaml: add native_32x32x4_b1 preset for sub-64 experiments.

Native CLM-60M 1-layer decoder now PASSES at MLEN=256 (allclose 100%, MSE 8.5e-6)
and MLEN=64 (100%, non-regression).
booth-algo added a commit that referenced this pull request May 29, 2026
PLENA_Compiler#50 (native MLEN>=256 NaN fix: fp_preload[2] -inf -> -6e4, plus
column-block comparison_params) merged to main as 42f1e9d. Both submodules now
track merged main (Tools 94d3508 #4, Compiler 42f1e9d #50).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants