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

[GTests] Convert TensorOps CTest to GTest #3424

Merged
merged 13 commits into from
Dec 12, 2024

Conversation

Vsevolod1983
Copy link
Contributor

Test is refactored.
Three types are supported: float, double and half. For example, I8 and BF16 are not supported even in original CTest.

Test is renamed to ternary_tensor_ops as was requested by @CAHEK7

Comment on lines 96 to 97
tensor<T> tensorGPU = std::move(CalculateOnGPU());
tensor<T> tensorCPU = std::move(CalculateOnCPU());
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. std::move is not required because of mandatory RVO. RVO guarantees zero cost in-place object creation without even copying or moving anything.
  2. No need to mimic old approach, since it's kind of weird and incredibly inefficient. See Move tensor_set/scale/cast/copy to gtest #3416

Comment on lines 162 to 163
auto r = tensorC;
r.data = handle.Read<T>(c_dev, r.data.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

That's inefficient, you copied tensorC and override it right away with handle.Read, which... doubles the memory requirements by creating new vector.

See #3416 how it can be done in more efficient way.

Copy link
Contributor

@scerzh scerzh left a comment

Choose a reason for hiding this comment

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

LGTM but a small comment.

Copy link
Contributor

@scerzh scerzh left a comment

Choose a reason for hiding this comment

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

LGTM

@bghimireamd
Copy link
Contributor

LGTM

@Vsevolod1983 Vsevolod1983 merged commit aa9799c into develop Dec 12, 2024
28 of 144 checks passed
@Vsevolod1983 Vsevolod1983 deleted the vgolovko/ConvertTensorOpsToGTest branch December 12, 2024 13:05
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.

None yet

4 participants