feature: Conversion of HSOpticalFlow Program to HIP#453
Open
mapatel-amd wants to merge 5 commits into
Open
Conversation
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
Closes #447
Ports the NVIDIA HSOpticalFlow CUDA sample to HIP as a new
Applications/optical_flowexample. The Horn-Schunck variational optical flow algorithm demonstrates several non-trivial HIP features (texture objects withhipResourceTypePitch2D, cooperative groups, Gaussian pyramids) that have no existing example in the repository.Technical Details
Implements the Horn-Schunck optical flow algorithm on HIP:
Downscale(4-tap filter viatex2Dbilinear fetch)iterative solver refines the flow
flowGold.cpp) runs the same algorithm on the host; the GPU and CPU results are compared via L1 norm per pixel (threshold: 0.05)FlowGPU.floandFlowCPU.floin Middlebury.floformatKey porting changes from CUDA:
helper_functions.h,sdkLoadPPM4ubstb_image.h(already in-repo)findCudaDevice(argc, argv)hipGetDeviceProperties(&props, 0)cooperative_groups.hhip/hip_cooperative_groups.hStrideAlignment = 32StrideAlignment = 64— ROCm requirespitchInBytesto be a multiple of 256 bytes forhipResourceTypePitch2DAll four texture wrappers (
downscaleKernel,upscaleKernel,warpingKernel,derivativesKernel) usehipResourceTypePitch2DwithhipAddressModeMirrorandhipFilterModeLinear, exercising the texture object API as it is typically used in production imaging workloads.Test Plan
Built and run with
makeon a ROCm-capable AMD GPU:cd Applications/optical_flow make ./optical_flowInput: two consecutive frames from the Middlebury optical flow dataset (data/frame10.ppm, data/frame11.ppm).
Test Result
HSOpticalFlow Starting...
Added/Updated documentation?
Submission Checklist