Test Suite - HIP - Grid dropout#702
Merged
Merged
Conversation
… into lk/test_fix
… into lk/test_fix
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the HIP backend’s NHWC (PKD3) grid_dropout kernel indexing so pixels are addressed using the correct n/h/w strides, preventing incorrect writes and potential out-of-bounds access in QA test mode.
Changes:
- Update the HIP PKD3 grid-dropout kernel to use
nStride/hStride/wStridefor NHWC indexing and write packed RGB without an extra* 3scale. - Pass
dstDescPtr->strides.wStrideinto the kernel (switchuint2→uint3) to correctly compute element offsets. - Test-suite cleanup: remove an unused variable and ensure
anchorBoxInfoTensoris freed forGRID_DROPOUT.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| utilities/test_suite/HIP/Tensor_image_hip.cpp | Removes unused variable and adds missing host free for grid-dropout test allocations. |
| src/modules/tensor/hip/kernel/grid_dropout.cpp | Corrects NHWC PKD3 destination indexing by using n/h/w strides and correct packed stores. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
rrawther
approved these changes
Apr 8, 2026
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.
Motivation
Grid dropout fails on QA test mode for HIP backend. This PR aims to fix the failure
Technical Details
Explanation from claude:
For NHWC (PKD3), strides are set as in set_descriptor_dims_and_strides:
The HIP kernel grid_dropout_pkd_hip_tensor instead computed:
dstIdx = … + y * hStride + x (missing x * wStride)then used dstPtr[dstIdx * 3], which effectively mixed “pixel x” with element strides and scaled the index again by 3.
So writes landed on the wrong pixels and could run past the end of the buffer (typical gdb symptom for PKD3-only paths).
Fix
Pass
nStride,hStride, andwStrideinto the kernel as a uint3.Compute
dstIdxasbatch * nStride + y * hStride + x * wStride(with
ltfolded intoy/xas before).Write the packed RGB with
&dstPtr[dstIdx](no extra * 3).Test Plan
HIP Ctest for grid dropout should pass. Known failures with jpeg compression will be fixed as a separate PR
Test Result
Submission Checklist