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

【CINN】Add DSL test case for rope of llama #61130

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

Courtesy-Xs
Copy link
Contributor

@Courtesy-Xs Courtesy-Xs commented Jan 24, 2024

PR types

Others

PR changes

Others

Description

pcard-72718
This pr add DSL test case for rope of llama
Here we construct a gather + slice + concat + multiply to simulate calculation logic of rope in llama

Copy link

paddle-bot bot commented Jan 24, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@6clc 6clc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

class origin:
@to_cinn_llir
def fn_rotary(
A: DataArray((1, -1, 1, 512)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add another test case that replaces the first 1 to 64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should replace it with a symbol indeed, but dsl don't support it, so temporarily we use a constant shape 1, maybe this can be a TODO

var_2: DataArray((1, -1, 1, 256)),
var_3: DataArray((1, -1, 1, 512)),
C: DataArray((1, -1, 1, 512)),
index: DataArray((2, 1), dtype=common.Int(32)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this type be Int(64), since we will use int64 for shape now? So I guess the index value should be Int(64)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -165,8 +165,124 @@ def elementwise_add_inline_gt(
assert_llir_equal(elementwise_add_inline, elementwise_add_inline_gt)


def test_llama_rope_compute_inline():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not complete rope, maybe write "xxx_xxx_pattern"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Courtesy-Xs Courtesy-Xs merged commit 8e6d725 into PaddlePaddle:develop Jan 25, 2024
29 of 30 checks passed
eee4017 pushed a commit to eee4017/Paddle that referenced this pull request Jan 30, 2024
* add slice

* rename test case and use int64 to indexing
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

Successfully merging this pull request may close these issues.

3 participants