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

Convert softmax from CTest to GTest #3479

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

Vsevolod1983
Copy link
Contributor

@Vsevolod1983 Vsevolod1983 commented Jan 22, 2025

CTest to GTest conversion for Softmax
soft_max.cpp file is detected as renamed (moved), so probably will not be easy to review.

@Vsevolod1983 Vsevolod1983 marked this pull request as draft January 23, 2025 16:03
@Vsevolod1983 Vsevolod1983 marked this pull request as ready for review January 23, 2025 17:51
CompareResults(tensorGpuDataBackward, tensorCpuDataBackward);
}

std::vector<T> GetForwardCpu() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@bghimireamd bghimireamd Jan 28, 2025

Choose a reason for hiding this comment

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

Since this one is parallel may be we can move this mloSoftmaxForwardRunHost and mloSoftmaxBackwardRunHost to avoid duplications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, @bghimireamd
In C-test I did not see calls of these functions. Scope of my refactoring was to replace c-test with g-test.
If I misunderstand something, lets discuss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or do you mean that we need to enhance test coverage for softmax? If yes I would prefer to do it in separate PR/ticket.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah separate PR/ticket make more sense here :)

Copy link
Contributor

@bghimireamd bghimireamd left a comment

Choose a reason for hiding this comment

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

LGTM

* Copyright (c) 2017 Advanced Micro Devices, Inc.
* Copyright (c) 2024 Advanced Micro Devices, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

2025 now hehe

Comment on lines 469 to 473
// taken from the original c test
double tolerance = 8000;

/// \todo Resolve this workaround. Regular failures on Radeon VII, ROCm 3.3:
/// --float --input-dim 1 1 8 8 --algorithm 0 --mode 1 --scales 1 0 --tolerance 8000
/// FAILED: -nan
in_dim_set.erase({1, 1, 8, 8});
in_dim_set.erase({1, 1, 14, 14});
in_dim_set.erase({1, 1, 27, 27});
in_dim_set.erase({1, 32, 7, 7});
in_dim_set.erase({1, 32, 8, 8});
double threshold = std::numeric_limits<T>::epsilon() * tolerance;
double error = miopen::rms_range(tensorCPUData, tensorGPUData);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a pretty large tolerance.
For float it might not be as large, but for half I think this would be very substantial.
Is it possible to reduce this, and still have the tests pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decreased for half to 80

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