onnxruntime
b4ed1751 - Address Tile kernel dim overflow and generate tests (#27566)

Commit
2 days ago
Address Tile kernel dim overflow and generate tests (#27566) This pull request strengthens the input validation and error handling for the `Tile` operator in both CPU and CUDA implementations. It introduces checks to ensure repeat values are non-negative and that output shape computations do not overflow, improving robustness and reliability. Comprehensive unit tests are added to verify these behaviors. **Input validation and error handling:** * Added checks in both CPU (`tile.cc`) and CUDA (`tile.cc`) implementations to reject negative repeat values, returning a clear error message when encountered. [[1]](diffhunk://#diff-a5f007a4e1eaed1b2643c8bf6958efa593f76d579656a6fb0561e5d58f5c93b8L181-R206) [[2]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL69-R88) * Updated output dimension calculation to use `SafeInt<int64_t>` multiplication, ensuring that integer overflows are detected and handled properly. [[1]](diffhunk://#diff-a5f007a4e1eaed1b2643c8bf6958efa593f76d579656a6fb0561e5d58f5c93b8L181-R206) [[2]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL69-R88) **Code consistency and refactoring:** * Renamed local variables from `rank` to `input_rank` for clarity and consistency across the CUDA implementation, updating all related usages. [[1]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL46-R46) [[2]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL69-R88) [[3]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL108-R114) [[4]](diffhunk://#diff-226288f3751bff4c44e9519aec3f6d7db0330fb0dda8ce417678db7b479577daL139-R152) **Unit testing improvements:** * Added a suite of unit tests to `tile_op_test.cc` to verify rejection of negative repeat values and to confirm that overflow in output dimension computation is properly detected for various data types and tensor shapes.### Description --------- Co-authored-by: Guenther Schmuelling <guschmue@microsoft.com>
Author
Parents
Loading