pytorch
e32d7f75 - ATen | Fix potential crash if `MTLCreateSystemDefaultDevice` return nil (#66859)

Commit
3 years ago
ATen | Fix potential crash if `MTLCreateSystemDefaultDevice` return nil (#66859) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66859 `MTLCreateSystemDefaultDevice` can return `nil`. If that happens then inside `createDeviceInfo`, we'll crash trying to convert the `nullptr` from `device.name.UTF8String` into a `std::string`. Let's fix it by returning early in setup if there's no Metal device. But also make `createDeviceInfo` safe if we do pass in `nil`. Test Plan: * CircleCI Reviewed By: xta0 Differential Revision: D31759690 fbshipit-source-id: 74e878ab5b8611250c4843260f1d2e4eab22cdaf
Author
Parents
Loading