MoonshotAI / MoonshotAI/MoonEP

[Bug] num_sms is not validated against the current CUDA device

Open
#7 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

Buffer(num_sms=...) accepts any positive integer and stores it as the grid
size for MoonEP's cooperative communication kernels. It does not check the
value against the current CUDA device.

The parameter is presented as an SM budget, so accepting a value greater than
the device's physical SM count is surprising and defers the failure to
kernel-specific compilation or launch behavior. That produces a less useful
error than an API precondition failure.

This is not a claim that every cooperative grid larger than the physical SM
count must deadlock. CUDA's legal cooperative grid size depends on active
blocks per SM as well as the SM count. The proposed bound is a conservative
MoonEP API contract for a parameter that represents the number of SMs devoted
to communication.

Current flow

Buffer(num_sms)
      |
      +--> positivity assertion
      |
      +--> context allocation and kernel compilation
      |
      `--> cooperative grids use num_sms CTAs

Expected behavior

  • Reject booleans and non-integer values with TypeError.
  • Reject zero and negative values with ValueError.
  • Reject explicit values greater than the current device's physical SM count
    before allocating the communication context.
  • Resolve None to min(32, device_sm_count), preserving the existing default
    on larger GPUs while keeping default construction usable on smaller devices.
  • Accept the exact device SM count.

Why validate in the API?

The check is deterministic, inexpensive, and independent of a particular
compiled kernel's occupancy. It gives callers a clear configuration error
before VMM allocation or cooperative-kernel compilation begins.

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

Start at the Buffer(num_sms) entry point and trace the existing positivity assertion through device context allocation and kernel compilation. Implement the stated type, range, device-SM bound, and None-default behavior, ensuring invalid explicit values fail before allocation or compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai-infra-agents
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.