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

[TensorV2] Multiplication support #2419

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

djeong20
Copy link
Contributor

This PR adds support for performing the multiplication operation on two tensors.

Changes proposed in this PR:

  • TensorV2 includes member functions to perform tensor multiplication.
  • FloatTensor and HalfTensor take TensorV2 as input/output to perform multiplication.

Self-evaluation:

  1. Build test: [X]Passed [ ]Failed [ ]Skipped
  2. Run test: [X]Passed [ ]Failed [ ]Skipped

@taos-ci
Copy link
Collaborator

taos-ci commented Jan 22, 2024

📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #2419. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/.

Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@djeong20, 💯 All CI checkers are successfully verified. Thanks.

@djeong20 djeong20 changed the title [Wait for #2416][TensorV2] Multiplication support [TensorV2] Multiplication support Jan 25, 2024
Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@djeong20, 💯 All CI checkers are successfully verified. Thanks.

@djeong20 djeong20 closed this Jan 25, 2024
@djeong20 djeong20 deleted the impl/tensor_v2/multiply branch January 25, 2024 07:51
@djeong20 djeong20 restored the impl/tensor_v2/multiply branch January 25, 2024 07:51
@djeong20 djeong20 reopened this Jan 25, 2024
float *out_buf) {
if (e.strides[3] == 1 && output.getStrides()[3] == 1 && strides[3] == 1 &&
beta == 0.0) {
std::transform(buf, buf + e.buffer_size, m_buf, out_buf,
Copy link
Collaborator

@jijoongmoon jijoongmoon Jan 28, 2024

Choose a reason for hiding this comment

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

Even though we use this std::transform, we haven't tested it with other libs or implementations in apply_broadcast. Not in this PR, but we have to evaluate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha. I'll add some testing to verify.

*out_buf = *buf * *m_buf + beta * *out_buf;
buf += strides[3];
m_buf += e.strides[3];
out_buf += output.getStrides()[3];
Copy link
Collaborator

@jijoongmoon jijoongmoon Jan 28, 2024

Choose a reason for hiding this comment

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

If it is not continuous, we still can apply the multi-threading with something like omp. There might be some uncertainty about apply_broadcast. It might be better to apply multi-threading in the apply_broadcast function. Not this PR, but we can also evaluate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. We can launch a thread using a function pointer or function objects in multithreading support.

Copy link
Collaborator

@jijoongmoon jijoongmoon left a comment

Choose a reason for hiding this comment

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

LGTM except for some comments.

This PR adds support for performing the multiplication operation on two tensors.

**Changes proposed in this PR:**
- TensorV2 includes member functions to perform tensor multiplication.
- FloatTensor and HalfTensor take TensorV2 as input/output to perform multiplication.

**Self-evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test:   [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Donghyeon Jeong <[email protected]>
Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@djeong20, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Member

@SeoHyungjun SeoHyungjun left a comment

Choose a reason for hiding this comment

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

LGTM!

@jijoongmoon jijoongmoon merged commit 1ea0b09 into nnstreamer:main Jan 29, 2024
29 checks passed
@djeong20 djeong20 deleted the impl/tensor_v2/multiply branch February 8, 2024 06:21
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.

None yet

4 participants