pytorch
cb42bc2c - [FSDP] Add unsafe setattr gated by env var (#96326)

Commit
1 year ago
[FSDP] Add unsafe setattr gated by env var (#96326) This adds the option to use an unsafe `setattr` for `_use_sharded_views()` and `_use_unsharded_views()` gated by the environment variable `FSDP_USE_UNSAFE_SETATTR`, where a value of `1` means to use the unsafe `setattr`. The unsafe option is disabled by default. The unsafe `setattr` may be able to save CPU overhead and may be used to intentionally bypass `setattr` checks. Both `_use_sharded_views()` and `_use_unsharded_views()` must use the unsafe version or use the safe versions atomically. Pull Request resolved: https://github.com/pytorch/pytorch/pull/96326 Approved by: https://github.com/zhaojuanmao, https://github.com/fegin
Author
Committer
Parents
Loading