Memory space of NPP function arguments Some arguments must point to host memory

Hello

According to the documentation of NPP, all pointer arguments should be device pointers. (Quote from Section 2.1: “The design of all the NPP functions follows the same guidelines as other NVIDIA CUDA libraries like cuFFT and cuBLAS. That is that all pointer arguments in those APIs are device pointers”)

However, the “histEqualizationNPP” example contains a call to “nppiLUT_Linear_8u_C1R”, which states that some pointers are host pointers:

NPP_CHECK_NPP(nppiLUT_Linear_8u_C1R(oDeviceSrc.data(), oDeviceSrc.pitch(), 

                                            oDeviceDst.data(), oDeviceDst.pitch(), 

                                            oSizeROI, 

                                            lutHost, // value and level arrays are in host memory

                                            levelsHost, 

                                            binCount+1));

This would be no problem, of course. But how to find out which pointers are host pointers, and which ones are device pointers? The documentation, for example, of “nppiLUT_Linear_8u_C1R”, does not say anything about that. Are there any rules or guidelines? (The only function that is explicitly declared as a ‘host method’ in the documentation is “nppiQuantFwdTableInit_JPEG_8u16u”…)

bye

Hello

According to the documentation of NPP, all pointer arguments should be device pointers. (Quote from Section 2.1: “The design of all the NPP functions follows the same guidelines as other NVIDIA CUDA libraries like cuFFT and cuBLAS. That is that all pointer arguments in those APIs are device pointers”)

However, the “histEqualizationNPP” example contains a call to “nppiLUT_Linear_8u_C1R”, which states that some pointers are host pointers:

NPP_CHECK_NPP(nppiLUT_Linear_8u_C1R(oDeviceSrc.data(), oDeviceSrc.pitch(), 

                                            oDeviceDst.data(), oDeviceDst.pitch(), 

                                            oSizeROI, 

                                            lutHost, // value and level arrays are in host memory

                                            levelsHost, 

                                            binCount+1));

This would be no problem, of course. But how to find out which pointers are host pointers, and which ones are device pointers? The documentation, for example, of “nppiLUT_Linear_8u_C1R”, does not say anything about that. Are there any rules or guidelines? (The only function that is explicitly declared as a ‘host method’ in the documentation is “nppiQuantFwdTableInit_JPEG_8u16u”…)

bye

Hi Marco,

there are a small number of exceptions to the “all pointers are device pointers” rule. We do try to point those out in the documentation, but obviously we didn’t in the case of the LUT functions. We’ll take care of this in the next release. In fact we are considering rewriting those functions and providing a complete set of LUTs to support a complete set of data-types and channels. It is likely that this rewrite will actually make those pointers device pointers.

–Frank

Hi Marco,

there are a small number of exceptions to the “all pointers are device pointers” rule. We do try to point those out in the documentation, but obviously we didn’t in the case of the LUT functions. We’ll take care of this in the next release. In fact we are considering rewriting those functions and providing a complete set of LUTs to support a complete set of data-types and channels. It is likely that this rewrite will actually make those pointers device pointers.

–Frank

Thanks for this quick response. It’s good to hear that the general guideline may in future also apply to NPP (although rules like the “Hungarian notation” prefixes for host pointers, e.g. in “hpQuantRawTable” might be sufficient to clarify which memory space will be used)

Thanks for this quick response. It’s good to hear that the general guideline may in future also apply to NPP (although rules like the “Hungarian notation” prefixes for host pointers, e.g. in “hpQuantRawTable” might be sufficient to clarify which memory space will be used)