Skip to content

fix: auto-disable expandable_segments around cumem memory pool#1657

Merged
AlpinDale merged 1 commit into
mainfrom
fix/cumem-expandable-seg-disable
Apr 28, 2026
Merged

fix: auto-disable expandable_segments around cumem memory pool#1657
AlpinDale merged 1 commit into
mainfrom
fix/cumem-expandable-seg-disable

Conversation

@AlpinDale

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: AlpinDale <alpindale@gmail.com>

@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: b8d48eb925

ℹ️ 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 +291 to +292
if expandable_was_enabled:
torch.cuda.memory._set_allocator_settings("expandable_segments:True")

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 Preserve disabled allocator state across nested pool scopes

Re-enabling expandable_segments on every context exit breaks nested use_memory_pool usage when PYTORCH_CUDA_ALLOC_CONF contains expandable_segments:True. Each nested call recomputes expandable_was_enabled from the environment, so an inner scope restores expandable_segments:True while an outer scope is still active, which reintroduces the exact incompatible allocator mode this context is trying to suppress and can trigger allocator failures in the remainder of the outer block.

Useful? React with 👍 / 👎.

@AlpinDale AlpinDale merged commit 939683e into main Apr 28, 2026
1 check failed
@AlpinDale AlpinDale deleted the fix/cumem-expandable-seg-disable branch April 28, 2026 08:11
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