onnxruntime
2b9a9480 - Validate CUDA GatherElements count (#32030)

Commit
1 day ago
Validate CUDA GatherElements count (#32030) This pull request adds a validation step to the CUDA `GatherElements` kernel to ensure the number of output elements does not exceed the supported limit, preventing potential overflows or runtime errors. It also introduces a corresponding utility function and unit tests for this validation. **CUDA GatherElements Kernel Improvements:** * Added a call to `ValidateGatherElementsElementCount` in `gather_elements.cc` to check that the number of output elements does not exceed `INT32_MAX`, ensuring CUDA kernel compatibility and preventing overflows. * Implemented the inline function `ValidateGatherElementsElementCount` in `gather_elements.h` to encapsulate the element count validation logic. * Included `<limits>` in `gather_elements.h` to support numeric boundary checks. **Testing:** * Added unit tests in `gather_elements_op_test.cc` to verify that `ValidateGatherElementsElementCount` correctly accepts valid counts and rejects counts exceeding `INT32_MAX`.
Author
Parents
Loading