-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[Kernel][Misc] Add meta functions for ops to prevent graph breaks #6917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge). To run full CI, you can do one of these:
🚀 |
3713ec3 to
63c42c7
Compare
|
/ready |
97a11f1 to
f015312
Compare
vllm/worker/model_runner.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain the rationale here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a different set of failures when fullgraph=True. Not just graph breaks but actual dynamo errors. Locally, I am switching between full/not-full constantly to test things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you send me the specific case where fullgraph fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably more but these all fail with fullgraph=True and pass with fullgraph=False
FAILED tests/models/test_gguf.py::test_models[1-5-32-half-model0] - torch._dynamo.exc.Unsupported: hasattr TensorVariable shard_size
FAILED tests/models/test_gguf.py::test_models[1-5-32-half-model1] - torch._dynamo.exc.InternalTorchDynamoError: 'SymNodeVariable' object has no attribute 'value'
FAILED tests/models/test_gguf.py::test_models[1-5-32-half-model2] - torch._dynamo.exc.Unsupported: hasattr TensorVariable shard_size
FAILED tests/models/test_gguf.py::test_models[1-5-32-half-model3] - torch._dynamo.exc.Unsupported: hasattr TensorVariable shard_size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe torch.library.define is generally not necessary. We should use high-level APIs listed in https://pytorch.org/docs/main/library.html .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using custom_op here but it couldn't deal with the window_size tuple so I ended up sticking with define
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the longer term answer is to move the registration into the flash attn module itself once it is pulled into the main vllm build process.
f4f903f to
4307e87
Compare
f326f49 to
2961f59
Compare
7ab9b00 to
0168f9e
Compare
0168f9e to
c93c029
Compare
vllm/worker/model_runner.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this for now, but after I port the technique to skip dynamo guard evaluation overhead, this should not be necessary anymore.
vllm/model_executor/models/jamba.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pytorch had a problem with the set() here. It was one of the things fixed in the nightly version but not in 2.4. Using set also didn't seem to be particularly useful either so I left it as a range.
youkaichao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the pr and sorry for keeping you waiting for so long!
the registration for the quantization kernels makes sense to me. but I don't understand the rest changes.
01622d5 to
c04d24e
Compare
c04d24e to
12c845a
Compare
youkaichao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the great pr!
we can further discuss if we need to fix the graph breaks ourselves or pytorch team will fix them.
Co-authored-by: Sage Moore <[email protected]>
| try: | ||
| torch.ops._C.gptq_marlin_24_gemm # noqa B018 | ||
|
|
||
| @torch.library.register_fake("_C::gptq_marlin_24_gemm") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This again breaks compatibility with torch < 2.4
Co-authored-by: Sage Moore <[email protected]> Signed-off-by: Alvant <[email protected]>
Co-authored-by: Sage Moore <[email protected]> Signed-off-by: Amit Garg <[email protected]>
Co-authored-by: Sage Moore <[email protected]> Signed-off-by: LeiWang1999 <[email protected]>
Miscellaneous changes to support
torch.compilein vLLM.Tensorsince it is allocated on the CPU.Note: opcheck does not seem to work with
torch.float8_e4m3fn. It complains thatmul_cudais not supported for that type.PR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Model]for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]For changes on the vLLM frontend (e.g., OpenAI API server,LLMclass, etc.)[Kernel]for changes affecting CUDA kernels or other compute kernels.[Core]for changes in the core vLLM logic (e.g.,LLMEngine,AsyncLLMEngine,Scheduler, etc.)[Hardware][Vendor]for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.shto format your code.docs/source/if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-requiredand might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-requiredlabel on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!