-
Notifications
You must be signed in to change notification settings - Fork 629
[Bugfix] fix custom op GmmSwigluQuantWeightNzTensorList #4593
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,6 +247,19 @@ def enable_custom_op(): | |
| Ensure that ASCEND_RT_VISIBLE_DEVICES can be dynamically modified before torch.npu.set_device(). | ||
| """ | ||
| global _CUSTOM_OP_ENABLED | ||
|
|
||
| # set custom ops path | ||
| CUR_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wangxiyuan This line causes the test tests/e2e/multicard/test_offline_inference_distributed.py::test_models_distributed_QwQ to fail.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I found it. Thanks for reminding
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| CUSTOM_OPP_PATH = os.path.join(CUR_DIR, "_cann_ops_custom", "vendors", | ||
| "vllm-ascend") | ||
| if os.path.exists(CUSTOM_OPP_PATH): | ||
| current_cust_opp_path = os.environ.get("ASCEND_CUSTOM_OPP_PATH", "") | ||
| if current_cust_opp_path: | ||
| os.environ[ | ||
| "ASCEND_CUSTOM_OPP_PATH"] = f"{CUSTOM_OPP_PATH}:{current_cust_opp_path}" | ||
| else: | ||
| os.environ["ASCEND_CUSTOM_OPP_PATH"] = CUSTOM_OPP_PATH | ||
|
|
||
| if _CUSTOM_OP_ENABLED is not None: | ||
| return _CUSTOM_OP_ENABLED | ||
| try: | ||
|
|
||
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.
The size of these output tensors depends on
n, which is calculated on line 567 from theweightTensorList (weight[0].sizes()[1]). This is unsafe because if theweightTensorList is empty, accessingweight[0]will cause a crash. It's crucial to add a check to ensureweightis not empty before its elements are accessed.For example, you could add the following check before line 567:
TORCH_CHECK(!weight.empty(), "weight tensor list cannot be empty");