[Issue]: Gaussian and AverageBlur are stateful, enforce serialization

Open
#182 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp

Research direction

Start with the Gaussian and AverageBlur operator implementations, focusing on their constructors and operator() calls. Trace how filter weights are allocated and used across host and device execution, then define a design that avoids unsafe shared state without sacrificing asynchronous pipelining. The issue does not name tests or provide a final acceptance condition.

Written by the indexing model from the issue text.

Description

The Gaussian and AverageBlur operators in their current implementation are stateful, allocating host and potentially device memory in their constructors. This memory is used to hold the weights for the filters, which are calculated from the kernel size parameters to those arguments.

To prevent concurrency bugs from back-to-back / multi-threaded operator invocations as they read/write this shared memory, synchronization via a hipEvent and mutex can force the operator calls to be serialized. While this serialization provides safety, it ruins asynchronous execution in pipelining. Furthermore, providing synchronization on both CPU and GPU simultaneously is a bit complicated and raises many edge cases.

Other considered approaches include recalculating weights on the fly or allocating memory in the operator() call itself, rather than the constructor, so that it can be stateless and not require synchronization, but these would seem to require an excessive performance hit.

Dominant language
C++
Stars
1
Forks
10
Avg merge
3d 1h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ROCm/rocCV

All issues in ROCm/rocCV

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.