Sure, here 19 is the entry point for the c call that launch the kernel. And here 10 is the kernel implementation.
What is the size of the inputs and the exact params? Are you sure that the fact that your return k elements instead of 1 if you were doing a max makes the amount of work done by the whole code different?