[hipDNN] Improve sample failure output with tensor diffs#5591
Open
Bingtagui404 wants to merge 1 commit intoROCm:developfrom
Open
[hipDNN] Improve sample failure output with tensor diffs#5591Bingtagui404 wants to merge 1 commit intoROCm:developfrom
Bingtagui404 wants to merge 1 commit intoROCm:developfrom
Conversation
Add a reusable TensorDiff utility to test_sdk that computes element-wise tensor comparisons and prints summary statistics (mismatch count, max/mean absolute error, worst mismatches) when CPU validation fails. Wire it into all 14 sample validation paths via a validateAndReport<T>() helper so failures automatically print the diff instead of just "failed". Shape mismatches are detected separately and reported without attempting element-wise comparison to avoid out-of-bounds access. Fixes ROCm#5547
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a CPU validation failure occurs in the hipDNN samples, the output only tells you which tensor failed — not how it failed:
This PR adds a reusable tensor diff utility and wires it into all sample validation paths so failures automatically print detailed diagnostics:
Changes
test_sdk/.../utilities/TensorDiff.hpp— header-only utility providing:computeTensorDiff<T>()— element-wise comparison with summary statisticsprintTensorDiffSummary()— formatted outputvalidateAndReport<T>()— drop-in replacement combiningallClose()+ status print + diff on failure.cppfiles to usevalidateAndReport<T>()instead of manualallClose()+coutpatternSafety
computeTensorDiffruns single-threaded to avoid data races in summary accumulationmaxMismatches == 0is handled as "summary only" modeFixes #5547