Skip to content

Fix - Address RPP -Wall warnings (Phase 1)#693

Merged
LakshmiKumar23 merged 15 commits intoROCm:developfrom
zacharyvincze:zv/bugfix/resolve-warnings-phase-1
Mar 30, 2026
Merged

Fix - Address RPP -Wall warnings (Phase 1)#693
LakshmiKumar23 merged 15 commits intoROCm:developfrom
zacharyvincze:zv/bugfix/resolve-warnings-phase-1

Conversation

@zacharyvincze
Copy link
Copy Markdown
Contributor

Description

This PR handles some low-hanging fruit warnings in RPP which show up when -Wall is enabled. Phase 1 aims to significantly reduce the number of warnings while keeping the PR diff low. Some bug fixes are included as part of the warning handling as well.

Technical Details

Warning Fixes

  • Unused functions in rpp_hip_roi_conversion.hpp have been suppressed with [[maybe_unused]]. This suppression must be removed whenever these helpers are used in the codebase again. (A TODO was created here for easier tracking)
  • Extra braces added to rpp_hip_load_store.hpp functions which is a hot path in the codebase.
  • Removed unused variables in rpp_cpu_simd_load_store.hpp.
  • Added return status checks for HIP runtime calls that specify nodiscard in random_erase.cpp.

Bug Fixes

  • loc in jitter.cpp was being used before initialization. Moved its calculation above the for loop which uses it.
  • sum was incorrectly calculated in tensor_mean.cpp. It's initialization used itself (which is an uninitialized variable up to that point) instead of sumR defined above.

Build System Changes

  • Added -Wall to the root CMake file. Categories which have not been fully handled will remain suppressed as to not pollute the build logs while warnings are being handled.

Results

Note that many of these warnings may be duplicate lines from headers that have been included in multiple source files.

Before Phase 1 Fixes

───────────────────────────────────
 Warning summary  (4289 lines)
───────────────────────────────────
  Category                   Count
  ─────────────────────────  ─────
  -Wmissing-braces            2304
  -Wunused-variable            839
  -Wvla-cxx-extension          714
  -Wunused-function            250
  -Wsometimes-uninitialized     84
  -Wunused-value                74
  -Wunused-but-set-variable     14
  -Wunused-const-variable        6
  -Wuninitialized                4
  ─────────────────────────  ─────
  Total                       4289
───────────────────────────────────

After Phase 1 Fixes

───────────────────────────────────
 Warning summary  (3205 lines)
───────────────────────────────────
  Category                   Count
  ─────────────────────────  ─────
  -Wmissing-braces            1928
  -Wvla-cxx-extension          714
  -Wunused-variable            459
  -Wsometimes-uninitialized     84
  -Wunused-but-set-variable     14
  -Wunused-const-variable        6
  ─────────────────────────  ─────
  Total                       3205
───────────────────────────────────

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces -Wall warning noise across RPP (Phase 1) while including a couple of correctness fixes in tensor CPU kernels and adding -Wall to the global CMake build flags.

Changes:

  • Enable -Wall globally and temporarily suppress select warning categories to keep build logs usable during cleanup phases.
  • Fix several warning sources (unused functions/vars, missing braces) and add nodiscard HIP runtime status checks in random_erase.
  • Fix two correctness bugs: uninitialized loc usage in jitter and incorrect sum computation in tensor_mean.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/modules/tensor/hip/kernel/random_erase.cpp Wrap HIP runtime calls with CHECK_RETURN_STATUS to satisfy nodiscard and improve error checking.
src/modules/tensor/cpu/kernel/tensor_mean.cpp Fix sum initialization/aggregation for 3-channel NCHW i8 mean computation.
src/modules/tensor/cpu/kernel/jitter.cpp Move compute_jitter_src_loc(...) before first use of loc to fix use-before-init.
src/modules/handle_hip.cpp Initialize hipCtx_t ctx to suppress uninitialized warnings; minor formatting.
src/include/common/hip/rpp_hip_roi_conversion.hpp Suppress unused static helpers via [[maybe_unused]].
src/include/common/hip/rpp_hip_load_store.hpp Add extra braces in aggregate init to address -Wmissing-braces.
src/include/common/cpu/rpp_cpu_simd_load_store.hpp Remove unused variables to address -Wunused-*.
CMakeLists.txt Add -Wall and suppress a subset of known-warning categories pending later cleanup phases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +664 to 668
compute_jitter_src_loc(&xorwowState, dstLocRow, vectorLoopCount, kernelSize, heightLimit, roi.xywhROI.roiWidth, srcDescPtr->strides.hStride, bound, layoutParams.bufferMultiplier, loc);
for(int cnt = 0; cnt < vectorIncrementPerChannel; cnt++)
{
srcPtrTemp_ps[cnt] = (Rpp16f)srcPtrChannel[loc + cnt];
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

In this AVX2 NHWC->NHWC path, loc is computed for a single output pixel, but the subsequent loop reads 8 consecutive values starting at loc and later stores 8 values to dstPtrTemp[...] while the pointer is advanced by only 3 elements (one pixel). This will overlap writes and can go out-of-bounds, producing corrupted output and potential memory errors. Consider rewriting this block to either process 8 pixels per iteration (with corresponding 24-value RGB stores and pointer increments) or fall back to the scalar 3-channel copy per pixel.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/include/common/hip/rpp_hip_roi_conversion.hpp 50.00% 1 Missing ⚠️
src/modules/handle_hip.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #693      +/-   ##
===========================================
- Coverage    92.45%   92.44%   -0.01%     
===========================================
  Files          215      215              
  Lines        94897    94895       -2     
===========================================
- Hits         87729    87719      -10     
- Misses        7168     7176       +8     
Files with missing lines Coverage Δ
src/include/common/cpu/rpp_cpu_simd_load_store.hpp 93.10% <ø> (-<0.01%) ⬇️
src/include/common/hip/rpp_hip_load_store.hpp 100.00% <ø> (ø)
src/modules/tensor/cpu/kernel/jitter.cpp 100.00% <100.00%> (ø)
src/modules/tensor/cpu/kernel/tensor_mean.cpp 100.00% <100.00%> (ø)
src/modules/tensor/hip/kernel/fisheye.cpp 100.00% <100.00%> (ø)
src/modules/tensor/hip/kernel/flip.cpp 100.00% <100.00%> (ø)
src/modules/tensor/hip/kernel/random_erase.cpp 98.06% <100.00%> (ø)
src/modules/tensor/hip/kernel/remap.cpp 100.00% <100.00%> (ø)
src/modules/tensor/hip/kernel/resize.cpp 100.00% <100.00%> (ø)
...c/modules/tensor/hip/kernel/resize_crop_mirror.cpp 100.00% <100.00%> (ø)
... and 6 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LakshmiKumar23
Copy link
Copy Markdown
Contributor

LakshmiKumar23 commented Mar 27, 2026

@zacharyvincze code coverage seems to drop 8%. Can you please take a look?

@LakshmiKumar23 LakshmiKumar23 self-requested a review March 27, 2026 21:32
@LakshmiKumar23
Copy link
Copy Markdown
Contributor

@zacharyvincze code coverage seems to drop 8%. Can you please take a look?

Latest ci run seems to not have this issue. We should be good

@LakshmiKumar23 LakshmiKumar23 merged commit 4cc33d0 into ROCm:develop Mar 30, 2026
1 check passed
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.

3 participants