Bound cross_qk layer and head indices in CUDA Whisper beam search (#31998)
CopyCrossQKSingleDecodeStepKernel took the layer and head indices from
the cross_qk_layer_head model input and used them to index
qk_layer_pointers and to offset into the layer buffer without any range
check, even though num_layers was already passed to the kernel for that
purpose. Out-of-range pairs now zero their output slice instead of
dereferencing a wild pointer.
Also require the cross_qk_layer_head input to have shape
[layer_head_pair_count, 2], since the pair count is taken from dim 0 and
the kernel reads two values per pair.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>