Skip to content

[BUGFIX ]'AttributeError: '_OpNamespace' '_C' object has no attribute 'silu_and_mul_nvfp4_quant' #23924

Closed
JartX wants to merge 1 commit intovllm-project:mainfrom
JartX:fix/no_att_silu_and_mul_nvfp4_quant
Closed

[BUGFIX ]'AttributeError: '_OpNamespace' '_C' object has no attribute 'silu_and_mul_nvfp4_quant' #23924
JartX wants to merge 1 commit intovllm-project:mainfrom
JartX:fix/no_att_silu_and_mul_nvfp4_quant

Conversation

@JartX
Copy link
Contributor

@JartX JartX commented Aug 29, 2025

The PR fixes the bug introduced in PR: #23671 and reported in #23916 of inference in ROCM, it only checks if the attribute exists before calling the function

@JartX JartX changed the title fix/no_att_silu_and_mul_nvfp4_quant [BUGFIX ]'AttributeError: '_OpNamespace' '_C' object has no attribute 'silu_and_mul_nvfp4_quant' Aug 29, 2025
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 addresses a bug that causes a crash on ROCM platforms by adding a check for the existence of the silu_and_mul_nvfp4_quant operator before it's used. This operator is specific to NVIDIA hardware and not available on ROCM, so adding a hasattr check is the correct way to prevent an AttributeError during the compilation's FixFunctionalizationPass. The change is correct, minimal, and effectively resolves the reported issue, improving the codebase's cross-platform compatibility.

@JartX
Copy link
Contributor Author

JartX commented Aug 29, 2025

@elvischenv Please check this out if you're so kind :)

@JartX
Copy link
Contributor Author

JartX commented Aug 29, 2025

@jeejeelee please check it, I think my solution could be improved by filtering directly by ROCM, but I would need to test it on AITER hardware, which I do not have.

@elvischenv
Copy link
Contributor

Thanks for reporting this.

Previously #10867 added torch.ops._C.silu_and_mul_quant.default(silu_and_mul + FP8 quant fusion) which should be also only available on cuda. However, that PR didn't exclude the op from ROCM arch like my PR did. My PR originally excluded torch.ops._C.silu_and_mul_nvfp4_quant.default(silu_and_mul + NVFP4 quant fusion) so that triggered this issue.

We may also need to exclude torch.ops._C.silu_and_mul_quant.default from ROCM in csrc/ops.h and csrc/torch_bindings.cpp, and maybe come up with a way to exclude these op from the common path fix_functionalization.py(like this PR did?).

@SageMoore @ProExpertProg may have comments

@JartX
Copy link
Contributor Author

JartX commented Aug 29, 2025

Good @elvischenv, thank you for the speed and cooperation, just checking if the attribute is available, and then calling the function

@mergify
Copy link

mergify bot commented Aug 30, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @JartX.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Aug 30, 2025
@JartX JartX closed this Sep 2, 2025
@JartX JartX deleted the fix/no_att_silu_and_mul_nvfp4_quant branch March 15, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants