Commit Graph

8 Commits

Author SHA1 Message Date
cyy
b51f66c195 [Environment Variable][1/N] Use thread-safe env variable API in c10 (#119449)
This PR is the beginning of attempts to wrap thread-unsafe getenv and set_env functions inside a RW mutex.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119449
Approved by: https://github.com/albanD
2024-04-18 13:35:48 +00:00
f5049de242 Revert "[Environment Variable][1/N] Use thread-safe env variable API in c10 (#119449)"
This reverts commit 5bef127c2ea49280e7fda4f9fa7cad6fa4078e7d.

Reverted https://github.com/pytorch/pytorch/pull/119449 on behalf of https://github.com/PaliC due to your using TORCH_INTERNAL_ASSERT incorrectly ([comment](https://github.com/pytorch/pytorch/pull/119449#issuecomment-2062696010))
2024-04-17 23:44:00 +00:00
cyy
5bef127c2e [Environment Variable][1/N] Use thread-safe env variable API in c10 (#119449)
This PR is the beginning of attempts to wrap thread-unsafe getenv and set_env functions inside a RW mutex.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119449
Approved by: https://github.com/albanD
2024-04-16 04:39:20 +00:00
cyy
4a019047ad Enable nested namespace check in clang-tidy (#118506)
It is time to enable nested namespaces in the code.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/118506
Approved by: https://github.com/albanD
2024-01-31 00:32:35 +00:00
2881e0ea17 torch/deadlockdetection: add TORCH_DISABLE_DEADLOCK_DETECTION env for use with torch deploy (#77270)
Summary:
Currently there's an #ifdef USE_DEPLOY to disable deadlock detection in torch for torch deploy. We want to be able to link against binary distributions of PyTorch so we need to have a way to disable deadlock detection at runtime.

55f55a4cf6/torch/csrc/autograd/python_variable.cpp (L1017)

Test Plan: buck test //caffe2/c10/test:util_base_test

Differential Revision: D36303256

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77270
Approved by: https://github.com/PaliC
2022-05-12 00:10:59 +00:00
8b38458011 [jit] Break interpreter.cpp into smaller files. (#56546)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56546

A code move for CodeImpl and Frame to a subdirectory runtime/interpreter, so
that it's easier to reuse them and navigate the interpreter code.

Test Plan: Imported from OSS

Reviewed By: nikithamalgifb

Differential Revision: D28133580

fbshipit-source-id: 8de89a4e8e637836625e1ac1db95f0a3353da670
2021-05-06 16:43:57 -07:00
cd22bdf236 [PyTorch] Autoformat c10, round 2 (#57645)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57645

Second round of autoformatting changes since the first pass became too large.
ghstack-source-id: 128199695

Test Plan: CI

Reviewed By: zertosh

Differential Revision: D28131430

fbshipit-source-id: 24b03e38b087f31e8cac2404bebcd401c55b6cab
2021-05-05 15:45:53 -07:00
e845158b1a Assert that GIL is not held in blocking destructors (#57030)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57030

PR #57029 is not perfect; there are still obscure situations in which
we might allocate a shared_ptr to an RpcAgent that doesn't have a
no GIL constructor, so this PR adds the other half of the equation:
assert that we don't hold the GIL when running a blocking destructor.
This makes it possible to detect potential deadlocks even if the
code doesn't deadlock in practice (because you got lucky and none
of the threads you blocked on tried to also take out the GIL).

I considered whether or not to make this DEBUG_ONLY.  For now it's
not, so I can get better CI coverage, and because this test only
happens in destructors of objects that die rarely.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D28030582

Pulled By: ezyang

fbshipit-source-id: a7d7f6545223c4823c7f6036dfe29bd2edaf60a5
2021-05-02 22:06:02 -07:00