This is necessary in some circumstances when building internally, and is harmless otherwise.
PiperOrigin-RevId: 358372796
Change-Id: Ib53a5bc1e45acb7fb3fceee91ea25fe7e69283c4
The goal of this change is to avoid calling pthread_atfork() handlers. Some libraries, in particular the version of OpenBLAS included in NumPy, have buggy pthread_atfork() handlers. See https://github.com/xianyi/OpenBLAS/pull/3111 and https://github.com/google/jax/issues/5713 for details.
Now, while we can and have fixed the buggy atfork handlers, it will take some time for the fix to be deployed in a NumPy release and for users to update to a new NumPy release. So we also take an additional step: avoid running atfork handlers in Subprocess.
My copy of the glibc documentation says:
"
According to POSIX, it unspecified whether fork handlers established with pthread_atfork(3)
are called when posix_spawn() is invoked. On glibc, fork handlers are called only if the
child is created using fork(2).
"
It appears glibc 2.24 and newer do not call pthread_atfork() handlers from posix_spawn().
Using posix_spawn() should be at least no worse than an explicit fork()/execvp() pair, and on glibc it should do the right thing.
PiperOrigin-RevId: 358317859
Change-Id: Ic1d95446706efa7c0db4e79bf8281f14b2bd99df
- Introduce a CollectiveOpGroupMode enum to describe various modes of interpreting
replica groups attached to collective communication operations and
GetCollectiveOpGroupMode() function to get the group formation mode
implied by an HLO collective op based on whether it has channel_id and
use_global_device_ids.
- Fix GetParticipatingDevices() to use this mode to correctly find participants in all
group formatio...
PiperOrigin-RevId: 358313513
Change-Id: I9103d065c0a89149bcad3fa6b275696a257c97ae
This new pass will replace a func's saved model asset bound inputs which are
bound to tf.InitializeTableFromTextFileV2Op ops with tf.Const ops inside the
func's body.
closes#46737
PiperOrigin-RevId: 358304291
Change-Id: I2bd2f6fbcafc30c878a7848eb4c107c3b48d9673
An exception is being thrown when objects that use `CapturableResourceDeleter` are garbage collected at the end of a program's life. This can happen in very normal circumstances, such as when using `saved_model_cli` to inspect a model.
The cause of the exception appears to be a race condition with garbage collection between `CapturableResourceDeleter` and `ScopedTFFunction`. Both define a custom finalizer (`__del__`); `CaptureableResourceDeleter`'s finalizer ultimately calls a concrete function which calls an `_EagerDefinedFunction` which attempts to load and execute a `ScopedTFFunction`.
In the case of multiple objects in a reference cycle all going unreachable during the same garbage collection cycle, we get no guaranteed ordering for which of the objects will be collected first. In the case of the exception, `ScopedTFFunction` is collected first and its underlying function is deleted. Later, `CapturableResourceDeleter` is called, which fails, since the function it's trying to call is gone.
PiperOrigin-RevId: 358292164
Change-Id: I9162d5de622f5c1ec9b2954647b9958a7d3d87b6
This emits an error early rather than a potentially misleading error later in compilation.
PiperOrigin-RevId: 358291279
Change-Id: I227b8303a6b6245c49243e37b0ee9e2e68c20e35
- Introduce a CollectiveOpGroupMode enum to describe various modes of interpreting
replica groups attached to collective communication operations and
GetCollectiveOpGroupMode() function to get the group formation mode
implied by an HLO collective op based on whether it has channel_id and
use_global_device_ids.
- Fix GetParticipatingDevices() to use this mode to correctly find participants in all
group formation modes.
- Extend collective_ops_utils test to exercise the new behavior of
GetParticipatingDevices.
- Change existing uses of GetParticipatingDevices() to use cross replica group
mode to match existing behavior.
PiperOrigin-RevId: 358291067
Change-Id: I2f77659b5718c7513c0b4e724fd4c8c8d343f26c
For an MHLO op, `TypeToShape(op.getType())` doesn't return the intended layout, as layout currently is carried by the `minor_to_major` attribute.
Instead, get the shape from the converted HloComputation from MHLO.
This prevents failures that are revealed in later CLs.
PiperOrigin-RevId: 358289988
Change-Id: I3db5f83738caf51b220afa986ff83b9866628711
It is unused. Also, clean up references and mark field deprecated in the proto file.
PiperOrigin-RevId: 358274276
Change-Id: I1ba5990597230c8bd546f8894e5a67b2fc0ec305