Skip to content
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

[Tags: v2.1] Error behavior for 'res_out = flag_gems.native_dropout(inp, p, True)' #267

Closed
Dayrker opened this issue Oct 29, 2024 · 5 comments

Comments

@Dayrker
Copy link

Dayrker commented Oct 29, 2024

Describe the bug

位置:
FlagGems/tests/test_special_ops.py::test_accuracy_dropout
FlagGems/src/flag_gems/ops/dropout.py
现象:

  1. res_out = flag_gems.native_dropout(inp, p, True)使用的时候会报错
    mask0 = r0 > p
    E ^
    E IncompatibleTypeErrorImpl('invalid operands of type pointer and triton.language.fp32')
@StrongSpoon
Copy link
Collaborator

Could you please provide a demo code to recurring this error?
截屏2024-10-31 10 07 03

@Dayrker
Copy link
Author

Dayrker commented Nov 3, 2024

Could you please provide a demo code to recurring this error? 截屏2024-10-31 10 07 03

change here.
e30fa463edacd7fdc9a2898f852d4fb
then use "pytest tests/test_special_ops.py::test_accuracy_dropout"

@Dayrker
Copy link
Author

Dayrker commented Nov 3, 2024

I can also run normally with python terminal, like
image
But when using pytest, it will be that error.

@StrongSpoon
Copy link
Collaborator

This is due to the data type of operand p. Triton kernel can't accept p as numpy.float32 directly. Annotate the code "p = np.float32(p)" and this error disappears.

@Dayrker
Copy link
Author

Dayrker commented Nov 6, 2024

This is due to the data type of operand p. Triton kernel can't accept p as numpy.float32 directly. Annotate the code "p = np.float32(p)" and this error disappears.

Get it. Tanhks!

@Dayrker Dayrker closed this as completed Nov 6, 2024
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

No branches or pull requests

2 participants