Skip to content

[Frontend] Cleanup: dead code + style nits (issue #241 bundle A)#249

Open
YWHyuk wants to merge 1 commit into
developfrom
cleanup/issue-241-bundle-a
Open

[Frontend] Cleanup: dead code + style nits (issue #241 bundle A)#249
YWHyuk wants to merge 1 commit into
developfrom
cleanup/issue-241-bundle-a

Conversation

@YWHyuk
Copy link
Copy Markdown
Collaborator

@YWHyuk YWHyuk commented May 26, 2026

Summary

Trivial low-risk subset of the #241 cleanup checklist. 4 files changed, +6 / -75 lines. No semantic changes intended.

Refs #241.

Items in this PR

  • Dead code
    • `extension_op.py`: drop `generate_inner_product_matrix` (63-line function, no call sites anywhere in repo).
    • `extension_codecache.py`: simplify `w_offset` block — the `if ... w_offset = kwargs['loop_size'][-1]` branch is followed by an unconditional `w_offset = 0`, making the branch dead.
  • Copy-paste
    • `extension_codecache.py`: `TileSizeError` default message was the verbatim copy of `SpadOverflowError`'s ("SPAD overflow occurred."). Distinguished as "Tile size constraint violated.".
  • Style
    • `mlir_common.py`: drop duplicate `import sympy` (already imported 5 lines earlier).
    • `mlir_common.py`: `MLIRMultiDimTile.get_nr_dim` return annotation `-> str` → `-> int`.
    • `mlir_scheduling.py`: bare `except:` → `except Exception:` (was swallowing `KeyboardInterrupt`/`SystemExit`).
    • `mlir_scheduling.py`: drop dead `node1 = self.revert_group(node1)` rebind — `revert_group` mutates in place with no return, lvalue was rebinding to `None` immediately before `return True`.

Deferred from #241 (other PRs)

  • `sparse_mm_dummy_stonne_outer` `yield` bug — needs call-flow check (PR B).
  • `dma_write_counter` dead increment — needs constant substitution (PR B).
  • Duplicate `hash_prefix`/`get_write_path` extraction — circular-import safety check (PR C).
  • Mutable default args sweep — PR D.
  • `print()` → `logger` migration — PR E.
  • `FileLock` consolidation, template dedup — skipped per issue notes / too invasive.

Test plan

  • `python3 -m py_compile` on all four touched files
  • Smoke test on sample tests once CI runs

🤖 Generated with Claude Code

Trivial low-risk subset of the issue #241 checklist. No semantic
changes intended; verified by py_compile on each touched file.

- extension_op.py: drop generate_inner_product_matrix (63 lines, no
  call sites anywhere in the repo).
- extension_codecache.py: simplify w_offset block — the conditional
  `w_offset = kwargs['loop_size'][-1]` branch was followed by an
  unconditional `w_offset = 0`, making the branch dead. Also unrelated:
  give TileSizeError a distinct default message ("Tile size constraint
  violated.") instead of the verbatim copy of SpadOverflowError's
  ("SPAD overflow occurred.") so tracebacks distinguish them.
- mlir/mlir_common.py: drop the duplicate `import sympy` (already
  imported 5 lines earlier). Fix MLIRMultiDimTile.get_nr_dim return
  annotation `-> str` → `-> int` (returns `len(self._tile_size)`).
- mlir/mlir_scheduling.py: replace bare `except:` (was silently
  swallowing KeyboardInterrupt/SystemExit) with `except Exception:`.
  Drop dead `node1 = self.revert_group(node1)` assignment — revert_group
  mutates act_nodes in place with no return, so the lvalue was rebinding
  node1 to None and the function returned True immediately afterwards.

Refs #241.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant