Fix CI build failure: update fkl submodule and add morphology operations#39
Conversation
* main: Update fkl submodule, and update FastNPP to C++20
Per feedback: fastNPP functions should accept only NPP parameters and convert them to fk:: parameters internally. - FASTNPP_DEFINE_MORPH now takes `const NPP_T* pSrc, Npp32s nSrcStep, NppiSize oSrcSize, NPP_T* pDst, Npp32s nDstStep, NppiSize oMaskSize, NppiPoint oAnchor, NppStreamContext` — pure NPP types - Internally constructs fk::Ptr2D<T> from the NPP pointer, step, and size, then populates MorphologyDPPDetails and calls executeErode/ executeDilate as before - Updated the morphology test to call the new NPP-style API, reusing the same device buffers for both NPP reference and FastNPP
Fixed in commit |
|
@copilot I have seen that other fastNPP functions are getting fk:: parameters instead of npp parameters. Make a list of all of the fastNPP functions that need refactoring, create a checklist with them, and refactor them so that they get npp parameters. Use the original npp functions as a reference, but take into account that the fastNpp functions that do not directly execute a kernel, will return an IOp and will only take an input pointer if the IOP used is of ReadType. Also, fastNPP functions that do execute directly, must get a ReadIOp and a WriteIOp as parameters instead of hardcoding PerThread Operations. That is an exception to the rule of using only npp parameters. |
Per feedback: fastNPP functions exist solely to convert NPP parameters into fk:: parameters. All fk::Ptr2D parameters have been removed from public function signatures: - FASTNPP_DEFINE_TWO_IMAGE_BW (And/Or/Xor two-image): now takes `const NPP_T* pSrc1, Npp32s nSrc1Step, const NPP_T* pSrc2, Npp32s nSrc2Step, NppiSize oSizeROI`; builds fk::Ptr2D internally before forwarding to DualSourceRead. - FASTNPP_DEFINE_TWO_IMAGE (Add/Sub/Mul/Div 32f): same NPP-pointer pattern as the bitwise two-image ops. - FASTNPP_DEFINE_MORPH (Erode/Dilate morphology): directly-executing functions get `template<ReadIOp, WriteIOp>` params (exception per review), with NPP control params NppiSize/NppiPoint/ NppStreamContext. No longer hardcodes PerThreadRead/PerThreadWrite. Tests updated: - fastNPP_absdiff_shift_test.cu: bwTwoImg and lambdas use Npp8u* API - fastNPP_two_image_test.cu: twoImgC1 and lambdas use Npp32f* API - fastNPP_morphology_test.cu: lambdas build Ptr2D/IOps from NPP pointers and pass them to the template morphology functions
Done in this commit. Here is the full checklist of functions refactored:
All three test files updated accordingly. |
|
@copilot Ok, all fastNPP functions that take any input pointer, should take it as an IOp. Only fastNPP functions that launch a kernel via execute Operations should be taking both input and output IOps. The rest should simply return an IOp. In the case of dual images, the returned IOp must expect an fk::Tuple<T, T> as InputType of the exec function or if it is an IncompleteReadBack IOp, should expect a BackIOp that returns a fk::Tuple<T,T> as a result of its exec function. This means that the DualReadOperation found in the fkl submodule should actually be refactored to be a ReadBackType and get an fk::Tuple<IOp1, IOp2> as BackIOp. Internally, the DualReadOperation should return fk::Tuple<typename IOp1::Operation::OutputType, typename IOp2::Operation::OutputType>. The geeral goal, is to have all fastNPP functions to be able to fuse with other IOps, in one or another way. |
Addressed in ef4235e. |
The ARM64 CI build was failing because
fast_npp.hreferencedfused_kernel/algorithms/image_processing/morphology.h, which didn't exist in the pinnedfklsubmodule commit (54af49b). FKL PR #275 had been merged into the library but the submodule pointer was never advanced.Changes
fklsubmodule: Advanced from54af49b→3d889c8(includesmorphology.hfrom FKL PRs #275/#289)include/fast_npp.h: Added morphology entry points using the actual FKLMorphologyDPPAPI. The original PR Add morphology operations (ErodeBorder/DilateBorder) #29 expected a non-existentfk::Morphology<>::build()IOp pattern; the real FKL API uses direct-execution functions instead:These wrap
fk::executeErode/fk::executeDilatefromMorphologyDPPDetails, using REPLICATE border semantics over a rectangular structuring element.tests/morphology/fastNPP_morphology_test.cu: Cross-validates ErodeBorder/DilateBorder againstnppiErodeBorder/nppiDilateBorderwith all-active rectangular masks (matching FKL's rectangular-window semantics). Tests 3×3 and 5×5 kernels with centered anchors.cmake/discover_tests.cmake: AddedCUDA::nppimto the test link libraries (required for NPP morphological operation symbols).