MoonshotAI / MoonshotAI/MoonEP

Deduplicate _max_smem_per_block_optin across 5 files

Open Beginner friendly
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

Problem

The function _max_smem_per_block_optin is copy-pasted identically across 5 files:

  • moonep/prefetch.py
  • moonep/grad_reduce.py
  • moonep/dispatch_epilogue.py
  • moonep/combine_prologue.py
  • moonep/combine.py

Recommendation

Move to moonep/_common.py (which already exists and contains shared utilities like inline_ptx, grid_sync, etc.) and import from there.

Impact

Maintainability. If the function needs to change (e.g., new GPU architecture support), it currently requires editing 5 files. Should be 1.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the identical _max_smem_per_block_optin definitions in moonep/prefetch.py, moonep/grad_reduce.py, moonep/dispatch_epilogue.py, moonep/combine_prologue.py, and moonep/combine.py, then inspect the shared utilities in moonep/_common.py. Move the function there and update all five files to import it; done means the duplicate definitions are removed and each caller uses the shared utility.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.