cudaArrayGetPlane returns cudaErrorInvalidValue?

cudaArrayGetPlane returns cudaErrorInvalidValue.
cudaArrayGetPlane is availible since CUDA 11.2, but I cannot find a sample code to run this function. The usage like:
"
cudaArray_t a_Src;
cudaChannelFormatDesc float2tex = cudaCreateChannelDesc();

checkCudaErrors(cudaMallocArray(&a_Src, &float2tex, width, height));
cudaArray_t plane;
checkCudaErrors(cudaArrayGetPlane(&plane, a_Src, 0));

"
only returns cudaErrorInvalidValue. Does anyone kown how to use this function?

The documentation states:

If planeIdx is greater than the maximum number of planes in this array or if the array does not have a multi-planar format e.g: cudaChannelFormatKindNV12, then cudaErrorInvalidValue is returned.

The array you have created does not have a multi-planar format. A quick review of the available channel format kinds suggests to me that the suggested NV12 kind may be the only planar kind, at this time. Therefore you would probably want to be familiar with the NV12 layout before attempting to use this function or determining its applicability to your use-case.

(Aside/Quibble: I would have referred to the NV12 as a “semi-planar” format, but nevertheless it does have planes, so not being that careful here.)