pytorch
e0348cec - Avoid undefined behavior in JIT-generated conversion code (#110212)

Commit
1 year ago
Avoid undefined behavior in JIT-generated conversion code (#110212) The inductor/dynamo JIT generator creates C++ code using `static_cast` for type conversions. This is can be undefined behavior for e.g. `static_cast<uint8_t>(floatVal)` where `floatVal` is a negative value. To avoid this in the "regular" C++ code `c10::convert` is used. So use it in the JIT generated code too. Fixes #110077 Pull Request resolved: https://github.com/pytorch/pytorch/pull/110212 Approved by: https://github.com/ezyang, https://github.com/jgong5, https://github.com/desertfire
Author
Committer
Parents
Loading