[FFmpeg-devel] [PATCH]: Change Stack Frame Limit in Cuda Context

Timo Rothenpieler timo at rothenpieler.org
Fri Jan 26 20:34:21 EET 2018


Am 26.01.2018 um 10:06 schrieb Ben Chang:
> Thanks for the review Mark.
> 
> On Thu, Jan 25, 2018 at 4:13 PM, Mark Thompson <sw at jkqxz.net> wrote:
>>
>>> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
>>> index 4a91d99..2da251b 100644
>>> --- a/libavcodec/nvenc.c
>>> +++ b/libavcodec/nvenc.c
>>> @@ -420,6 +420,12 @@ static av_cold int nvenc_check_device(AVCodecContext
>> *avctx, int idx)
>>>           goto fail;
>>>       }
>>>
>>> +    cu_res = dl_fn->cuda_dl->cuCtxSetLimit(CU_LIMIT_STACK_SIZE, 128);
>>> +    if (cu_res != CUDA_SUCCESS) {
>>> +        av_log(avctx, AV_LOG_FATAL, "Failed reducing CUDA context stack
>> limit for NVENC: 0x%x\n", (int)cu_res);
>>> +        goto fail;
>>> +    }
>>> +
>>>       ctx->cu_context = ctx->cu_context_internal;
>>>
>>>       if ((ret = nvenc_pop_context(avctx)) < 0)
>>
>> Does this actually have any effect?  I was under the impression that the
>> CUDA context created inside the NVENC encoder wouldn't actually be used for
>> any CUDA operations at all (really just a GPU device handle).
>>
>   There are some cuda kernels in the driver that may be invoked depending on
> the nvenc operations specified in the commandline. My observation from
> looking at the nvcc statistics is that most stack frame size for these cuda
> kernels are 0 (highest observed was 120 bytes).

Wouldn't it affect potential future CUDA filters, which might make more 
use of the stack?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3994 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180126/1fd38bde/attachment.bin>


More information about the ffmpeg-devel mailing list