Skip to content

memory efficent version of seismic - #134

Open
Antonio-Nappi wants to merge 2 commits into
mainfrom
feat/mem_eff_seismic
Open

memory efficent version of seismic#134
Antonio-Nappi wants to merge 2 commits into
mainfrom
feat/mem_eff_seismic

Conversation

@Antonio-Nappi

Copy link
Copy Markdown
Collaborator

I modified the implementation of Seismic in my project to be more efficient in terms of memory (deleted big but useless tensors)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6901015e38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +128
if masks.is_sparse or masks.is_sparse_csr:
return self.forward_sparse(masks, return_all=return_all)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not dispatch CSR masks to the COO-only path

When callers pass a sparse CSR mask, this branch sends it into forward_sparse, but that method immediately uses COO-only operations (coalesce()/indices()). Since the condition explicitly accepts CSR masks, SparseScore(...)(csr_mask) now raises instead of computing scores; either restrict this branch to COO tensors or convert CSR masks before calling forward_sparse.

Useful? React with 👍 / 👎.

forward() dispatched CSR masks to forward_sparse(), which immediately
calls coalesce()/indices() — COO-only ops — so SparseScore(...)(csr_mask)
raised instead of computing scores. CSC/BSR/BSC masks took the dense
path and failed there instead.

forward_sparse() now converts any non-COO layout to COO up front, and
forward() dispatches on `layout is not torch.strided` so every sparse
layout reaches it. Also adds an explicit 2D check, since the sparse path
unpacks `M, C = masks.shape`.

Co-Authored-By: Claude Opus 5 <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