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

Draft: [onert] Support RoPE operation #14090

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ys44kim
Copy link
Contributor

@ys44kim ys44kim commented Sep 25, 2024

This commit supports RoPE Operation for onert

ONE-DCO-1.0-Signed-off-by: youngsik kim [email protected]

@ys44kim ys44kim marked this pull request as draft September 25, 2024 08:52
@ys44kim ys44kim marked this pull request as draft September 25, 2024 08:52
@ys44kim ys44kim added the DRAFT A draft issue or PR for sharing one's current working status and discussion. label Sep 26, 2024
@ys44kim ys44kim mentioned this pull request Sep 26, 2024
5 tasks
@ys44kim ys44kim force-pushed the draft/onert/rope branch 2 times, most recently from f3f19e3 to c43dfa6 Compare September 30, 2024 08:47
This commit supports RoPE for onerte

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
- check data type of sin/cos input

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
This commit adds cker test for RoPE

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
This commit change assert to throw in cker rope

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
@ys44kim ys44kim changed the title Draft: [onert] Support RoPE operation [WIP] Draft: [onert] Support RoPE operation Oct 2, 2024
kGptNeox = 0,
kGptJ = 1,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was added to support two modes (GPT-NEOX, GPT-J) of RoPE.
Currently, only GPT-NEOX is supported.

throw std::runtime_error("the dimension(3) of input and sin_table do not match");

if (input_shape.Dims(3) != cos_table_shape.Dims(3))
throw std::runtime_error("the dimension(3) of input and cos_table do not match");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the sin/cos table and input dim(3) are different, an error occurs in the following operation
and it is processed as throw.

auto input_tensor = _tensor_reg->getPortableTensor(input_index);
auto sin_tensor = _tensor_reg->getPortableTensor(sin_table);
auto cos_tensor = _tensor_reg->getPortableTensor(cos_table);
auto output_tensor = _tensor_reg->getPortableTensor(output_index);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current implementation has three inputs(input, sin_table, and cos_table)
so, input the sin/cos table at the upper layer (ex.app).

This commit adds cker test for RoPE

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
}
}
}
else
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BUILD_TYPE = Release

before fuse

$ ./Product/x86_64-linux.release/out/bin/onert_run ~/model/rope/Net_RoPE_000.circle

===================================
MODEL_LOAD   takes 0.251 ms
PREPARE      takes 3.557 ms
EXECUTE      takes 0.036 ms
- MEAN     :  0.036 ms
- MAX      :  0.036 ms
- MIN      :  0.036 ms
- GEOMEAN  :  0.036 ms
===================================

after fuse

$ ./Product/x86_64-linux.release/out/bin/onert_run ~/model/rope/RoPE_000.circle

===================================
MODEL_LOAD   takes 0.169 ms
PREPARE      takes 2.384 ms
EXECUTE      takes 0.020 ms
- MEAN     :  0.020 ms
- MAX      :  0.020 ms
- MIN      :  0.020 ms
- GEOMEAN  :  0.020 ms
===================================

@ys44kim
Copy link
Contributor Author

ys44kim commented Oct 2, 2024

@glistening @hseok-oh @ragmani @zetwhite
this pr is draft of rope in onert
please review it.

This commit restore the wrong code applied

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
This commit adds data type for RoPE

ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
@ys44kim
Copy link
Contributor Author

ys44kim commented Oct 4, 2024

@nnfw-bot test-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DRAFT A draft issue or PR for sharing one's current working status and discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant