How to use qpDeltaMap, qpDeltaMapSize in Video Codec SDK 10.0 for hevc_nvenc

I am trying to get started with ROI encoding with the Nvidia Encoder NVENC.
As a first step I tried to set qpMapMode as NV_ENC_QP_MAP_DELTA in
ff_nvenc_encode_init. This allows me to send a file with a qpDeltaMap that the encoder uses to tweak the values obtained by the rate control algorithm.
Secondly,I tried to pass qpDeltaMap, qpDeltaMapSize in nvenc_send_frame.
uint32_t widthInCUs = ((pic_params.inputWidth + 63) & ~63) >> 6;
uint32_t heightInCUs = ((pic_params.inputHeight+63)& ~63)>>6;
uint32_t qpDeltaMapArraySize = widthInCUs*heightInCUs;
int8_t qpDeltaMapArray = (int8_t)malloc(qpDeltaMapArraySize * sizeof(int8_t));
memset(qpDeltaMapArray, 2, qpDeltaMapArraySize);
pic_params.qpDeltaMapSize = qpDeltaMapArraySize;
pic_params.qpDeltaMap = qpDeltaMapArray;

But it doesn’t seem to work as I would expect.
System tells me:EncodePicture failed!: not enough buffer (14)

Any guidance or references would help a lot.

Did you problem has been solved?
I want to do ROI encoding too, did qpMapMode works?