Skip to content

Add morphology operations (ErodeBorder/DilateBorder) - #29

Open
johnnynunez wants to merge 2 commits into
Libraries-Openly-Fused:mainfrom
johnnynunez:add-morphology-ops
Open

Add morphology operations (ErodeBorder/DilateBorder)#29
johnnynunez wants to merge 2 commits into
Libraries-Openly-Fused:mainfrom
johnnynunez:add-morphology-ops

Conversation

@johnnynunez

Copy link
Copy Markdown
Contributor

Summary

Adds NPP morphology entry points to FastNPP: ErodeBorder and DilateBorder over an arbitrary binary structuring element (mask + size + anchor), for 8u (C1/C3), 16u (C1) and 32f (C1).

Each entry point takes the source image and the structuring element and returns a complete fused read operation (the neighbourhood min/max runs in a single kernel). The REPLICATE border matches nppiErodeBorder / nppiDilateBorder with NPP_BORDER_REPLICATE.

A CUDA::nppim link dependency was added to the test discovery so morphology tests resolve the NPP morphology symbols.

Dependency

Builds on the new fk::Morphology (Erode/Dilate) functor in Libraries-Openly-Fused/FusedKernelLibrary#275. Merge that PR and update the fkl submodule first.

Tests

tests/morphology/fastNPP_morphology_test.cu cross-checks against nppiErodeBorder / nppiDilateBorder with NPP_BORDER_REPLICATE (shared aligned pitch):

[PASS] ErodeBorder_8u_C1R  3x3 anchor(1,1)   0 mismatches
[PASS] DilateBorder_8u_C1R 3x3 anchor(1,1)   0 mismatches
[PASS] ErodeBorder_8u_C1R  5x3 anchor(2,1)   0 mismatches
[PASS] DilateBorder_8u_C1R 5x5 anchor(2,2)   0 mismatches
ALL PASS

Bit-exact vs NPP, including non-rectangular structuring elements and off-centre anchors. Integrates with CTest.

Environment

CUDA 13.3 / GCC 11.5, sm_120.

@johnnynunez

Copy link
Copy Markdown
Contributor Author

Rebased onto current main, but this PR (morphology (ErodeBorder/DilateBorder)) is BLOCKED: it #includes image_processing/morphology.h, which is not yet merged into FKL main — it lives in FKL #275 (feat/morphology-ops).

Verified on RTX PRO 6000 / CUDA 13.3: it does not compile against any merged fkl (4642ba1, a63c000, or 7f25849) because those headers don't exist there yet.

Action: merge the corresponding FKL PR first, then bump the fkl submodule (a follow-up to #22) so these headers are available; this FastNPP PR will then build + pass. I rebased it locally but did not push the rebase to keep CI from going red on an unbuildable branch.

@morousg morousg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You need to update the fkl submodule, in order to get the fkl::Morphology features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants