Repository navigation
fix FlashAttnOpInferSymbolicShape and FlashAttnInferMeta - #63816
Merged
zyfncg merged 5 commits intoApr 26, 2024
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
zyfncg
reviewed
Apr 24, 2024
Comment on lines
+388
to
+390
| auto batch_size = q.dims()[0]; | ||
| auto num_heads = q.dims()[2]; | ||
| auto seqlen_q_rounded = round_multiple(q.dims()[1]); |
Collaborator
There was a problem hiding this comment.
这里简单的int类型最好还是用原始的数据类型,auto表示不够直观,会提高阅读成本,增加犯错的概率
zyfncg
previously approved these changes
Apr 25, 2024
phlrain
reviewed
Apr 25, 2024
| op->result(0), symbol::TensorShapeOrDataDimExprs(out_shape)); | ||
|
|
||
| auto round_multiple = [](symbol::DimExpr x) { | ||
| auto m = symbol::DimExpr{128}; |
Collaborator
There was a problem hiding this comment.
这个地方为啥 选择128, 是kernel里面写的128么
Collaborator
Author
There was a problem hiding this comment.
cuda kernel用了基于128的round,但是XPU没有,这里暂时和cuda kernel保持一致并增加备注。
| auto m_minus_one = symbol::DimExpr{127}; | ||
| return (x + m_minus_one) / m * m; | ||
| }; | ||
| auto batch_size_expr = q.shape()[0]; |
Collaborator
There was a problem hiding this comment.
能够加一个 q.shape size 的检查,防止传入了错误的输入,这里直接core dump
phlrain
self-requested a review
April 26, 2024 03:25
phlrain
approved these changes
Apr 26, 2024
runzhech
pushed a commit
to runzhech/Paddle
that referenced
this pull request
Apr 30, 2024
…e#63816) * fix FlashAttnOpInferSymbolicShape and FlashAttnInferMeta * use int for simple value * add check and constraint * fix * add shape constraint for attention_mask
runzhech
pushed a commit
to runzhech/Paddle
that referenced
this pull request
Apr 30, 2024
…e#63816) * fix FlashAttnOpInferSymbolicShape and FlashAttnInferMeta * use int for simple value * add check and constraint * fix * add shape constraint for attention_mask
co63oc
pushed a commit
to co63oc/Paddle
that referenced
this pull request
May 10, 2024
…e#63816) * fix FlashAttnOpInferSymbolicShape and FlashAttnInferMeta * use int for simple value * add check and constraint * fix * add shape constraint for attention_mask
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Others
PR Types
Bug fixes
Description
Pcard-67164
This PR fixed FlashAttnOpInferSymbolicShape and FlashAttnInferMeta by adding shape inferring for softmax, softmax_lse and seed_offset.