Skip to content

Conversation

@leo-pony
Copy link
Collaborator

@leo-pony leo-pony commented Oct 31, 2025

…Malloc fails

What this PR does / why we need it?

Protect the scene where the first problem occurs. The execution should be interrupted when the video memory application fails, rather than waiting until an illegal address is accessed.
Test result:

  1. Exception throws normally:
d0ce7a04-4102-46cc-a981-f44421f388e6

Corresponding code:
2c58c5fa-1882-435e-8d53-7c536846945b
dc9b4dc0-76ae-4a6b-90b3-4fca9ad63ec0

  1. HBM Memory malloc test case successfully:
9766fb23-1830-43c5-b29f-fb6973a78000
  1. extern launcher test with sleep and weakup:
d1f31a03-fe07-455a-bf64-7420937d62b3

Does this PR introduce any user-facing change?

NA

How was this patch tested?

NA

…Malloc fails

Signed-off-by: leo-pony <nengjunma@outlook.com>
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances error handling by throwing exceptions upon memory allocation failures, which is a significant improvement over returning null or printing to stderr. This makes failures explicit and prevents potential crashes down the line.

My review focuses on ensuring this new exception-based error handling is robust. I've identified a few critical issues:

  • A memory leak and an unchecked malloc in my_malloc.
  • Another memory leak in my_free on an error path.
  • A misleading error message in my_free due to a copy-paste error.

I've provided code suggestions to address these issues. Once these are fixed, the PR will be in great shape.

@wangxiyuan wangxiyuan added ready read for review ready-for-test start test by label for PR labels Oct 31, 2025
@leo-pony leo-pony added ready-for-test start test by label for PR and removed ready-for-test start test by label for PR labels Oct 31, 2025
@wangxiyuan wangxiyuan merged commit 892f1ee into vllm-project:main Nov 4, 2025
65 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready read for review ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants