diff --git a/.gitattributes b/.gitattributes index 367bc629e79e0faa453230a5308d2b8fe1685ffd..4dbd1cc4c9676ef40c6fa0abb82848caa4b07c68 100644 --- a/.gitattributes +++ b/.gitattributes @@ -901,3 +901,4 @@ videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2xla/ops/__pycache videochat2/lib/python3.10/site-packages/tensorflow/compiler/tf2tensorrt/_pywrap_py_utils.so filter=lfs diff=lfs merge=lfs -text videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_function_lib.so filter=lfs diff=lfs merge=lfs -text videochat2/lib/python3.10/site-packages/tensorflow/compiler/mlir/quantization/tensorflow/python/pywrap_quantize_model.so filter=lfs diff=lfs merge=lfs -text +videochat2/lib/python3.10/site-packages/torchvision/_C.so filter=lfs diff=lfs merge=lfs -text diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/async_value_ref.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/async_value_ref.h new file mode 100644 index 0000000000000000000000000000000000000000..71d5ae0217b78b03718138973ed9f14dda07dc48 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/async_value_ref.h @@ -0,0 +1,468 @@ +/* Copyright 2022 Google LLC. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_REF_H_ +#define TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_REF_H_ + +#include +#include +#include +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "tsl/concurrency/async_value.h" +#include "tsl/concurrency/ref_count.h" + +namespace tsl { + +// Forward declare non-owning typed async value pointer. +template +class AsyncValuePtr; + +// RCReference wrapper. +// +// AsyncValueRef is an alias for RCReference that carries payload +// type information. The user does not need to pass the payload data type to +// get() or emplace(). +// +// Like RCReference, it represents one reference on the underlying +// AsyncValue. When a callee returns an AsyncValueRef to a caller, the callee +// also transfers their ownership of a reference on the underlying AsyncValue. +template +class AsyncValueRef { + public: + AsyncValueRef() = default; + AsyncValueRef(std::nullptr_t) {} // NOLINT + + explicit AsyncValueRef(RCReference value) + : value_(std::move(value)) {} + + // Support implicit conversion from AsyncValueRef to + // AsyncValueRef. + template ::value>* = nullptr> + AsyncValueRef(AsyncValueRef&& u) // NOLINT + : value_(u.ReleaseRCRef()) {} + + // Support implicit conversion from RCReference. + AsyncValueRef(RCReference value) // NOLINT + : value_(std::move(value)) {} + + AsyncValueRef& operator=(RCReference new_value) { + value_ = std::move(new_value); + return *this; + } + + // Allow implicit conversion to type-erased RCReference + operator RCReference() && { return std::move(value_); } // NOLINT + + // Return true if the AsyncValue is resolved to a concrete value or error. + bool IsAvailable() const { return value_->IsAvailable(); } + bool IsUnavailable() const { return value_->IsUnavailable(); } + + // Return true if the AsyncValue contains a concrete value. + bool IsConcrete() const { return value_->IsConcrete(); } + + // Return true if state is kUnconstructed. + bool IsUnconstructed() const { return value_->IsUnconstructed(); } + + // Return the stored value. The AsyncValueRef must be available. + T& get() const { return value_->get(); } + + // Return the stored value as a subclass type. The AsyncValueRef must be + // available. + template ::value>* = nullptr> + SubclassT& get() const { + return value_->get(); + } + + T* operator->() const { return &get(); } + + T& operator*() const { return get(); } + + template + void AndThen(WaiterT&& waiter) const { + AsPtr().AndThen(std::forward(waiter)); + } + + // Make the AsyncValueRef available. + void SetStateConcrete() const { value_->SetStateConcrete(); } + + // Set the stored value. The AsyncValueRef must be unavailable. After this + // returns, the AsyncValueRef will be available. + template + void emplace(Args&&... args) const { + value_->emplace(std::forward(args)...); + } + + void emplace(absl::StatusOr v) const { + if (v.ok()) { + emplace(std::move(*v)); + } else { + SetError(std::move(v.status())); + } + } + + // Return true if this AsyncValueRef represents an error. + bool IsError() const { return value_->IsError(); } + + // Returns the underlying error. IsError() must be true. + const absl::Status& GetError() const { return value_->GetError(); } + + // Returns the underlying error, or nullptr if there is none. + const absl::Status* GetErrorIfPresent() const { + return value_->GetErrorIfPresent(); + } + + void SetError(absl::Status status) const { + assert(!status.ok() && "expected non-ok status"); + return value_->SetError(std::move(status)); + } + + void SetError(std::string_view message) const { + SetError(absl::InternalError(message)); + } + + explicit operator bool() const { return value_.get() != nullptr; } + bool operator==(const AsyncValueRef& r) const { return value_ == r.value_; } + bool operator!=(const AsyncValueRef& r) const { return value_ != r.value_; } + + // Return a raw pointer to the AsyncValue. + AsyncValue* GetAsyncValue() const { return value_.get(); } + + // Returns a non-owning pointer to the underlying async value. + AsyncValuePtr AsPtr() const { return AsyncValuePtr(GetAsyncValue()); } + + // Return true if this is the only ref to the AsyncValue. + // This function requires the internal AsyncValue to be set (value_ != + // nullptr). + bool IsUnique() const { return value_->IsUnique(); } + + // Make an explicit copy of this AsyncValueRef, increasing value_'s refcount + // by one. + AsyncValueRef CopyRef() const { return AsyncValueRef(CopyRCRef()); } + + // Make a copy of value_, increasing value_'s refcount by one. + RCReference CopyRCRef() const { return value_; } + + // Release ownership of one reference on the AsyncValue and return a raw + // pointer to it. + AsyncValue* release() { return value_.release(); } + + void reset() { value_.reset(); } + + // Transfer ownership of one reference on the AsyncValue to the returned + // RCReference. + RCReference ReleaseRCRef() { return std::move(value_); } + + private: + RCReference value_; +}; + +// Non owning typed pointer for the AsyncValue. Can be cheaply passed around +// when the lifetime of the underlying async value is clear from the context. +// It is the user responsibility to construct an owning AsyncValueRef to extend +// the lifetime of the underlying value if needed. +template +class AsyncValuePtr { + public: + AsyncValuePtr() : value_(nullptr) {} + + explicit AsyncValuePtr(AsyncValue* value) : value_(value) {} + explicit AsyncValuePtr(const AsyncValueRef& ref) + : value_(ref.GetAsyncValue()) {} + + AsyncValue* value() const { return value_; } + + AsyncValueRef CopyRef() const { return AsyncValueRef(FormRef(value_)); } + + T& get() const { return value_->template get(); } + T* operator->() const { return &get(); } + T& operator*() const { return get(); } + + explicit operator bool() const { return value_ != nullptr; } + bool operator!=(std::nullptr_t) const { return value_ != nullptr; } + AsyncValuePtr& operator=(std::nullptr_t) { + value_ = nullptr; + return *this; + } + + bool IsAvailable() const { return value_->IsAvailable(); } + bool IsUnavailable() const { return value_->IsUnavailable(); } + + bool IsConcrete() const { return value_->IsConcrete(); } + void SetStateConcrete() const { value_->SetStateConcrete(); } + + template + void emplace(Args&&... args) const { + value_->emplace(std::forward(args)...); + } + + bool IsError() const { return value_->IsError(); } + + const absl::Status& GetError() const { return value_->GetError(); } + + void SetError(absl::Status status) const { + assert(!status.ok() && "expected non-ok status"); + return value_->SetError(std::move(status)); + } + + // If the AsyncValueRef is available, run the waiter immediately. Otherwise, + // run the waiter when the AsyncValueRef becomes available. + // + // Sample usage: + // + // async_value_ref.AndThen([] { + // // async_value_ref is now ready. + // }); + template >* = nullptr> + void AndThen(WaiterT&& waiter) const { + value_->AndThen(std::forward(waiter)); + } + + // This AndThen() function takes a functor that takes absl::StatusOr as + // argument. This makes it easy for the callback function to use the value of + // the AsyncValue when it becomes available. + // + // Sample usage: + // + // async_value_ref.AndThen([] (absl::StatusOr status_or) { + // // async_value_ref is now ready and its value/error is in the provided + // // `status_or` argument. + // if (!status_or.ok()) { + // // Handle the error in `status_or.status()`. + // } else { + // // Handle the value in `*status_or`. + // } + // }); + template >>* = nullptr> + void AndThen(WaiterT&& waiter) const { + AndThen([waiter = std::forward(waiter), av_ptr = *this]() mutable { + if (av_ptr.IsError()) { + return std::forward(waiter)(av_ptr.GetError()); + } else { + return std::forward(waiter)(&av_ptr.get()); + } + }); + } + + // This AndThen() function takes a functor that takes an absl::Status as + // argument. This makes it easy for the callback function to use the error of + // the AsyncValue when it becomes available. This is useful when the callback + // function only cares about the error value of the AsyncValue, e.g. for + // AsyncValueRef. + // + // Sample usage: + // + // async_value_ref.AndThen([] (absl::Status status) { + // // async_value_ref is now ready and its status is in the provided + // // `status` argument. + // if (!status.ok()) { + // // Handle the error. + // } else { + // // No error occurred. + // } + // }); + template && + !std::is_invocable_v>)>* = nullptr> + void AndThen(WaiterT&& waiter) const { + AndThen([waiter = std::forward(waiter), av_ptr = *this]() mutable { + if (av_ptr.IsError()) { + return std::forward(waiter)(av_ptr.GetError()); + } else { + return std::forward(waiter)(absl::OkStatus()); + } + }); + } + + private: + AsyncValue* value_; // doesn't own the async value +}; + +// Create a ConcreteAsyncValue in error state with the given status. +RCReference MakeErrorAsyncValueRef(absl::Status status); + +ABSL_DEPRECATED("Use the error async value constructor that takes absl::Status") +RCReference MakeErrorAsyncValueRef(std::string_view message); + +// Construct an empty IndirectAsyncValue, not forwarding to anything. +RCReference MakeIndirectAsyncValue(); + +//===----------------------------------------------------------------------===// + +namespace internal { + +template +T* PlacementConstruct(void* buf, Args&&... args) { + return new (buf) T(std::forward(args)...); +} + +template +T* AllocateAndConstruct(Args&&... args) { + // TODO(ezhulenev): `port::AlignedMalloc` has a different order of arguments! + void* buf = internal::AlignedAlloc(alignof(T), sizeof(T)); + return PlacementConstruct(buf, std::forward(args)...); +} + +} // namespace internal + +//===----------------------------------------------------------------------===// +// Constructing reference-counted async values on the heap. +//===----------------------------------------------------------------------===// + +// Allocate an unconstructed AsyncValueRef. The AsyncValueRef should be made +// available later by invoking AsyncValueRef::emplace or +// AsyncValueRef::SetError. +template +AsyncValueRef MakeUnconstructedAsyncValueRef() { + return AsyncValueRef(tsl::TakeRef( + internal::AllocateAndConstruct>( + typename internal::ConcreteAsyncValue::UnconstructedPayload{}))); +} + +// Allocate and construct an AsyncValueRef without making it available for +// consumption. The AsyncValueRef should be made available later by invoking +// AsyncValueRef::SetStateConcrete or AsyncValueRef::SetError. +template +AsyncValueRef MakeConstructedAsyncValueRef(Args&&... args) { + return AsyncValueRef(tsl::TakeRef( + internal::AllocateAndConstruct>( + typename internal::ConcreteAsyncValue::ConstructedPayload{}, + std::forward(args)...))); +} + +// Allocate and construct an available AsyncValueRef. +template +AsyncValueRef MakeAvailableAsyncValueRef(Args&&... args) { + return AsyncValueRef(tsl::TakeRef( + internal::AllocateAndConstruct>( + typename internal::ConcreteAsyncValue::ConcretePayload{}, + std::forward(args)...))); +} + +//===----------------------------------------------------------------------===// +// Constructing non-reference-counted values in user provided storage. +//===----------------------------------------------------------------------===// + +namespace internal { + +// Properly sized and aligned storage for allocating async values of given type. +template +struct AsyncValueStorage { + using Payload = ConcreteAsyncValue; + + AsyncValueStorage() = default; + + AsyncValueStorage(const AsyncValueStorage&) = delete; + AsyncValueStorage& operator=(const AsyncValueStorage&) = delete; + + void* buf() { return &storage[0]; } + + alignas(Payload) std::byte storage[sizeof(Payload)]; +}; + +} // namespace internal + +// Exclusive owner of the non reference-counted async value (e.g. allocated in +// the user provided storage) that is responsible for destructing it. If you'd +// look at `AsyncValueRef` as `std::shared_ptr`, then this is `std::unique_ptr`. +template +class AsyncValueOwningRef { + public: + AsyncValueOwningRef() = default; + ~AsyncValueOwningRef() { Destroy(); } + + AsyncValueOwningRef(const AsyncValueOwningRef&) = delete; + AsyncValueOwningRef& operator=(const AsyncValueOwningRef&) = delete; + + AsyncValueOwningRef& operator=(AsyncValueOwningRef&& other) { + Destroy(); + std::swap(value_, other.value_); + return *this; + } + + AsyncValueOwningRef(AsyncValueOwningRef&& other) { + Destroy(); + std::swap(value_, other.value_); + } + + AsyncValueRef AsRef() const { return AsyncValueRef(FormRef(value_)); } + AsyncValuePtr AsPtr() const { return AsyncValuePtr(value_); } + + T* operator->() const { return &value_->get(); } + T& operator*() const { return value_->get(); } + + private: + template + friend AsyncValueOwningRef MakeConstructedAsyncValueRef( + internal::AsyncValueStorage&, Args&&...); + + template + friend AsyncValueOwningRef MakeAvailableAsyncValueRef( + internal::AsyncValueStorage&, Args&&...); + + explicit AsyncValueOwningRef(internal::ConcreteAsyncValue* value) + : value_(value) {} + + void Destroy() { + if (value_) { + CallDestructor(value_); + value_ = nullptr; + } + } + + // Work around NVCC compilation error. + template + void CallDestructor(U* ptr) { + ptr->~U(); + } + + internal::ConcreteAsyncValue* value_ = nullptr; +}; + +// Constructs an AsyncValueRef in the provided storage without making it +// available for consumption. The AsyncValueRef should be made available later +// by invoking AsyncValueRef::SetStateConcrete or AsyncValueRef::SetError. +template +AsyncValueOwningRef MakeConstructedAsyncValueRef( + internal::AsyncValueStorage& storage, Args&&... args) { + return AsyncValueOwningRef( + internal::PlacementConstruct>( + storage.buf(), + typename internal::ConcreteAsyncValue::ConstructedPayload{false}, + std::forward(args)...)); +} + +// Construct an available AsyncValueRef in the provided storage. +template +AsyncValueOwningRef MakeAvailableAsyncValueRef( + internal::AsyncValueStorage& storage, Args&&... args) { + return AsyncValueOwningRef( + internal::PlacementConstruct>( + storage.buf(), + typename internal::ConcreteAsyncValue::ConcretePayload{false}, + std::forward(args)...)); +} + +} // namespace tsl + +#endif // TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_REF_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cuda.inc b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cuda.inc new file mode 100644 index 0000000000000000000000000000000000000000..32e72cbf0e1eff7dbe2ac4ca8c6b5a9e5a8f5dcb --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cuda.inc @@ -0,0 +1,635 @@ + "cuArray3DCreate", + "cuArray3DCreate_v2", + "cuArray3DGetDescriptor", + "cuArray3DGetDescriptor_v2", + "cuArrayCreate", + "cuArrayCreate_v2", + "cuArrayDestroy", + "cuArrayGetDescriptor", + "cuArrayGetDescriptor_v2", + "cuArrayGetMemoryRequirements", + "cuArrayGetPlane", + "cuArrayGetSparseProperties", + "cuCoredumpGetAttribute", + "cuCoredumpGetAttributeGlobal", + "cuCoredumpSetAttribute", + "cuCoredumpSetAttributeGlobal", + "cuCtxAttach", + "cuCtxCreate", + "cuCtxCreate_v2", + "cuCtxCreate_v3", + "cuCtxDestroy", + "cuCtxDestroy_v2", + "cuCtxDetach", + "cuCtxDisablePeerAccess", + "cuCtxEnablePeerAccess", + "cuCtxGetApiVersion", + "cuCtxGetCacheConfig", + "cuCtxGetCurrent", + "cuCtxGetDevice", + "cuCtxGetExecAffinity", + "cuCtxGetFlags", + "cuCtxGetId", + "cuCtxGetLimit", + "cuCtxGetSharedMemConfig", + "cuCtxGetStreamPriorityRange", + "cuCtxPopCurrent", + "cuCtxPopCurrent_v2", + "cuCtxPushCurrent", + "cuCtxPushCurrent_v2", + "cuCtxResetPersistingL2Cache", + "cuCtxSetCacheConfig", + "cuCtxSetCurrent", + "cuCtxSetFlags", + "cuCtxSetLimit", + "cuCtxSetSharedMemConfig", + "cuCtxSynchronize", + "cuDestroyExternalMemory", + "cuDestroyExternalSemaphore", + "cuDeviceCanAccessPeer", + "cuDeviceComputeCapability", + "cuDeviceGet", + "cuDeviceGetAttribute", + "cuDeviceGetByPCIBusId", + "cuDeviceGetCount", + "cuDeviceGetDefaultMemPool", + "cuDeviceGetExecAffinitySupport", + "cuDeviceGetGraphMemAttribute", + "cuDeviceGetLuid", + "cuDeviceGetMemPool", + "cuDeviceGetName", + "cuDeviceGetNvSciSyncAttributes", + "cuDeviceGetP2PAttribute", + "cuDeviceGetPCIBusId", + "cuDeviceGetProperties", + "cuDeviceGetTexture1DLinearMaxWidth", + "cuDeviceGetUuid", + "cuDeviceGetUuid_v2", + "cuDeviceGraphMemTrim", + "cuDevicePrimaryCtxGetState", + "cuDevicePrimaryCtxRelease", + "cuDevicePrimaryCtxRelease_v2", + "cuDevicePrimaryCtxReset", + "cuDevicePrimaryCtxReset_v2", + "cuDevicePrimaryCtxRetain", + "cuDevicePrimaryCtxSetFlags", + "cuDevicePrimaryCtxSetFlags_v2", + "cuDeviceSetGraphMemAttribute", + "cuDeviceSetMemPool", + "cuDeviceTotalMem", + "cuDeviceTotalMem_v2", + "cuDriverGetVersion", + "cuEGLApiInit", + "cuEGLStreamConsumerAcquireFrame", + "cuEGLStreamConsumerConnect", + "cuEGLStreamConsumerConnectWithFlags", + "cuEGLStreamConsumerDisconnect", + "cuEGLStreamConsumerReleaseFrame", + "cuEGLStreamProducerConnect", + "cuEGLStreamProducerDisconnect", + "cuEGLStreamProducerPresentFrame", + "cuEGLStreamProducerReturnFrame", + "cuEventCreate", + "cuEventDestroy", + "cuEventDestroy_v2", + "cuEventElapsedTime", + "cuEventQuery", + "cuEventRecord", + "cuEventRecordWithFlags", + "cuEventRecordWithFlags_ptsz", + "cuEventRecord_ptsz", + "cuEventSynchronize", + "cuExternalMemoryGetMappedBuffer", + "cuExternalMemoryGetMappedMipmappedArray", + "cuFlushGPUDirectRDMAWrites", + "cuFuncGetAttribute", + "cuFuncGetModule", + "cuFuncGetName", + "cuFuncSetAttribute", + "cuFuncSetBlockShape", + "cuFuncSetCacheConfig", + "cuFuncSetSharedMemConfig", + "cuFuncSetSharedSize", + "cuGLCtxCreate", + "cuGLCtxCreate_v2", + "cuGLGetDevices", + "cuGLGetDevices_v2", + "cuGLInit", + "cuGLMapBufferObject", + "cuGLMapBufferObjectAsync", + "cuGLMapBufferObjectAsync_v2", + "cuGLMapBufferObjectAsync_v2_ptsz", + "cuGLMapBufferObject_v2", + "cuGLMapBufferObject_v2_ptds", + "cuGLRegisterBufferObject", + "cuGLSetBufferObjectMapFlags", + "cuGLUnmapBufferObject", + "cuGLUnmapBufferObjectAsync", + "cuGLUnregisterBufferObject", + "cuGetErrorName", + "cuGetErrorString", + "cuGetExportTable", + "cuGetProcAddress", + "cuGetProcAddress_v2", + "cuGraphAddBatchMemOpNode", + "cuGraphAddChildGraphNode", + "cuGraphAddDependencies", + "cuGraphAddDependencies_v2", + "cuGraphAddEmptyNode", + "cuGraphAddEventRecordNode", + "cuGraphAddEventWaitNode", + "cuGraphAddExternalSemaphoresSignalNode", + "cuGraphAddExternalSemaphoresWaitNode", + "cuGraphAddHostNode", + "cuGraphAddKernelNode", + "cuGraphAddKernelNode_v2", + "cuGraphAddMemAllocNode", + "cuGraphAddMemFreeNode", + "cuGraphAddMemcpyNode", + "cuGraphAddMemsetNode", + "cuGraphAddNode", + "cuGraphAddNode_v2", + "cuGraphBatchMemOpNodeGetParams", + "cuGraphBatchMemOpNodeSetParams", + "cuGraphChildGraphNodeGetGraph", + "cuGraphClone", + "cuGraphConditionalHandleCreate", + "cuGraphCreate", + "cuGraphDebugDotPrint", + "cuGraphDestroy", + "cuGraphDestroyNode", + "cuGraphEventRecordNodeGetEvent", + "cuGraphEventRecordNodeSetEvent", + "cuGraphEventWaitNodeGetEvent", + "cuGraphEventWaitNodeSetEvent", + "cuGraphExecBatchMemOpNodeSetParams", + "cuGraphExecChildGraphNodeSetParams", + "cuGraphExecDestroy", + "cuGraphExecEventRecordNodeSetEvent", + "cuGraphExecEventWaitNodeSetEvent", + "cuGraphExecExternalSemaphoresSignalNodeSetParams", + "cuGraphExecExternalSemaphoresWaitNodeSetParams", + "cuGraphExecGetFlags", + "cuGraphExecHostNodeSetParams", + "cuGraphExecKernelNodeSetParams", + "cuGraphExecKernelNodeSetParams_v2", + "cuGraphExecMemcpyNodeSetParams", + "cuGraphExecMemsetNodeSetParams", + "cuGraphExecNodeSetParams", + "cuGraphExecUpdate", + "cuGraphExecUpdate_v2", + "cuGraphExternalSemaphoresSignalNodeGetParams", + "cuGraphExternalSemaphoresSignalNodeSetParams", + "cuGraphExternalSemaphoresWaitNodeGetParams", + "cuGraphExternalSemaphoresWaitNodeSetParams", + "cuGraphGetEdges", + "cuGraphGetEdges_v2", + "cuGraphGetNodes", + "cuGraphGetRootNodes", + "cuGraphHostNodeGetParams", + "cuGraphHostNodeSetParams", + "cuGraphInstantiate", + "cuGraphInstantiateWithFlags", + "cuGraphInstantiateWithParams", + "cuGraphInstantiateWithParams_ptsz", + "cuGraphInstantiate_v2", + "cuGraphKernelNodeCopyAttributes", + "cuGraphKernelNodeGetAttribute", + "cuGraphKernelNodeGetParams", + "cuGraphKernelNodeGetParams_v2", + "cuGraphKernelNodeSetAttribute", + "cuGraphKernelNodeSetParams", + "cuGraphKernelNodeSetParams_v2", + "cuGraphLaunch", + "cuGraphLaunch_ptsz", + "cuGraphMemAllocNodeGetParams", + "cuGraphMemFreeNodeGetParams", + "cuGraphMemcpyNodeGetParams", + "cuGraphMemcpyNodeSetParams", + "cuGraphMemsetNodeGetParams", + "cuGraphMemsetNodeSetParams", + "cuGraphNodeFindInClone", + "cuGraphNodeGetDependencies", + "cuGraphNodeGetDependencies_v2", + "cuGraphNodeGetDependentNodes", + "cuGraphNodeGetDependentNodes_v2", + "cuGraphNodeGetEnabled", + "cuGraphNodeGetType", + "cuGraphNodeSetEnabled", + "cuGraphNodeSetParams", + "cuGraphReleaseUserObject", + "cuGraphRemoveDependencies", + "cuGraphRemoveDependencies_v2", + "cuGraphRetainUserObject", + "cuGraphUpload", + "cuGraphUpload_ptsz", + "cuGraphicsEGLRegisterImage", + "cuGraphicsGLRegisterBuffer", + "cuGraphicsGLRegisterImage", + "cuGraphicsMapResources", + "cuGraphicsMapResources_ptsz", + "cuGraphicsResourceGetMappedEglFrame", + "cuGraphicsResourceGetMappedMipmappedArray", + "cuGraphicsResourceGetMappedPointer", + "cuGraphicsResourceGetMappedPointer_v2", + "cuGraphicsResourceSetMapFlags", + "cuGraphicsResourceSetMapFlags_v2", + "cuGraphicsSubResourceGetMappedArray", + "cuGraphicsUnmapResources", + "cuGraphicsUnmapResources_ptsz", + "cuGraphicsUnregisterResource", + "cuGraphicsVDPAURegisterOutputSurface", + "cuGraphicsVDPAURegisterVideoSurface", + "cuImportExternalMemory", + "cuImportExternalSemaphore", + "cuInit", + "cuIpcCloseMemHandle", + "cuIpcGetEventHandle", + "cuIpcGetMemHandle", + "cuIpcOpenEventHandle", + "cuIpcOpenMemHandle", + "cuIpcOpenMemHandle_v2", + "cuKernelGetAttribute", + "cuKernelGetFunction", + "cuKernelGetName", + "cuKernelSetAttribute", + "cuKernelSetCacheConfig", + "cuLaunch", + "cuLaunchCooperativeKernel", + "cuLaunchCooperativeKernelMultiDevice", + "cuLaunchCooperativeKernel_ptsz", + "cuLaunchGrid", + "cuLaunchGridAsync", + "cuLaunchHostFunc", + "cuLaunchHostFunc_ptsz", + "cuLaunchKernel", + "cuLaunchKernelEx", + "cuLaunchKernelEx_ptsz", + "cuLaunchKernel_ptsz", + "cuLibraryGetGlobal", + "cuLibraryGetKernel", + "cuLibraryGetManaged", + "cuLibraryGetModule", + "cuLibraryGetUnifiedFunction", + "cuLibraryLoadData", + "cuLibraryLoadFromFile", + "cuLibraryUnload", + "cuLinkAddData", + "cuLinkAddData_v2", + "cuLinkAddFile", + "cuLinkAddFile_v2", + "cuLinkComplete", + "cuLinkCreate", + "cuLinkCreate_v2", + "cuLinkDestroy", + "cuMemAddressFree", + "cuMemAddressReserve", + "cuMemAdvise", + "cuMemAdvise_v2", + "cuMemAlloc", + "cuMemAllocAsync", + "cuMemAllocAsync_ptsz", + "cuMemAllocFromPoolAsync", + "cuMemAllocFromPoolAsync_ptsz", + "cuMemAllocHost", + "cuMemAllocHost_v2", + "cuMemAllocManaged", + "cuMemAllocPitch", + "cuMemAllocPitch_v2", + "cuMemAlloc_v2", + "cuMemCreate", + "cuMemExportToShareableHandle", + "cuMemFree", + "cuMemFreeAsync", + "cuMemFreeAsync_ptsz", + "cuMemFreeHost", + "cuMemFree_v2", + "cuMemGetAccess", + "cuMemGetAddressRange", + "cuMemGetAddressRange_v2", + "cuMemGetAllocationGranularity", + "cuMemGetAllocationPropertiesFromHandle", + "cuMemGetAttribute", + "cuMemGetAttribute_v2", + "cuMemGetHandleForAddressRange", + "cuMemGetInfo", + "cuMemGetInfo_v2", + "cuMemHostAlloc", + "cuMemHostGetDevicePointer", + "cuMemHostGetDevicePointer_v2", + "cuMemHostGetFlags", + "cuMemHostRegister", + "cuMemHostRegister_v2", + "cuMemHostUnregister", + "cuMemImportFromShareableHandle", + "cuMemMap", + "cuMemMapArrayAsync", + "cuMemMapArrayAsync_ptsz", + "cuMemPoolCreate", + "cuMemPoolDestroy", + "cuMemPoolExportPointer", + "cuMemPoolExportToShareableHandle", + "cuMemPoolGetAccess", + "cuMemPoolGetAttribute", + "cuMemPoolImportFromShareableHandle", + "cuMemPoolImportPointer", + "cuMemPoolSetAccess", + "cuMemPoolSetAttribute", + "cuMemPoolTrimTo", + "cuMemPrefetchAsync", + "cuMemPrefetchAsync_ptsz", + "cuMemPrefetchAsync_v2", + "cuMemPrefetchAsync_v2_ptsz", + "cuMemRangeGetAttribute", + "cuMemRangeGetAttributes", + "cuMemRelease", + "cuMemRetainAllocationHandle", + "cuMemSetAccess", + "cuMemUnmap", + "cuMemcpy", + "cuMemcpy2D", + "cuMemcpy2DAsync", + "cuMemcpy2DAsync_v2", + "cuMemcpy2DAsync_v2_ptsz", + "cuMemcpy2DUnaligned", + "cuMemcpy2DUnaligned_v2", + "cuMemcpy2DUnaligned_v2_ptds", + "cuMemcpy2D_v2", + "cuMemcpy2D_v2_ptds", + "cuMemcpy3D", + "cuMemcpy3DAsync", + "cuMemcpy3DAsync_v2", + "cuMemcpy3DAsync_v2_ptsz", + "cuMemcpy3DPeer", + "cuMemcpy3DPeerAsync", + "cuMemcpy3DPeerAsync_ptsz", + "cuMemcpy3DPeer_ptds", + "cuMemcpy3D_v2", + "cuMemcpy3D_v2_ptds", + "cuMemcpyAsync", + "cuMemcpyAsync_ptsz", + "cuMemcpyAtoA", + "cuMemcpyAtoA_v2", + "cuMemcpyAtoA_v2_ptds", + "cuMemcpyAtoD", + "cuMemcpyAtoD_v2", + "cuMemcpyAtoD_v2_ptds", + "cuMemcpyAtoH", + "cuMemcpyAtoHAsync", + "cuMemcpyAtoHAsync_v2", + "cuMemcpyAtoHAsync_v2_ptsz", + "cuMemcpyAtoH_v2", + "cuMemcpyAtoH_v2_ptds", + "cuMemcpyDtoA", + "cuMemcpyDtoA_v2", + "cuMemcpyDtoA_v2_ptds", + "cuMemcpyDtoD", + "cuMemcpyDtoDAsync", + "cuMemcpyDtoDAsync_v2", + "cuMemcpyDtoDAsync_v2_ptsz", + "cuMemcpyDtoD_v2", + "cuMemcpyDtoD_v2_ptds", + "cuMemcpyDtoH", + "cuMemcpyDtoHAsync", + "cuMemcpyDtoHAsync_v2", + "cuMemcpyDtoHAsync_v2_ptsz", + "cuMemcpyDtoH_v2", + "cuMemcpyDtoH_v2_ptds", + "cuMemcpyHtoA", + "cuMemcpyHtoAAsync", + "cuMemcpyHtoAAsync_v2", + "cuMemcpyHtoAAsync_v2_ptsz", + "cuMemcpyHtoA_v2", + "cuMemcpyHtoA_v2_ptds", + "cuMemcpyHtoD", + "cuMemcpyHtoDAsync", + "cuMemcpyHtoDAsync_v2", + "cuMemcpyHtoDAsync_v2_ptsz", + "cuMemcpyHtoD_v2", + "cuMemcpyHtoD_v2_ptds", + "cuMemcpyPeer", + "cuMemcpyPeerAsync", + "cuMemcpyPeerAsync_ptsz", + "cuMemcpyPeer_ptds", + "cuMemcpy_ptds", + "cuMemsetD16", + "cuMemsetD16Async", + "cuMemsetD16Async_ptsz", + "cuMemsetD16_v2", + "cuMemsetD16_v2_ptds", + "cuMemsetD2D16", + "cuMemsetD2D16Async", + "cuMemsetD2D16Async_ptsz", + "cuMemsetD2D16_v2", + "cuMemsetD2D16_v2_ptds", + "cuMemsetD2D32", + "cuMemsetD2D32Async", + "cuMemsetD2D32Async_ptsz", + "cuMemsetD2D32_v2", + "cuMemsetD2D32_v2_ptds", + "cuMemsetD2D8", + "cuMemsetD2D8Async", + "cuMemsetD2D8Async_ptsz", + "cuMemsetD2D8_v2", + "cuMemsetD2D8_v2_ptds", + "cuMemsetD32", + "cuMemsetD32Async", + "cuMemsetD32Async_ptsz", + "cuMemsetD32_v2", + "cuMemsetD32_v2_ptds", + "cuMemsetD8", + "cuMemsetD8Async", + "cuMemsetD8Async_ptsz", + "cuMemsetD8_v2", + "cuMemsetD8_v2_ptds", + "cuMipmappedArrayCreate", + "cuMipmappedArrayDestroy", + "cuMipmappedArrayGetLevel", + "cuMipmappedArrayGetMemoryRequirements", + "cuMipmappedArrayGetSparseProperties", + "cuModuleGetFunction", + "cuModuleGetGlobal", + "cuModuleGetGlobal_v2", + "cuModuleGetLoadingMode", + "cuModuleGetSurfRef", + "cuModuleGetTexRef", + "cuModuleLoad", + "cuModuleLoadData", + "cuModuleLoadDataEx", + "cuModuleLoadFatBinary", + "cuModuleUnload", + "cuMulticastAddDevice", + "cuMulticastBindAddr", + "cuMulticastBindMem", + "cuMulticastCreate", + "cuMulticastGetGranularity", + "cuMulticastUnbind", + "cuOccupancyAvailableDynamicSMemPerBlock", + "cuOccupancyMaxActiveBlocksPerMultiprocessor", + "cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags", + "cuOccupancyMaxActiveClusters", + "cuOccupancyMaxPotentialBlockSize", + "cuOccupancyMaxPotentialBlockSizeWithFlags", + "cuOccupancyMaxPotentialClusterSize", + "cuParamSetSize", + "cuParamSetTexRef", + "cuParamSetf", + "cuParamSeti", + "cuParamSetv", + "cuPointerGetAttribute", + "cuPointerGetAttributes", + "cuPointerSetAttribute", + "cuProfilerInitialize", + "cuProfilerStart", + "cuProfilerStop", + "cuSignalExternalSemaphoresAsync", + "cuSignalExternalSemaphoresAsync_ptsz", + "cuStreamAddCallback", + "cuStreamAddCallback_ptsz", + "cuStreamAttachMemAsync", + "cuStreamAttachMemAsync_ptsz", + "cuStreamBatchMemOp", + "cuStreamBatchMemOp_ptsz", + "cuStreamBatchMemOp_v2", + "cuStreamBatchMemOp_v2_ptsz", + "cuStreamBeginCapture", + "cuStreamBeginCaptureToGraph", + "cuStreamBeginCaptureToGraph_ptsz", + "cuStreamBeginCapture_ptsz", + "cuStreamBeginCapture_v2", + "cuStreamBeginCapture_v2_ptsz", + "cuStreamCopyAttributes", + "cuStreamCopyAttributes_ptsz", + "cuStreamCreate", + "cuStreamCreateWithPriority", + "cuStreamDestroy", + "cuStreamDestroy_v2", + "cuStreamEndCapture", + "cuStreamEndCapture_ptsz", + "cuStreamGetAttribute", + "cuStreamGetAttribute_ptsz", + "cuStreamGetCaptureInfo", + "cuStreamGetCaptureInfo_ptsz", + "cuStreamGetCaptureInfo_v2", + "cuStreamGetCaptureInfo_v2_ptsz", + "cuStreamGetCaptureInfo_v3", + "cuStreamGetCaptureInfo_v3_ptsz", + "cuStreamGetCtx", + "cuStreamGetCtx_ptsz", + "cuStreamGetFlags", + "cuStreamGetFlags_ptsz", + "cuStreamGetId", + "cuStreamGetId_ptsz", + "cuStreamGetPriority", + "cuStreamGetPriority_ptsz", + "cuStreamIsCapturing", + "cuStreamIsCapturing_ptsz", + "cuStreamQuery", + "cuStreamQuery_ptsz", + "cuStreamSetAttribute", + "cuStreamSetAttribute_ptsz", + "cuStreamSynchronize", + "cuStreamSynchronize_ptsz", + "cuStreamUpdateCaptureDependencies", + "cuStreamUpdateCaptureDependencies_ptsz", + "cuStreamUpdateCaptureDependencies_v2", + "cuStreamUpdateCaptureDependencies_v2_ptsz", + "cuStreamWaitEvent", + "cuStreamWaitEvent_ptsz", + "cuStreamWaitValue32", + "cuStreamWaitValue32_ptsz", + "cuStreamWaitValue32_v2", + "cuStreamWaitValue32_v2_ptsz", + "cuStreamWaitValue64", + "cuStreamWaitValue64_ptsz", + "cuStreamWaitValue64_v2", + "cuStreamWaitValue64_v2_ptsz", + "cuStreamWriteValue32", + "cuStreamWriteValue32_ptsz", + "cuStreamWriteValue32_v2", + "cuStreamWriteValue32_v2_ptsz", + "cuStreamWriteValue64", + "cuStreamWriteValue64_ptsz", + "cuStreamWriteValue64_v2", + "cuStreamWriteValue64_v2_ptsz", + "cuSurfObjectCreate", + "cuSurfObjectDestroy", + "cuSurfObjectGetResourceDesc", + "cuSurfRefGetArray", + "cuSurfRefSetArray", + "cuTensorMapEncodeIm2col", + "cuTensorMapEncodeTiled", + "cuTensorMapReplaceAddress", + "cuTexObjectCreate", + "cuTexObjectDestroy", + "cuTexObjectGetResourceDesc", + "cuTexObjectGetResourceViewDesc", + "cuTexObjectGetTextureDesc", + "cuTexRefCreate", + "cuTexRefDestroy", + "cuTexRefGetAddress", + "cuTexRefGetAddressMode", + "cuTexRefGetAddress_v2", + "cuTexRefGetArray", + "cuTexRefGetBorderColor", + "cuTexRefGetFilterMode", + "cuTexRefGetFlags", + "cuTexRefGetFormat", + "cuTexRefGetMaxAnisotropy", + "cuTexRefGetMipmapFilterMode", + "cuTexRefGetMipmapLevelBias", + "cuTexRefGetMipmapLevelClamp", + "cuTexRefGetMipmappedArray", + "cuTexRefSetAddress", + "cuTexRefSetAddress2D", + "cuTexRefSetAddress2D_v2", + "cuTexRefSetAddress2D_v3", + "cuTexRefSetAddressMode", + "cuTexRefSetAddress_v2", + "cuTexRefSetArray", + "cuTexRefSetBorderColor", + "cuTexRefSetFilterMode", + "cuTexRefSetFlags", + "cuTexRefSetFormat", + "cuTexRefSetMaxAnisotropy", + "cuTexRefSetMipmapFilterMode", + "cuTexRefSetMipmapLevelBias", + "cuTexRefSetMipmapLevelClamp", + "cuTexRefSetMipmappedArray", + "cuThreadExchangeStreamCaptureMode", + "cuUserObjectCreate", + "cuUserObjectRelease", + "cuUserObjectRetain", + "cuVDPAUCtxCreate", + "cuVDPAUCtxCreate_v2", + "cuVDPAUGetDevice", + "cuWaitExternalSemaphoresAsync", + "cuWaitExternalSemaphoresAsync_ptsz", + "cudbgApiAttach", + "cudbgApiClientPid", + "cudbgApiClientRevision", + "cudbgApiDetach", + "cudbgApiInit", + "cudbgAttachHandlerAvailable", + "cudbgDebuggerCapabilities", + "cudbgDebuggerInitialized", + "cudbgDetachSuspendedDevicesMask", + "cudbgEnableIntegratedMemcheck", + "cudbgEnableLaunchBlocking", + "cudbgEnablePreemptionDebugging", + "cudbgGetAPI", + "cudbgGetAPIVersion", + "cudbgInjectionPath", + "cudbgIpcFlag", + "cudbgMain", + "cudbgReportDriverApiError", + "cudbgReportDriverApiErrorFlags", + "cudbgReportDriverInternalError", + "cudbgReportedDriverApiErrorCode", + "cudbgReportedDriverApiErrorFuncNameAddr", + "cudbgReportedDriverApiErrorFuncNameSize", + "cudbgReportedDriverInternalErrorCode", + "cudbgResumeForAttachDetach", + "cudbgRpcEnabled", + "cudbgSessionId", + "cudbgUseExternalDebugger", diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudart.inc b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudart.inc new file mode 100644 index 0000000000000000000000000000000000000000..700bdeebc009816e55e3316e0a74cce75f79ec92 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudart.inc @@ -0,0 +1,413 @@ + "__cudaGetKernel", + "__cudaInitModule", + "__cudaLaunchKernel", + "__cudaLaunchKernel_ptsz", + "__cudaPopCallConfiguration", + "__cudaPushCallConfiguration", + "__cudaRegisterFatBinary", + "__cudaRegisterFatBinaryEnd", + "__cudaRegisterFunction", + "__cudaRegisterHostVar", + "__cudaRegisterManagedVar", + "__cudaRegisterUnifiedTable", + "__cudaRegisterVar", + "__cudaUnregisterFatBinary", + "cudaArrayGetInfo", + "cudaArrayGetMemoryRequirements", + "cudaArrayGetPlane", + "cudaArrayGetSparseProperties", + "cudaChooseDevice", + "cudaCreateChannelDesc", + "cudaCreateSurfaceObject", + "cudaCreateTextureObject", + "cudaCtxResetPersistingL2Cache", + "cudaDestroyExternalMemory", + "cudaDestroyExternalSemaphore", + "cudaDestroySurfaceObject", + "cudaDestroyTextureObject", + "cudaDeviceCanAccessPeer", + "cudaDeviceDisablePeerAccess", + "cudaDeviceEnablePeerAccess", + "cudaDeviceFlushGPUDirectRDMAWrites", + "cudaDeviceGetAttribute", + "cudaDeviceGetByPCIBusId", + "cudaDeviceGetCacheConfig", + "cudaDeviceGetDefaultMemPool", + "cudaDeviceGetGraphMemAttribute", + "cudaDeviceGetLimit", + "cudaDeviceGetMemPool", + "cudaDeviceGetNvSciSyncAttributes", + "cudaDeviceGetP2PAttribute", + "cudaDeviceGetPCIBusId", + "cudaDeviceGetSharedMemConfig", + "cudaDeviceGetStreamPriorityRange", + "cudaDeviceGetTexture1DLinearMaxWidth", + "cudaDeviceGraphMemTrim", + "cudaDeviceReset", + "cudaDeviceSetCacheConfig", + "cudaDeviceSetGraphMemAttribute", + "cudaDeviceSetLimit", + "cudaDeviceSetMemPool", + "cudaDeviceSetSharedMemConfig", + "cudaDeviceSynchronize", + "cudaDriverGetVersion", + "cudaEGLStreamConsumerAcquireFrame", + "cudaEGLStreamConsumerConnect", + "cudaEGLStreamConsumerConnectWithFlags", + "cudaEGLStreamConsumerDisconnect", + "cudaEGLStreamConsumerReleaseFrame", + "cudaEGLStreamProducerConnect", + "cudaEGLStreamProducerDisconnect", + "cudaEGLStreamProducerPresentFrame", + "cudaEGLStreamProducerReturnFrame", + "cudaEventCreate", + "cudaEventCreateFromEGLSync", + "cudaEventCreateWithFlags", + "cudaEventDestroy", + "cudaEventElapsedTime", + "cudaEventQuery", + "cudaEventRecord", + "cudaEventRecordWithFlags", + "cudaEventRecordWithFlags_ptsz", + "cudaEventRecord_ptsz", + "cudaEventSynchronize", + "cudaExternalMemoryGetMappedBuffer", + "cudaExternalMemoryGetMappedMipmappedArray", + "cudaFree", + "cudaFreeArray", + "cudaFreeAsync", + "cudaFreeAsync_ptsz", + "cudaFreeHost", + "cudaFreeMipmappedArray", + "cudaFuncGetAttributes", + "cudaFuncGetName", + "cudaFuncSetAttribute", + "cudaFuncSetCacheConfig", + "cudaFuncSetSharedMemConfig", + "cudaGLGetDevices", + "cudaGLMapBufferObject", + "cudaGLMapBufferObjectAsync", + "cudaGLRegisterBufferObject", + "cudaGLSetBufferObjectMapFlags", + "cudaGLSetGLDevice", + "cudaGLUnmapBufferObject", + "cudaGLUnmapBufferObjectAsync", + "cudaGLUnregisterBufferObject", + "cudaGetChannelDesc", + "cudaGetDevice", + "cudaGetDeviceCount", + "cudaGetDeviceFlags", + "cudaGetDeviceProperties", + "cudaGetDeviceProperties_v2", + "cudaGetDriverEntryPoint", + "cudaGetDriverEntryPoint_ptsz", + "cudaGetErrorName", + "cudaGetErrorString", + "cudaGetExportTable", + "cudaGetFuncBySymbol", + "cudaGetKernel", + "cudaGetLastError", + "cudaGetMipmappedArrayLevel", + "cudaGetSurfaceObjectResourceDesc", + "cudaGetSymbolAddress", + "cudaGetSymbolSize", + "cudaGetTextureObjectResourceDesc", + "cudaGetTextureObjectResourceViewDesc", + "cudaGetTextureObjectTextureDesc", + "cudaGraphAddChildGraphNode", + "cudaGraphAddDependencies", + "cudaGraphAddDependencies_v2", + "cudaGraphAddEmptyNode", + "cudaGraphAddEventRecordNode", + "cudaGraphAddEventWaitNode", + "cudaGraphAddExternalSemaphoresSignalNode", + "cudaGraphAddExternalSemaphoresWaitNode", + "cudaGraphAddHostNode", + "cudaGraphAddKernelNode", + "cudaGraphAddMemAllocNode", + "cudaGraphAddMemFreeNode", + "cudaGraphAddMemcpyNode", + "cudaGraphAddMemcpyNode1D", + "cudaGraphAddMemcpyNodeFromSymbol", + "cudaGraphAddMemcpyNodeToSymbol", + "cudaGraphAddMemsetNode", + "cudaGraphAddNode", + "cudaGraphAddNode_v2", + "cudaGraphChildGraphNodeGetGraph", + "cudaGraphClone", + "cudaGraphConditionalHandleCreate", + "cudaGraphCreate", + "cudaGraphDebugDotPrint", + "cudaGraphDestroy", + "cudaGraphDestroyNode", + "cudaGraphEventRecordNodeGetEvent", + "cudaGraphEventRecordNodeSetEvent", + "cudaGraphEventWaitNodeGetEvent", + "cudaGraphEventWaitNodeSetEvent", + "cudaGraphExecChildGraphNodeSetParams", + "cudaGraphExecDestroy", + "cudaGraphExecEventRecordNodeSetEvent", + "cudaGraphExecEventWaitNodeSetEvent", + "cudaGraphExecExternalSemaphoresSignalNodeSetParams", + "cudaGraphExecExternalSemaphoresWaitNodeSetParams", + "cudaGraphExecGetFlags", + "cudaGraphExecHostNodeSetParams", + "cudaGraphExecKernelNodeSetParams", + "cudaGraphExecMemcpyNodeSetParams", + "cudaGraphExecMemcpyNodeSetParams1D", + "cudaGraphExecMemcpyNodeSetParamsFromSymbol", + "cudaGraphExecMemcpyNodeSetParamsToSymbol", + "cudaGraphExecMemsetNodeSetParams", + "cudaGraphExecNodeSetParams", + "cudaGraphExecUpdate", + "cudaGraphExternalSemaphoresSignalNodeGetParams", + "cudaGraphExternalSemaphoresSignalNodeSetParams", + "cudaGraphExternalSemaphoresWaitNodeGetParams", + "cudaGraphExternalSemaphoresWaitNodeSetParams", + "cudaGraphGetEdges", + "cudaGraphGetEdges_v2", + "cudaGraphGetNodes", + "cudaGraphGetRootNodes", + "cudaGraphHostNodeGetParams", + "cudaGraphHostNodeSetParams", + "cudaGraphInstantiate", + "cudaGraphInstantiateWithFlags", + "cudaGraphInstantiateWithParams", + "cudaGraphInstantiateWithParams_ptsz", + "cudaGraphKernelNodeCopyAttributes", + "cudaGraphKernelNodeGetAttribute", + "cudaGraphKernelNodeGetParams", + "cudaGraphKernelNodeSetAttribute", + "cudaGraphKernelNodeSetParams", + "cudaGraphLaunch", + "cudaGraphLaunch_ptsz", + "cudaGraphMemAllocNodeGetParams", + "cudaGraphMemFreeNodeGetParams", + "cudaGraphMemcpyNodeGetParams", + "cudaGraphMemcpyNodeSetParams", + "cudaGraphMemcpyNodeSetParams1D", + "cudaGraphMemcpyNodeSetParamsFromSymbol", + "cudaGraphMemcpyNodeSetParamsToSymbol", + "cudaGraphMemsetNodeGetParams", + "cudaGraphMemsetNodeSetParams", + "cudaGraphNodeFindInClone", + "cudaGraphNodeGetDependencies", + "cudaGraphNodeGetDependencies_v2", + "cudaGraphNodeGetDependentNodes", + "cudaGraphNodeGetDependentNodes_v2", + "cudaGraphNodeGetEnabled", + "cudaGraphNodeGetType", + "cudaGraphNodeSetEnabled", + "cudaGraphNodeSetParams", + "cudaGraphReleaseUserObject", + "cudaGraphRemoveDependencies", + "cudaGraphRemoveDependencies_v2", + "cudaGraphRetainUserObject", + "cudaGraphUpload", + "cudaGraphUpload_ptsz", + "cudaGraphicsEGLRegisterImage", + "cudaGraphicsGLRegisterBuffer", + "cudaGraphicsGLRegisterImage", + "cudaGraphicsMapResources", + "cudaGraphicsResourceGetMappedEglFrame", + "cudaGraphicsResourceGetMappedMipmappedArray", + "cudaGraphicsResourceGetMappedPointer", + "cudaGraphicsResourceSetMapFlags", + "cudaGraphicsSubResourceGetMappedArray", + "cudaGraphicsUnmapResources", + "cudaGraphicsUnregisterResource", + "cudaGraphicsVDPAURegisterOutputSurface", + "cudaGraphicsVDPAURegisterVideoSurface", + "cudaHostAlloc", + "cudaHostGetDevicePointer", + "cudaHostGetFlags", + "cudaHostRegister", + "cudaHostUnregister", + "cudaImportExternalMemory", + "cudaImportExternalSemaphore", + "cudaInitDevice", + "cudaIpcCloseMemHandle", + "cudaIpcGetEventHandle", + "cudaIpcGetMemHandle", + "cudaIpcOpenEventHandle", + "cudaIpcOpenMemHandle", + "cudaLaunchCooperativeKernel", + "cudaLaunchCooperativeKernelMultiDevice", + "cudaLaunchCooperativeKernel_ptsz", + "cudaLaunchHostFunc", + "cudaLaunchHostFunc_ptsz", + "cudaLaunchKernel", + "cudaLaunchKernelExC", + "cudaLaunchKernelExC_ptsz", + "cudaLaunchKernel_ptsz", + "cudaMalloc", + "cudaMalloc3D", + "cudaMalloc3DArray", + "cudaMallocArray", + "cudaMallocAsync", + "cudaMallocAsync_ptsz", + "cudaMallocFromPoolAsync", + "cudaMallocFromPoolAsync_ptsz", + "cudaMallocHost", + "cudaMallocManaged", + "cudaMallocMipmappedArray", + "cudaMallocPitch", + "cudaMemAdvise", + "cudaMemAdvise_v2", + "cudaMemGetInfo", + "cudaMemPoolCreate", + "cudaMemPoolDestroy", + "cudaMemPoolExportPointer", + "cudaMemPoolExportToShareableHandle", + "cudaMemPoolGetAccess", + "cudaMemPoolGetAttribute", + "cudaMemPoolImportFromShareableHandle", + "cudaMemPoolImportPointer", + "cudaMemPoolSetAccess", + "cudaMemPoolSetAttribute", + "cudaMemPoolTrimTo", + "cudaMemPrefetchAsync", + "cudaMemPrefetchAsync_ptsz", + "cudaMemPrefetchAsync_v2", + "cudaMemPrefetchAsync_v2_ptsz", + "cudaMemRangeGetAttribute", + "cudaMemRangeGetAttributes", + "cudaMemcpy", + "cudaMemcpy2D", + "cudaMemcpy2DArrayToArray", + "cudaMemcpy2DArrayToArray_ptds", + "cudaMemcpy2DAsync", + "cudaMemcpy2DAsync_ptsz", + "cudaMemcpy2DFromArray", + "cudaMemcpy2DFromArrayAsync", + "cudaMemcpy2DFromArrayAsync_ptsz", + "cudaMemcpy2DFromArray_ptds", + "cudaMemcpy2DToArray", + "cudaMemcpy2DToArrayAsync", + "cudaMemcpy2DToArrayAsync_ptsz", + "cudaMemcpy2DToArray_ptds", + "cudaMemcpy2D_ptds", + "cudaMemcpy3D", + "cudaMemcpy3DAsync", + "cudaMemcpy3DAsync_ptsz", + "cudaMemcpy3DPeer", + "cudaMemcpy3DPeerAsync", + "cudaMemcpy3DPeerAsync_ptsz", + "cudaMemcpy3DPeer_ptds", + "cudaMemcpy3D_ptds", + "cudaMemcpyArrayToArray", + "cudaMemcpyArrayToArray_ptds", + "cudaMemcpyAsync", + "cudaMemcpyAsync_ptsz", + "cudaMemcpyFromArray", + "cudaMemcpyFromArrayAsync", + "cudaMemcpyFromArrayAsync_ptsz", + "cudaMemcpyFromArray_ptds", + "cudaMemcpyFromSymbol", + "cudaMemcpyFromSymbolAsync", + "cudaMemcpyFromSymbolAsync_ptsz", + "cudaMemcpyFromSymbol_ptds", + "cudaMemcpyPeer", + "cudaMemcpyPeerAsync", + "cudaMemcpyToArray", + "cudaMemcpyToArrayAsync", + "cudaMemcpyToArrayAsync_ptsz", + "cudaMemcpyToArray_ptds", + "cudaMemcpyToSymbol", + "cudaMemcpyToSymbolAsync", + "cudaMemcpyToSymbolAsync_ptsz", + "cudaMemcpyToSymbol_ptds", + "cudaMemcpy_ptds", + "cudaMemset", + "cudaMemset2D", + "cudaMemset2DAsync", + "cudaMemset2DAsync_ptsz", + "cudaMemset2D_ptds", + "cudaMemset3D", + "cudaMemset3DAsync", + "cudaMemset3DAsync_ptsz", + "cudaMemset3D_ptds", + "cudaMemsetAsync", + "cudaMemsetAsync_ptsz", + "cudaMemset_ptds", + "cudaMipmappedArrayGetMemoryRequirements", + "cudaMipmappedArrayGetSparseProperties", + "cudaOccupancyAvailableDynamicSMemPerBlock", + "cudaOccupancyMaxActiveBlocksPerMultiprocessor", + "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags", + "cudaOccupancyMaxActiveClusters", + "cudaOccupancyMaxPotentialClusterSize", + "cudaPeekAtLastError", + "cudaPointerGetAttributes", + "cudaProfilerStart", + "cudaProfilerStop", + "cudaRuntimeGetVersion", + "cudaSetDevice", + "cudaSetDeviceFlags", + "cudaSetDoubleForDevice", + "cudaSetDoubleForHost", + "cudaSetValidDevices", + "cudaSignalExternalSemaphoresAsync", + "cudaSignalExternalSemaphoresAsync_ptsz", + "cudaSignalExternalSemaphoresAsync_v2", + "cudaSignalExternalSemaphoresAsync_v2_ptsz", + "cudaStreamAddCallback", + "cudaStreamAddCallback_ptsz", + "cudaStreamAttachMemAsync", + "cudaStreamAttachMemAsync_ptsz", + "cudaStreamBeginCapture", + "cudaStreamBeginCaptureToGraph", + "cudaStreamBeginCaptureToGraph_ptsz", + "cudaStreamBeginCapture_ptsz", + "cudaStreamCopyAttributes", + "cudaStreamCopyAttributes_ptsz", + "cudaStreamCreate", + "cudaStreamCreateWithFlags", + "cudaStreamCreateWithPriority", + "cudaStreamDestroy", + "cudaStreamEndCapture", + "cudaStreamEndCapture_ptsz", + "cudaStreamGetAttribute", + "cudaStreamGetAttribute_ptsz", + "cudaStreamGetCaptureInfo", + "cudaStreamGetCaptureInfo_ptsz", + "cudaStreamGetCaptureInfo_v2", + "cudaStreamGetCaptureInfo_v2_ptsz", + "cudaStreamGetCaptureInfo_v3", + "cudaStreamGetCaptureInfo_v3_ptsz", + "cudaStreamGetFlags", + "cudaStreamGetFlags_ptsz", + "cudaStreamGetId", + "cudaStreamGetId_ptsz", + "cudaStreamGetPriority", + "cudaStreamGetPriority_ptsz", + "cudaStreamIsCapturing", + "cudaStreamIsCapturing_ptsz", + "cudaStreamQuery", + "cudaStreamQuery_ptsz", + "cudaStreamSetAttribute", + "cudaStreamSetAttribute_ptsz", + "cudaStreamSynchronize", + "cudaStreamSynchronize_ptsz", + "cudaStreamUpdateCaptureDependencies", + "cudaStreamUpdateCaptureDependencies_ptsz", + "cudaStreamUpdateCaptureDependencies_v2", + "cudaStreamUpdateCaptureDependencies_v2_ptsz", + "cudaStreamWaitEvent", + "cudaStreamWaitEvent_ptsz", + "cudaThreadExchangeStreamCaptureMode", + "cudaThreadExit", + "cudaThreadGetCacheConfig", + "cudaThreadGetLimit", + "cudaThreadSetCacheConfig", + "cudaThreadSetLimit", + "cudaThreadSynchronize", + "cudaUserObjectCreate", + "cudaUserObjectRelease", + "cudaUserObjectRetain", + "cudaVDPAUGetDevice", + "cudaVDPAUSetVDPAUDevice", + "cudaWaitExternalSemaphoresAsync", + "cudaWaitExternalSemaphoresAsync_ptsz", + "cudaWaitExternalSemaphoresAsync_v2", + "cudaWaitExternalSemaphoresAsync_v2_ptsz", diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudnn.inc b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudnn.inc new file mode 100644 index 0000000000000000000000000000000000000000..548f69e63aabd90426b80b7bf1456634cc63c38f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cudnn.inc @@ -0,0 +1,272 @@ + "cudnnActivationBackward", + "cudnnActivationForward", + "cudnnAddTensor", + "cudnnAdvInferVersionCheck", + "cudnnAdvTrainVersionCheck", + "cudnnAdvVersionCheck", + "cudnnBackendCreateDescriptor", + "cudnnBackendDestroyDescriptor", + "cudnnBackendExecute", + "cudnnBackendFinalize", + "cudnnBackendGetAttribute", + "cudnnBackendInitialize", + "cudnnBackendSetAttribute", + "cudnnBatchNormalizationBackward", + "cudnnBatchNormalizationBackwardEx", + "cudnnBatchNormalizationForwardInference", + "cudnnBatchNormalizationForwardTraining", + "cudnnBatchNormalizationForwardTrainingEx", + "cudnnBuildRNNDynamic", + "cudnnCTCLoss", + "cudnnCTCLoss_v8", + "cudnnCnnInferVersionCheck", + "cudnnCnnTrainVersionCheck", + "cudnnCnnVersionCheck", + "cudnnConvolutionBackwardBias", + "cudnnConvolutionBackwardData", + "cudnnConvolutionBackwardFilter", + "cudnnConvolutionBiasActivationForward", + "cudnnConvolutionForward", + "cudnnCopyAlgorithmDescriptor", + "cudnnCreate", + "cudnnCreateActivationDescriptor", + "cudnnCreateAlgorithmDescriptor", + "cudnnCreateAlgorithmPerformance", + "cudnnCreateAttnDescriptor", + "cudnnCreateCTCLossDescriptor", + "cudnnCreateConvolutionDescriptor", + "cudnnCreateDropoutDescriptor", + "cudnnCreateFilterDescriptor", + "cudnnCreateFusedOpsConstParamPack", + "cudnnCreateFusedOpsPlan", + "cudnnCreateFusedOpsVariantParamPack", + "cudnnCreateLRNDescriptor", + "cudnnCreateOpTensorDescriptor", + "cudnnCreatePersistentRNNPlan", + "cudnnCreatePoolingDescriptor", + "cudnnCreateRNNDataDescriptor", + "cudnnCreateRNNDescriptor", + "cudnnCreateReduceTensorDescriptor", + "cudnnCreateSeqDataDescriptor", + "cudnnCreateSpatialTransformerDescriptor", + "cudnnCreateTensorDescriptor", + "cudnnCreateTensorTransformDescriptor", + "cudnnDeriveBNTensorDescriptor", + "cudnnDeriveNormTensorDescriptor", + "cudnnDestroy", + "cudnnDestroyActivationDescriptor", + "cudnnDestroyAlgorithmDescriptor", + "cudnnDestroyAlgorithmPerformance", + "cudnnDestroyAttnDescriptor", + "cudnnDestroyCTCLossDescriptor", + "cudnnDestroyConvolutionDescriptor", + "cudnnDestroyDropoutDescriptor", + "cudnnDestroyFilterDescriptor", + "cudnnDestroyFusedOpsConstParamPack", + "cudnnDestroyFusedOpsPlan", + "cudnnDestroyFusedOpsVariantParamPack", + "cudnnDestroyLRNDescriptor", + "cudnnDestroyOpTensorDescriptor", + "cudnnDestroyPersistentRNNPlan", + "cudnnDestroyPoolingDescriptor", + "cudnnDestroyRNNDataDescriptor", + "cudnnDestroyRNNDescriptor", + "cudnnDestroyReduceTensorDescriptor", + "cudnnDestroySeqDataDescriptor", + "cudnnDestroySpatialTransformerDescriptor", + "cudnnDestroyTensorDescriptor", + "cudnnDestroyTensorTransformDescriptor", + "cudnnDivisiveNormalizationBackward", + "cudnnDivisiveNormalizationForward", + "cudnnDropoutBackward", + "cudnnDropoutForward", + "cudnnDropoutGetReserveSpaceSize", + "cudnnDropoutGetStatesSize", + "cudnnFindConvolutionBackwardDataAlgorithm", + "cudnnFindConvolutionBackwardDataAlgorithmEx", + "cudnnFindConvolutionBackwardFilterAlgorithm", + "cudnnFindConvolutionBackwardFilterAlgorithmEx", + "cudnnFindConvolutionForwardAlgorithm", + "cudnnFindConvolutionForwardAlgorithmEx", + "cudnnFindRNNBackwardDataAlgorithmEx", + "cudnnFindRNNBackwardWeightsAlgorithmEx", + "cudnnFindRNNForwardInferenceAlgorithmEx", + "cudnnFindRNNForwardTrainingAlgorithmEx", + "cudnnFusedOpsExecute", + "cudnnGetActivationDescriptor", + "cudnnGetActivationDescriptorSwishBeta", + "cudnnGetAlgorithmDescriptor", + "cudnnGetAlgorithmPerformance", + "cudnnGetAlgorithmSpaceSize", + "cudnnGetAttnDescriptor", + "cudnnGetBackdoor", + "cudnnGetBatchNormalizationBackwardExWorkspaceSize", + "cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize", + "cudnnGetBatchNormalizationTrainingExReserveSpaceSize", + "cudnnGetCTCLossDescriptor", + "cudnnGetCTCLossDescriptorEx", + "cudnnGetCTCLossDescriptor_v8", + "cudnnGetCTCLossWorkspaceSize", + "cudnnGetCTCLossWorkspaceSize_v8", + "cudnnGetCallback", + "cudnnGetConvolution2dDescriptor", + "cudnnGetConvolution2dForwardOutputDim", + "cudnnGetConvolutionBackwardDataAlgorithmMaxCount", + "cudnnGetConvolutionBackwardDataAlgorithm_v7", + "cudnnGetConvolutionBackwardDataWorkspaceSize", + "cudnnGetConvolutionBackwardFilterAlgorithmMaxCount", + "cudnnGetConvolutionBackwardFilterAlgorithm_v7", + "cudnnGetConvolutionBackwardFilterWorkspaceSize", + "cudnnGetConvolutionForwardAlgorithmMaxCount", + "cudnnGetConvolutionForwardAlgorithm_v7", + "cudnnGetConvolutionForwardWorkspaceSize", + "cudnnGetConvolutionGroupCount", + "cudnnGetConvolutionMathType", + "cudnnGetConvolutionNdDescriptor", + "cudnnGetConvolutionNdForwardOutputDim", + "cudnnGetConvolutionReorderType", + "cudnnGetCudartVersion", + "cudnnGetDropoutDescriptor", + "cudnnGetErrorString", + "cudnnGetFilter4dDescriptor", + "cudnnGetFilterNdDescriptor", + "cudnnGetFilterSizeInBytes", + "cudnnGetFoldedConvBackwardDataDescriptors", + "cudnnGetFusedOpsConstParamPackAttribute", + "cudnnGetFusedOpsVariantParamPackAttribute", + "cudnnGetLRNDescriptor", + "cudnnGetMaxDeviceVersion", + "cudnnGetMultiHeadAttnBuffers", + "cudnnGetMultiHeadAttnWeights", + "cudnnGetNormalizationBackwardWorkspaceSize", + "cudnnGetNormalizationForwardTrainingWorkspaceSize", + "cudnnGetNormalizationTrainingReserveSpaceSize", + "cudnnGetOpTensorDescriptor", + "cudnnGetPooling2dDescriptor", + "cudnnGetPooling2dForwardOutputDim", + "cudnnGetPoolingNdDescriptor", + "cudnnGetPoolingNdForwardOutputDim", + "cudnnGetProperty", + "cudnnGetRNNBackwardDataAlgorithmMaxCount", + "cudnnGetRNNBackwardWeightsAlgorithmMaxCount", + "cudnnGetRNNBiasMode", + "cudnnGetRNNDataDescriptor", + "cudnnGetRNNDescriptor_v6", + "cudnnGetRNNDescriptor_v8", + "cudnnGetRNNDropoutLocationsInternal", + "cudnnGetRNNForwardInferenceAlgorithmMaxCount", + "cudnnGetRNNForwardTrainingAlgorithmMaxCount", + "cudnnGetRNNLinLayerBiasParams", + "cudnnGetRNNLinLayerMatrixParams", + "cudnnGetRNNMatrixMathType", + "cudnnGetRNNPaddingMode", + "cudnnGetRNNParamsSize", + "cudnnGetRNNProjectionLayers", + "cudnnGetRNNTempSpaceSizes", + "cudnnGetRNNTrainingReserveSize", + "cudnnGetRNNWeightParams", + "cudnnGetRNNWeightSpaceSize", + "cudnnGetRNNWorkspaceSize", + "cudnnGetReduceTensorDescriptor", + "cudnnGetReductionIndicesSize", + "cudnnGetReductionWorkspaceSize", + "cudnnGetSeqDataDescriptor", + "cudnnGetStream", + "cudnnGetTensor4dDescriptor", + "cudnnGetTensorNdDescriptor", + "cudnnGetTensorSizeInBytes", + "cudnnGetTensorTransformDescriptor", + "cudnnGetVersion", + "cudnnGraphVersionCheck", + "cudnnIm2Col", + "cudnnInitTransformDest", + "cudnnLRNCrossChannelBackward", + "cudnnLRNCrossChannelForward", + "cudnnMakeFusedOpsPlan", + "cudnnMultiHeadAttnBackwardData", + "cudnnMultiHeadAttnBackwardWeights", + "cudnnMultiHeadAttnForward", + "cudnnNormalizationBackward", + "cudnnNormalizationForwardInference", + "cudnnNormalizationForwardTraining", + "cudnnOpTensor", + "cudnnOpsInferVersionCheck", + "cudnnOpsTrainVersionCheck", + "cudnnOpsVersionCheck", + "cudnnPoolingBackward", + "cudnnPoolingForward", + "cudnnQueryRuntimeError", + "cudnnRNNBackwardData", + "cudnnRNNBackwardDataEx", + "cudnnRNNBackwardData_v8", + "cudnnRNNBackwardWeights", + "cudnnRNNBackwardWeightsEx", + "cudnnRNNBackwardWeights_v8", + "cudnnRNNForward", + "cudnnRNNForwardInference", + "cudnnRNNForwardInferenceEx", + "cudnnRNNForwardTraining", + "cudnnRNNForwardTrainingEx", + "cudnnRNNGetClip", + "cudnnRNNGetClip_v8", + "cudnnRNNSetClip", + "cudnnRNNSetClip_v8", + "cudnnReduceTensor", + "cudnnReorderFilterAndBias", + "cudnnRestoreAlgorithm", + "cudnnRestoreDropoutDescriptor", + "cudnnSaveAlgorithm", + "cudnnScaleTensor", + "cudnnSetActivationDescriptor", + "cudnnSetActivationDescriptorSwishBeta", + "cudnnSetAlgorithmDescriptor", + "cudnnSetAlgorithmPerformance", + "cudnnSetAttnDescriptor", + "cudnnSetBackdoor", + "cudnnSetBackdoorEx", + "cudnnSetCTCLossDescriptor", + "cudnnSetCTCLossDescriptorEx", + "cudnnSetCTCLossDescriptor_v8", + "cudnnSetCallback", + "cudnnSetConvolution2dDescriptor", + "cudnnSetConvolutionGroupCount", + "cudnnSetConvolutionMathType", + "cudnnSetConvolutionNdDescriptor", + "cudnnSetConvolutionReorderType", + "cudnnSetDropoutDescriptor", + "cudnnSetFilter4dDescriptor", + "cudnnSetFilterNdDescriptor", + "cudnnSetFusedOpsConstParamPackAttribute", + "cudnnSetFusedOpsVariantParamPackAttribute", + "cudnnSetLRNDescriptor", + "cudnnSetOpTensorDescriptor", + "cudnnSetPersistentRNNPlan", + "cudnnSetPooling2dDescriptor", + "cudnnSetPoolingNdDescriptor", + "cudnnSetRNNAlgorithmDescriptor", + "cudnnSetRNNBiasMode", + "cudnnSetRNNDataDescriptor", + "cudnnSetRNNDescriptor_v6", + "cudnnSetRNNDescriptor_v8", + "cudnnSetRNNMatrixMathType", + "cudnnSetRNNPaddingMode", + "cudnnSetRNNProjectionLayers", + "cudnnSetReduceTensorDescriptor", + "cudnnSetSeqDataDescriptor", + "cudnnSetSpatialTransformerNdDescriptor", + "cudnnSetStream", + "cudnnSetTensor", + "cudnnSetTensor4dDescriptor", + "cudnnSetTensor4dDescriptorEx", + "cudnnSetTensorNdDescriptor", + "cudnnSetTensorNdDescriptorEx", + "cudnnSetTensorTransformDescriptor", + "cudnnSoftmaxBackward", + "cudnnSoftmaxForward", + "cudnnSpatialTfGridGeneratorBackward", + "cudnnSpatialTfGridGeneratorForward", + "cudnnSpatialTfSamplerBackward", + "cudnnSpatialTfSamplerForward", + "cudnnTransformFilter", + "cudnnTransformTensor", + "cudnnTransformTensorEx", diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/compactptrset.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/compactptrset.h new file mode 100644 index 0000000000000000000000000000000000000000..8fbb7a8560dd1bb1e08714ec464d6bc147ec97f2 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/compactptrset.h @@ -0,0 +1,209 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_LIB_GTL_COMPACTPTRSET_H_ +#define TENSORFLOW_TSL_LIB_GTL_COMPACTPTRSET_H_ + +#include + +#include "tsl/lib/gtl/flatset.h" + +namespace tsl { +namespace gtl { + +// CompactPointerSet is like a std::unordered_set but is optimized +// for small sets (<= 1 element). T must be a pointer type. +template +class CompactPointerSet { + private: + using BigRep = FlatSet; + + public: + using value_type = T; + + CompactPointerSet() : rep_(0) {} + + ~CompactPointerSet() { + static_assert( + std::is_pointer::value, + "CompactPointerSet can only be used with T's that are pointers"); + if (isbig()) delete big(); + } + + CompactPointerSet(const CompactPointerSet& other) : rep_(0) { *this = other; } + + CompactPointerSet& operator=(const CompactPointerSet& other) { + if (this == &other) return *this; + if (other.isbig()) { + // big => any + if (!isbig()) MakeBig(); + *big() = *other.big(); + } else if (isbig()) { + // !big => big + big()->clear(); + if (other.rep_ != 0) { + big()->insert(reinterpret_cast(other.rep_)); + } + } else { + // !big => !big + rep_ = other.rep_; + } + return *this; + } + + class iterator { + public: + typedef ssize_t difference_type; + typedef T value_type; + typedef const T* pointer; + typedef const T& reference; + typedef ::std::forward_iterator_tag iterator_category; + + explicit iterator(uintptr_t rep) + : bigrep_(false), single_(reinterpret_cast(rep)) {} + explicit iterator(typename BigRep::iterator iter) + : bigrep_(true), single_(nullptr), iter_(iter) {} + + iterator& operator++() { + if (bigrep_) { + ++iter_; + } else { + DCHECK(single_ != nullptr); + single_ = nullptr; + } + return *this; + } + // maybe post-increment? + + bool operator==(const iterator& other) const { + if (bigrep_) { + return iter_ == other.iter_; + } else { + return single_ == other.single_; + } + } + bool operator!=(const iterator& other) const { return !(*this == other); } + + const T& operator*() const { + if (bigrep_) { + return *iter_; + } else { + DCHECK(single_ != nullptr); + return single_; + } + } + + private: + friend class CompactPointerSet; + bool bigrep_; + T single_; + typename BigRep::iterator iter_; + }; + using const_iterator = iterator; + + bool empty() const { return isbig() ? big()->empty() : (rep_ == 0); } + size_t size() const { return isbig() ? big()->size() : (rep_ == 0 ? 0 : 1); } + + void clear() { + if (isbig()) { + delete big(); + } + rep_ = 0; + } + + std::pair insert(T elem) { + if (!isbig()) { + if (rep_ == 0) { + uintptr_t v = reinterpret_cast(elem); + if (v == 0 || ((v & 0x3) != 0)) { + // Cannot use small representation for nullptr. Fall through. + } else { + rep_ = v; + return {iterator(v), true}; + } + } + MakeBig(); + } + auto p = big()->insert(elem); + return {iterator(p.first), p.second}; + } + + template + void insert(InputIter begin, InputIter end) { + for (; begin != end; ++begin) { + insert(*begin); + } + } + + const_iterator begin() const { + return isbig() ? iterator(big()->begin()) : iterator(rep_); + } + const_iterator end() const { + return isbig() ? iterator(big()->end()) : iterator(0); + } + + iterator find(T elem) const { + if (rep_ == reinterpret_cast(elem)) { + return iterator(rep_); + } else if (!isbig()) { + return iterator(0); + } else { + return iterator(big()->find(elem)); + } + } + + size_t count(T elem) const { return find(elem) != end() ? 1 : 0; } + + size_t erase(T elem) { + if (!isbig()) { + if (rep_ == reinterpret_cast(elem)) { + rep_ = 0; + return 1; + } else { + return 0; + } + } else { + return big()->erase(elem); + } + } + + private: + // Size rep_ + // ------------------------------------------------------------------------- + // 0 0 + // 1 The pointer itself (bottom bits == 00) + // large Pointer to a BigRep (bottom bits == 01) + uintptr_t rep_; + + bool isbig() const { return (rep_ & 0x3) == 1; } + BigRep* big() const { + DCHECK(isbig()); + return reinterpret_cast(rep_ - 1); + } + + void MakeBig() { + DCHECK(!isbig()); + BigRep* big = new BigRep; + if (rep_ != 0) { + big->insert(reinterpret_cast(rep_)); + } + rep_ = reinterpret_cast(big) + 0x1; + } +}; + +} // namespace gtl +} // namespace tsl + +#endif // TENSORFLOW_TSL_LIB_GTL_COMPACTPTRSET_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/math/math_util.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/math/math_util.h new file mode 100644 index 0000000000000000000000000000000000000000..26dc00939827407e7d56f52af0f6d49b14e8a26d --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/math/math_util.h @@ -0,0 +1,161 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_LIB_MATH_MATH_UTIL_H_ +#define TENSORFLOW_TSL_LIB_MATH_MATH_UTIL_H_ + +#include + +#include "absl/base/macros.h" + +namespace tsl { + +class MathUtil { + public: + // ---------------------------------------------------------------------- + // CeilOfRatio + // FloorOfRatio + // Returns the ceil (resp. floor) of the ratio of two integers. + // + // * IntegralType: any integral type, whether signed or not. + // * numerator: any integer: positive, negative, or zero. + // * denominator: a non-zero integer, positive or negative. + // + // This implementation is correct, meaning there is never any precision loss, + // and there is never an overflow. However, if the type is signed, having + // numerator == MathLimits::kMin and denominator == -1 is not a + // valid input, because kMin has a greater absolute value than kMax. + // + // Input validity is DCHECKed. When not in debug mode, invalid inputs raise + // SIGFPE. + // + // This method has been designed and tested so that it should always be + // preferred to alternatives. Indeed, there exist popular recipes to compute + // the result, such as casting to double, but they are in general incorrect. + // In cases where an alternative technique is correct, performance measurement + // showed the provided implementation is faster. + template + static constexpr IntegralType CeilOfRatio(IntegralType numerator, + IntegralType denominator) { + return CeilOrFloorOfRatio(numerator, denominator); + } + template + static constexpr IntegralType FloorOfRatio(IntegralType numerator, + IntegralType denominator) { + return CeilOrFloorOfRatio(numerator, denominator); + } + + template + static constexpr IntegralType CeilOrFloorOfRatio(IntegralType numerator, + IntegralType denominator); + + template + static constexpr IntegralType GCD(IntegralType x, IntegralType y); + + // ---------------------------------------------------------------------- + // IPow + // Computes the result of raising a number to a non-negative integral power. + // + // * T: An integral type, floating-point type, or user-defined type for which + // operator*= is defined. + // * base: the base "v" of the operation + // * exp: the exponent "i" of the operation; must be non-negative. + // + // Computes v^i, in a way that is faster than std::pow (which supports + // arbitrary real exponents). + // + // When T is a floating point type, this has the same semantics as std::pow, + // but it is much faster. When T is an integral type, computations are + // performed in the value domain of T, and overflow semantics are those of T. + // + // Input validity is DCHECKed. + template + static constexpr T IPow(T base, int exp); +}; + +// ---- CeilOrFloorOfRatio ---- +// This is a branching-free, cast-to-double-free implementation. +// +// Casting to double is in general incorrect because of loss of precision +// when casting an int64 into a double. +// +// There's a bunch of 'recipes' to compute a integer ceil (or floor) on the web, +// and most of them are incorrect. +template +constexpr IntegralType MathUtil::CeilOrFloorOfRatio(IntegralType numerator, + IntegralType denominator) { + ABSL_ASSERT(denominator != 0); + + const IntegralType rounded_toward_zero = numerator / denominator; + const IntegralType intermediate_product = rounded_toward_zero * denominator; + + if (ceil) { // Compile-time condition: not an actual branching + // When rounded_toward_zero is negative, then an adjustment is never needed: + // the real ratio is negative, and so rounded toward zero is the ceil. + // When rounded_toward_zero is non-negative, an adjustment is needed if the + // sign of the difference numerator - intermediate_product is the same as + // the sign of the denominator. + // + // + // Using a bool and then a static_cast to IntegralType is not strictly + // necessary, but it makes the code clear, and anyway the compiler should + // get rid of it. + const bool needs_adjustment = + (rounded_toward_zero >= 0) && + ((denominator > 0 && numerator > intermediate_product) || + (denominator < 0 && numerator < intermediate_product)); + const IntegralType adjustment = static_cast(needs_adjustment); + const IntegralType ceil_of_ratio = rounded_toward_zero + adjustment; + return ceil_of_ratio; + } else { + // Floor case: symmetrical to the previous one + const bool needs_adjustment = + (rounded_toward_zero <= 0) && + ((denominator > 0 && numerator < intermediate_product) || + (denominator < 0 && numerator > intermediate_product)); + const IntegralType adjustment = static_cast(needs_adjustment); + const IntegralType floor_of_ratio = rounded_toward_zero - adjustment; + return floor_of_ratio; + } +} + +template +constexpr IntegralType MathUtil::GCD(IntegralType x, IntegralType y) { + static_assert(std::is_unsigned_v, "signed GCD not supported!"); + while (y != 0) { + IntegralType r = x % y; + x = y; + y = r; + } + return x; +} + +// ---- IPow ---- +// Implemented with the squared exponentiation method (a.k.a. double-and-add). +// +// Note that "exp >>= 1" is faster than "exp /= 2" on at least one platform. +template +constexpr T MathUtil::IPow(T base, int exp) { + ABSL_ASSERT(exp >= 0); + for (T result(1);; base *= base) { + if ((exp & 1) != 0) result *= base; + exp >>= 1; + if (exp == 0) return result; + } +} + +} // namespace tsl + +#endif // TENSORFLOW_TSL_LIB_MATH_MATH_UTIL_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/byte_order.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/byte_order.h new file mode 100644 index 0000000000000000000000000000000000000000..f38df9fb2f65077ef7fed0d2bea3240817978341 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/byte_order.h @@ -0,0 +1,37 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_BYTE_ORDER_H_ +#define TENSORFLOW_TSL_PLATFORM_BYTE_ORDER_H_ + +// Byte order defines provided by gcc. MSVC doesn't define those so +// we define them here. +// We assume that all windows platform out there are little endian. +#if defined(_MSC_VER) && !defined(__clang__) +#define __ORDER_LITTLE_ENDIAN__ 0x4d2 +#define __ORDER_BIG_ENDIAN__ 0x10e1 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#endif + +namespace tsl { +namespace port { + +// TODO(jeff,sanjay): Make portable +constexpr bool kLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__; + +} // namespace port +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_BYTE_ORDER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/auth_provider.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/auth_provider.h new file mode 100644 index 0000000000000000000000000000000000000000..969b8bc0cea23e3bf093d01e5923ac674c23f6f6 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/auth_provider.h @@ -0,0 +1,55 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_AUTH_PROVIDER_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_AUTH_PROVIDER_H_ + +#include + +#include "tsl/platform/errors.h" +#include "tsl/platform/status.h" + +namespace tsl { + +/// Interface for a provider of authentication bearer tokens. +class AuthProvider { + public: + virtual ~AuthProvider() {} + + /// \brief Returns the short-term authentication bearer token. + /// + /// Safe for concurrent use by multiple threads. + virtual Status GetToken(string* t) = 0; + + static Status GetToken(AuthProvider* provider, string* token) { + if (!provider) { + return errors::Internal("Auth provider is required."); + } + return provider->GetToken(token); + } +}; + +/// No-op auth provider, which will only work for public objects. +class EmptyAuthProvider : public AuthProvider { + public: + Status GetToken(string* token) override { + *token = ""; + return OkStatus(); + } +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_AUTH_PROVIDER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_metadata_client.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_metadata_client.h new file mode 100644 index 0000000000000000000000000000000000000000..fac94cdb1c9c8c545a6ee77867dac784069ad438 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_metadata_client.h @@ -0,0 +1,67 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_METADATA_CLIENT_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_METADATA_CLIENT_H_ + +#include "tsl/platform/cloud/http_request.h" +#include "tsl/platform/retrying_utils.h" +#include "tsl/platform/status.h" + +namespace tsl { + +/// \brief A client that accesses to the metadata server running on GCE hosts. +/// +/// Uses the provided HttpRequest::Factory to make requests to the local +/// metadata service +/// (https://cloud.google.com/compute/docs/storing-retrieving-metadata). +/// Retries on recoverable failures using exponential backoff with the initial +/// retry wait configurable via initial_retry_delay_usec. +class ComputeEngineMetadataClient { + public: + explicit ComputeEngineMetadataClient( + std::shared_ptr http_request_factory, + const RetryConfig& config = RetryConfig( + 10000, /* init_delay_time_us = 1 ms */ + 1000000 /* max_delay_time_us = 1 s */ + )); + virtual ~ComputeEngineMetadataClient() {} + + /// \brief Get the metadata value for a given attribute of the metadata + /// service. + /// + /// Given a metadata path relative + /// to http://metadata.google.internal/computeMetadata/v1/, + /// fills response_buffer with the metadata. Returns OK if the server returns + /// the response for the given metadata path successfully. + /// + /// Example usage: + /// To get the zone of an instance: + /// compute_engine_metadata_client.GetMetadata( + /// "instance/zone", response_buffer); + virtual Status GetMetadata(const string& path, + std::vector* response_buffer); + + private: + std::shared_ptr http_request_factory_; + const RetryConfig retry_config_; + + ComputeEngineMetadataClient(const ComputeEngineMetadataClient&) = delete; + void operator=(const ComputeEngineMetadataClient&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_METADATA_CLIENT_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_zone_provider.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_zone_provider.h new file mode 100644 index 0000000000000000000000000000000000000000..a37b43c22a484f5a579ad0dcb704783e16817c62 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/compute_engine_zone_provider.h @@ -0,0 +1,41 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_ZONE_PROVIDER_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_ZONE_PROVIDER_H_ + +#include "tsl/platform/cloud/compute_engine_metadata_client.h" +#include "tsl/platform/cloud/zone_provider.h" + +namespace tsl { + +class ComputeEngineZoneProvider : public ZoneProvider { + public: + explicit ComputeEngineZoneProvider( + std::shared_ptr google_metadata_client); + virtual ~ComputeEngineZoneProvider(); + + Status GetZone(string* zone) override; + + private: + std::shared_ptr google_metadata_client_; + string cached_zone; + ComputeEngineZoneProvider(const ComputeEngineZoneProvider&) = delete; + void operator=(const ComputeEngineZoneProvider&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_COMPUTE_ENGINE_ZONE_PROVIDER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/curl_http_request.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/curl_http_request.h new file mode 100644 index 0000000000000000000000000000000000000000..490e762967f182bee4fb211ad5cf2cfb7eadbcdf --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/curl_http_request.h @@ -0,0 +1,275 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_CURL_HTTP_REQUEST_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_CURL_HTTP_REQUEST_H_ + +#include +#include +#include + +#include +#include "tsl/platform/cloud/http_request.h" +#include "tsl/platform/env.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/protobuf.h" +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/types.h" + +namespace tsl { + +class LibCurl; // libcurl interface as a class, for dependency injection. + +/// \brief A basic HTTP client based on the libcurl library. +/// +/// The usage pattern for the class reflects the one of the libcurl library: +/// create a request object, set request parameters and call Send(). +/// +/// For example: +/// std::unique_ptr request(http_request_factory->Create()); +/// request->SetUri("http://www.google.com"); +/// request->SetResultsBuffer(out_buffer); +/// request->Send(); +class CurlHttpRequest : public HttpRequest { + public: + class Factory : public HttpRequest::Factory { + public: + virtual ~Factory() {} + virtual HttpRequest* Create() { return new CurlHttpRequest(); } + }; + + CurlHttpRequest(); + explicit CurlHttpRequest(LibCurl* libcurl) + : CurlHttpRequest(libcurl, Env::Default()) {} + CurlHttpRequest(LibCurl* libcurl, Env* env); + ~CurlHttpRequest() override; + + /// Sets the request URI. + void SetUri(const string& uri) override; + + /// \brief Sets the Range header. + /// + /// Used for random seeks, for example "0-999" returns the first 1000 bytes + /// (note that the right border is included). + void SetRange(uint64 start, uint64 end) override; + + /// Sets a request header. + void AddHeader(const string& name, const string& value) override; + + void AddResolveOverride(const string& hostname, int64_t port, + const string& ip_addr) override; + + /// Sets the 'Authorization' header to the value of 'Bearer ' + auth_token. + void AddAuthBearerHeader(const string& auth_token) override; + + void SetRequestStats(RequestStats* stats) override; + + /// Makes the request a DELETE request. + void SetDeleteRequest() override; + + /// \brief Makes the request a PUT request. + /// + /// The request body will be taken from the specified file starting from + /// the given offset. + Status SetPutFromFile(const string& body_filepath, size_t offset) override; + + /// Makes the request a PUT request with an empty body. + void SetPutEmptyBody() override; + + /// \brief Makes the request a POST request. + /// + /// The request body will be taken from the specified buffer. + void SetPostFromBuffer(const char* buffer, size_t size) override; + + /// Makes the request a POST request with an empty body. + void SetPostEmptyBody() override; + + /// \brief Specifies the buffer for receiving the response body. + /// + /// Size of out_buffer after an access will be exactly the number of bytes + /// read. Existing content of the vector will be cleared. + void SetResultBuffer(std::vector* out_buffer) override; + + /// \brief Specifies the buffer for receiving the response body, when the + /// caller knows the maximum size of the response body. + /// + /// This method allows the caller to receive the response body without an + /// additional intermediate buffer allocation and copy. This method should + /// be called before calling Send(). After Send() has succeeded, the caller + /// should use the GetResultBufferDirectBytesTransferred() method in order + /// to learn how many bytes were transferred. + /// + /// Using this method is mutually exclusive with using SetResultBuffer(). + void SetResultBufferDirect(char* buffer, size_t size) override; + + /// \brief Distinguish response type (direct vs. implicit). + bool IsDirectResponse() const; + + /// \brief Returns the number of bytes (of the response body) that were + /// transferred, when using the SetResultBufferDirect() method. The returned + /// value will always be less than or equal to the 'size' parameter that + /// was passed to SetResultBufferDirect(). If the actual HTTP response body + /// was greater than 'size' bytes, then this transfer method will only copy + /// the first 'size' bytes, and the rest will be ignored. + size_t GetResultBufferDirectBytesTransferred() override; + + /// \brief Returns the response headers of a completed request. + /// + /// If the header is not found, returns an empty string. + string GetResponseHeader(const string& name) const override; + + /// Returns the response code of a completed request. + uint64 GetResponseCode() const override; + + /// \brief Sends the formed request. + /// + /// If the result buffer was defined, the response will be written there. + /// The object is not designed to be re-used after Send() is executed. + Status Send() override; + + // Url encodes str and returns a new string. + string EscapeString(const string& str) override; + + void SetTimeouts(uint32 connection, uint32 inactivity, uint32 total) override; + + private: + /// A write callback in the form which can be accepted by libcurl. + static size_t WriteCallback(const void* ptr, size_t size, size_t nmemb, + void* userdata); + + /// Processes response body content received when using SetResultBufferDirect. + static size_t WriteCallbackDirect(const void* ptr, size_t size, size_t nmemb, + void* userdata); + /// A read callback in the form which can be accepted by libcurl. + static size_t ReadCallback(void* ptr, size_t size, size_t nmemb, + FILE* userdata); + /// A header callback in the form which can be accepted by libcurl. + static size_t HeaderCallback(const void* ptr, size_t size, size_t nmemb, + void* this_object); + /// A progress meter callback in the form which can be accepted by libcurl. + static int ProgressCallback(void* this_object, curl_off_t dltotal, + curl_off_t dlnow, curl_off_t ultotal, + curl_off_t ulnow); + void CheckMethodNotSet() const; + void CheckNotSent() const; + StringPiece GetResponse() const; + + /// Helper to convert the given CURLcode and error buffer, representing the + /// result of performing a transfer, into a Status with an error message. + Status CURLcodeToStatus(CURLcode code, const char* error_buffer); + + LibCurl* libcurl_; + Env* env_; + + FILE* put_body_ = nullptr; + + StringPiece post_body_buffer_; + size_t post_body_read_ = 0; + + std::vector* response_buffer_ = nullptr; + + struct DirectResponseState { + char* buffer_; + size_t buffer_size_; + size_t bytes_transferred_; + size_t bytes_received_; + }; + DirectResponseState direct_response_ = {}; + + CURL* curl_ = nullptr; + curl_slist* curl_headers_ = nullptr; + curl_slist* resolve_list_ = nullptr; + + RequestStats* stats_ = nullptr; + + std::vector default_response_buffer_; + + std::unordered_map response_headers_; + uint64 response_code_ = 0; + + // The timestamp of the last activity related to the request execution, in + // seconds since epoch. + uint64 last_progress_timestamp_ = 0; + // The last progress in terms of bytes transmitted. + curl_off_t last_progress_bytes_ = 0; + + // The maximum period of request inactivity. + uint32 inactivity_timeout_secs_ = 60; // 1 minute + + // Timeout for the connection phase. + uint32 connect_timeout_secs_ = 120; // 2 minutes + + // Timeout for the whole request. Set only to prevent hanging indefinitely. + uint32 request_timeout_secs_ = 3600; // 1 hour + + // Members to enforce the usage flow. + bool is_uri_set_ = false; + bool is_method_set_ = false; + bool is_sent_ = false; + + // Store the URI to help disambiguate requests when errors occur. + string uri_; + RequestMethod method_ = RequestMethod::kGet; + + // Limit the size of an http response that is copied into an error message. + const size_t response_to_error_limit_ = 500; + + CurlHttpRequest(const CurlHttpRequest&) = delete; + void operator=(const CurlHttpRequest&) = delete; +}; + +/// \brief A proxy to the libcurl C interface as a dependency injection measure. +/// +/// This class is meant as a very thin wrapper for the libcurl C library. +class LibCurl { + public: + virtual ~LibCurl() {} + + virtual CURL* curl_easy_init() = 0; + virtual CURLcode curl_easy_setopt(CURL* curl, CURLoption option, + uint64 param) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_setopt(CURL* curl, CURLoption option, + const char* param) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_setopt(CURL* curl, CURLoption option, + void* param) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_setopt( + CURL* curl, CURLoption option, + size_t (*param)(void*, size_t, size_t, FILE*)) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_setopt(CURL* curl, CURLoption option, + size_t (*param)(const void*, size_t, size_t, + void*)) + TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_setopt( + CURL* curl, CURLoption option, + int (*param)(void* clientp, curl_off_t dltotal, curl_off_t dlnow, + curl_off_t ultotal, + curl_off_t ulnow)) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_perform(CURL* curl) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_getinfo(CURL* curl, CURLINFO info, + uint64* value) TF_MUST_USE_RESULT = 0; + virtual CURLcode curl_easy_getinfo(CURL* curl, CURLINFO info, + double* value) TF_MUST_USE_RESULT = 0; + virtual void curl_easy_cleanup(CURL* curl) = 0; + virtual curl_slist* curl_slist_append(curl_slist* list, const char* str) = 0; + virtual void curl_slist_free_all(curl_slist* list) = 0; + virtual char* curl_easy_escape(CURL* curl, const char* str, int length) = 0; + virtual void curl_free(void* p) = 0; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_CURL_HTTP_REQUEST_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/expiring_lru_cache.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/expiring_lru_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..1def81b6d0d56206966ace45eced9fc5d8dea430 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/expiring_lru_cache.h @@ -0,0 +1,188 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_EXPIRING_LRU_CACHE_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_EXPIRING_LRU_CACHE_H_ + +#include +#include +#include +#include + +#include "tsl/platform/env.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/thread_annotations.h" +#include "tsl/platform/types.h" + +namespace tsl { + +/// \brief An LRU cache of string keys and arbitrary values, with configurable +/// max item age (in seconds) and max entries. +/// +/// This class is thread safe. +template +class ExpiringLRUCache { + public: + /// A `max_age` of 0 means that nothing is cached. A `max_entries` of 0 means + /// that there is no limit on the number of entries in the cache (however, if + /// `max_age` is also 0, the cache will not be populated). + ExpiringLRUCache(uint64 max_age, size_t max_entries, + Env* env = Env::Default()) + : max_age_(max_age), max_entries_(max_entries), env_(env) {} + + /// Insert `value` with key `key`. This will replace any previous entry with + /// the same key. + void Insert(const string& key, const T& value) { + if (max_age_ == 0) { + return; + } + mutex_lock lock(mu_); + InsertLocked(key, value); + } + + // Delete the entry with key `key`. Return true if the entry was found for + // `key`, false if the entry was not found. In both cases, there is no entry + // with key `key` existed after the call. + bool Delete(const string& key) { + mutex_lock lock(mu_); + return DeleteLocked(key); + } + + /// Look up the entry with key `key` and copy it to `value` if found. Returns + /// true if an entry was found for `key`, and its timestamp is not more than + /// max_age_ seconds in the past. + bool Lookup(const string& key, T* value) { + if (max_age_ == 0) { + return false; + } + mutex_lock lock(mu_); + return LookupLocked(key, value); + } + + typedef std::function ComputeFunc; + + /// Look up the entry with key `key` and copy it to `value` if found. If not + /// found, call `compute_func`. If `compute_func` returns successfully, store + /// a copy of the output parameter in the cache, and another copy in `value`. + Status LookupOrCompute(const string& key, T* value, + const ComputeFunc& compute_func) { + if (max_age_ == 0) { + return compute_func(key, value); + } + + // Note: we hold onto mu_ for the rest of this function. In practice, this + // is okay, as stat requests are typically fast, and concurrent requests are + // often for the same file. Future work can split this up into one lock per + // key if this proves to be a significant performance bottleneck. + mutex_lock lock(mu_); + if (LookupLocked(key, value)) { + return OkStatus(); + } + Status s = compute_func(key, value); + if (s.ok()) { + InsertLocked(key, *value); + } + return s; + } + + /// Clear the cache. + void Clear() { + mutex_lock lock(mu_); + cache_.clear(); + lru_list_.clear(); + } + + /// Accessors for cache parameters. + uint64 max_age() const { return max_age_; } + size_t max_entries() const { return max_entries_; } + + private: + struct Entry { + /// The timestamp (seconds) at which the entry was added to the cache. + uint64 timestamp; + + /// The entry's value. + T value; + + /// A list iterator pointing to the entry's position in the LRU list. + std::list::iterator lru_iterator; + }; + + bool LookupLocked(const string& key, T* value) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_) { + auto it = cache_.find(key); + if (it == cache_.end()) { + return false; + } + lru_list_.erase(it->second.lru_iterator); + if (env_->NowSeconds() - it->second.timestamp > max_age_) { + cache_.erase(it); + return false; + } + *value = it->second.value; + lru_list_.push_front(it->first); + it->second.lru_iterator = lru_list_.begin(); + return true; + } + + void InsertLocked(const string& key, const T& value) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_) { + lru_list_.push_front(key); + Entry entry{env_->NowSeconds(), value, lru_list_.begin()}; + auto insert = cache_.insert(std::make_pair(key, entry)); + if (!insert.second) { + lru_list_.erase(insert.first->second.lru_iterator); + insert.first->second = entry; + } else if (max_entries_ > 0 && cache_.size() > max_entries_) { + cache_.erase(lru_list_.back()); + lru_list_.pop_back(); + } + } + + bool DeleteLocked(const string& key) TF_EXCLUSIVE_LOCKS_REQUIRED(mu_) { + auto it = cache_.find(key); + if (it == cache_.end()) { + return false; + } + lru_list_.erase(it->second.lru_iterator); + cache_.erase(it); + return true; + } + + /// The maximum age of entries in the cache, in seconds. A value of 0 means + /// that no entry is ever placed in the cache. + const uint64 max_age_; + + /// The maximum number of entries in the cache. A value of 0 means there is no + /// limit on entry count. + const size_t max_entries_; + + /// The Env from which we read timestamps. + Env* const env_; // not owned + + /// Guards access to the cache and the LRU list. + mutex mu_; + + /// The cache (a map from string key to Entry). + std::map cache_ TF_GUARDED_BY(mu_); + + /// The LRU list of entries. The front of the list identifies the most + /// recently accessed entry. + std::list lru_list_ TF_GUARDED_BY(mu_); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_EXPIRING_LRU_CACHE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/file_block_cache.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/file_block_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..e336a42835c9f9234cfb2e9cb9ff1c67b5c5daa3 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/file_block_cache.h @@ -0,0 +1,139 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_FILE_BLOCK_CACHE_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_FILE_BLOCK_CACHE_H_ + +#include +#include +#include +#include +#include +#include + +#include "tsl/platform/env.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/notification.h" +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/thread_annotations.h" +#include "tsl/platform/types.h" + +namespace tsl { + +class FileBlockCache; + +/// FileBlockCacheStatsInterface allows for instrumentation of the block cache. +/// +/// FileBlockCacheStatsInterface and its subclasses must be safe to use from +/// multiple threads concurrently. +/// +/// WARNING! This is an experimental interface that may change or go away at any +/// time. +class FileBlockCacheStatsInterface { + public: + /// Configure is called to provide instrumentation hooks. + /// + /// Note: Configure can be called multiple times (e.g. if the block cache is + /// re-initialized). + virtual void Configure(const FileBlockCache* block_cache) = 0; + + /// RecordBlockLoadRequest is called to record the size of a hit block. + virtual void RecordCacheHitBlockSize(size_t bytes_transferred) = 0; + + /// RecordBlockLoadRequest is called to record the size of a missed block. + virtual void RecordCacheMissBlockSize(size_t bytes_transferred) = 0; + + virtual ~FileBlockCacheStatsInterface() = default; +}; + +/// \brief A block cache of file contents, keyed by {filename, offset}. +/// +/// This class should be shared by read-only random access files on a remote +/// filesystem (e.g. GCS). +class FileBlockCache { + public: + /// The callback executed when a block is not found in the cache, and needs to + /// be fetched from the backing filesystem. This callback is provided when the + /// cache is constructed. The returned Status should be OK as long as the + /// read from the remote filesystem succeeded (similar to the semantics of the + /// read(2) system call). + typedef std::function + BlockFetcher; + + virtual ~FileBlockCache() {} + + /// Read `n` bytes from `filename` starting at `offset` into `out`. This + /// method will return: + /// + /// 1) The error from the remote filesystem, if the read from the remote + /// filesystem failed. + /// 2) PRECONDITION_FAILED if the read from the remote filesystem succeeded, + /// but the read returned a partial block, and the LRU cache contained a + /// block at a higher offset (indicating that the partial block should have + /// been a full block). + /// 3) OUT_OF_RANGE if the read from the remote filesystem succeeded, but + /// the file contents do not extend past `offset` and thus nothing was + /// placed in `out`. + /// 4) OK otherwise (i.e. the read succeeded, and at least one byte was placed + /// in `out`). + virtual Status Read(const string& filename, size_t offset, size_t n, + char* buffer, size_t* bytes_transferred) = 0; + + // Validate the given file signature with the existing file signature in the + // cache. Returns true if the signature doesn't change or the file did not + // exist before. If the signature changes, update the existing signature with + // the new one and remove the file from cache. + virtual bool ValidateAndUpdateFileSignature(const string& filename, + int64_t file_signature) = 0; + + /// Remove all cached blocks for `filename`. + virtual void RemoveFile(const string& filename) = 0; + + /// Remove all cached data. + virtual void Flush() = 0; + + /// Accessors for cache parameters. + virtual size_t block_size() const = 0; + virtual size_t max_bytes() const = 0; + virtual uint64 max_staleness() const = 0; + + /// The current size (in bytes) of the cache. + virtual size_t CacheSize() const = 0; + + // Returns true if the cache is enabled. If false, the BlockFetcher callback + // is always executed during Read. + virtual bool IsCacheEnabled() const = 0; + + void SetStats(FileBlockCacheStatsInterface* stats) { + if (stats == nullptr) { + LOG(ERROR) + << "Attempted to monitor a NULL stats object. This may prevent the " + "corresponding monitoring data from being exported"; + return; + } + cache_stats_ = stats; + cache_stats_->Configure(this); + } + + protected: + FileBlockCacheStatsInterface* cache_stats_ = nullptr; // Not owned. +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_FILE_BLOCK_CACHE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_dns_cache.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_dns_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..b2883fb13637040905f5003245d795fe99d42366 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_dns_cache.h @@ -0,0 +1,77 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_DNS_CACHE_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_DNS_CACHE_H_ + +#include + +#include "tsl/platform/cloud/http_request.h" +#include "tsl/platform/env.h" + +namespace tsl { +const int64_t kDefaultRefreshRateSecs = 60; + +// DnsCache is a userspace DNS cache specialized for the GCS filesystem. +// +// Some environments have unreliable DNS resolvers. DnsCache ameliorates the +// situation by radically reducing the number of DNS requests by performing +// 2 DNS queries per minute (by default) on a background thread. Updated cache +// entries are used to override curl's DNS resolution processes. +class GcsDnsCache { + public: + // Default no-argument constructor. + GcsDnsCache() : GcsDnsCache(kDefaultRefreshRateSecs) {} + + // Constructs a GcsDnsCache with the specified refresh rate. + GcsDnsCache(int64_t refresh_rate_secs) + : GcsDnsCache(Env::Default(), refresh_rate_secs) {} + + GcsDnsCache(Env* env, int64_t refresh_rate_secs); + + ~GcsDnsCache() { + mutex_lock l(mu_); + cancelled_ = true; + cond_var_.notify_one(); + } + + // Annotate the given HttpRequest with resolve overrides from the cache. + void AnnotateRequest(HttpRequest* request); + + private: + static std::vector ResolveName(const string& name); + static std::vector> ResolveNames( + const std::vector& names); + void WorkerThread(); + + // Define a friend class for testing. + friend class GcsDnsCacheTest; + + mutex mu_; + Env* env_; + condition_variable cond_var_; + std::default_random_engine random_ TF_GUARDED_BY(mu_); + bool started_ TF_GUARDED_BY(mu_) = false; + bool cancelled_ TF_GUARDED_BY(mu_) = false; + std::unique_ptr worker_ TF_GUARDED_BY(mu_); // After mutable vars. + const int64_t refresh_rate_secs_; + + // Entries in this vector correspond to entries in kCachedDomainNames. + std::vector> addresses_ TF_GUARDED_BY(mu_); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_DNS_CACHE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_file_system.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_file_system.h new file mode 100644 index 0000000000000000000000000000000000000000..17725e8d5b01e69a3a461a1439253d9e131e5bdc --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_file_system.h @@ -0,0 +1,456 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_FILE_SYSTEM_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_FILE_SYSTEM_H_ + +#include +#include +#include +#include + +#include "tsl/platform/cloud/auth_provider.h" +#include "tsl/platform/cloud/compute_engine_metadata_client.h" +#include "tsl/platform/cloud/compute_engine_zone_provider.h" +#include "tsl/platform/cloud/expiring_lru_cache.h" +#include "tsl/platform/cloud/file_block_cache.h" +#include "tsl/platform/cloud/gcs_dns_cache.h" +#include "tsl/platform/cloud/gcs_throttle.h" +#include "tsl/platform/cloud/http_request.h" +#include "tsl/platform/file_system.h" +#include "tsl/platform/retrying_file_system.h" +#include "tsl/platform/status.h" + +namespace tsl { + +class GcsFileSystem; + +// The environment variable that overrides the block size for aligned reads from +// GCS. Specified in MB (e.g. "16" = 16 x 1024 x 1024 = 16777216 bytes). +constexpr char kBlockSize[] = "GCS_READ_CACHE_BLOCK_SIZE_MB"; +#if defined(LIBTPU_ON_GCE) +// Overwrite the default max block size for `libtpu` BUILDs which do not +// offer a mechanism to override the default through environment variable. +constexpr size_t kDefaultBlockSize = 512 * 1024 * 1024; +#else +constexpr size_t kDefaultBlockSize = 64 * 1024 * 1024; +#endif +// The environment variable that overrides the max size of the LRU cache of +// blocks read from GCS. Specified in MB. +constexpr char kMaxCacheSize[] = "GCS_READ_CACHE_MAX_SIZE_MB"; +#if defined(LIBTPU_ON_GCE) +// Overwrite the default max cache size for `libtpu` BUILDs which do not +// offer a mechanism to override the default through environment variable. +constexpr size_t kDefaultMaxCacheSize = 163840LL * 1024LL * 1024LL; +#else +constexpr size_t kDefaultMaxCacheSize = 0; +#endif +// The environment variable that overrides the maximum staleness of cached file +// contents. Once any block of a file reaches this staleness, all cached blocks +// will be evicted on the next read. +constexpr char kMaxStaleness[] = "GCS_READ_CACHE_MAX_STALENESS"; +constexpr uint64 kDefaultMaxStaleness = 0; + +// Helper function to extract an environment variable and convert it into a +// value of type T. +template +bool GetEnvVar(const char* varname, bool (*convert)(StringPiece, T*), + T* value) { + const char* env_value = std::getenv(varname); + if (env_value == nullptr) { + return false; + } + return convert(env_value, value); +} + +/// GcsStatsInterface allows for instrumentation of the GCS file system. +/// +/// GcsStatsInterface and its subclasses must be safe to use from multiple +/// threads concurrently. +/// +/// WARNING! This is an experimental interface that may change or go away at any +/// time. +class GcsStatsInterface { + public: + /// Configure is called by the GcsFileSystem to provide instrumentation hooks. + /// + /// Note: Configure can be called multiple times (e.g. if the block cache is + /// re-initialized). + virtual void Configure(GcsFileSystem* fs, GcsThrottle* throttle, + const FileBlockCache* block_cache) = 0; + + /// RecordBlockLoadRequest is called to record a block load request is about + /// to be made. + virtual void RecordBlockLoadRequest(const string& file, size_t offset) = 0; + + /// RecordBlockRetrieved is called once a block within the file has been + /// retrieved. + virtual void RecordBlockRetrieved(const string& file, size_t offset, + size_t bytes_transferred) = 0; + + // RecordStatObjectRequest is called once a statting object request over GCS + // is about to be made. + virtual void RecordStatObjectRequest() = 0; + + /// HttpStats is called to optionally provide a RequestStats listener + /// to be annotated on every HTTP request made to the GCS API. + /// + /// HttpStats() may return nullptr. + virtual HttpRequest::RequestStats* HttpStats() = 0; + + virtual ~GcsStatsInterface() = default; +}; + +struct UploadSessionHandle { + std::string session_uri; + bool resumable; +}; + +/// Google Cloud Storage implementation of a file system. +/// +/// The clients should use RetryingGcsFileSystem defined below, +/// which adds retry logic to GCS operations. +class GcsFileSystem : public FileSystem { + public: + struct TimeoutConfig; + + // Main constructor used (via RetryingFileSystem) throughout Tensorflow + explicit GcsFileSystem(bool make_default_cache = true); + // Used mostly for unit testing or use cases which need to customize the + // filesystem from defaults + GcsFileSystem(std::unique_ptr auth_provider, + std::unique_ptr http_request_factory, + std::unique_ptr zone_provider, size_t block_size, + size_t max_bytes, uint64 max_staleness, + uint64 stat_cache_max_age, size_t stat_cache_max_entries, + uint64 matching_paths_cache_max_age, + size_t matching_paths_cache_max_entries, + RetryConfig retry_config, TimeoutConfig timeouts, + const std::unordered_set& allowed_locations, + std::pair* additional_header, + bool compose_append); + + TF_USE_FILESYSTEM_METHODS_WITH_NO_TRANSACTION_SUPPORT; + + Status NewRandomAccessFile( + const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewWritableFile(const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewAppendableFile(const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewReadOnlyMemoryRegionFromFile( + const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status FileExists(const string& fname, TransactionToken* token) override; + + Status Stat(const string& fname, TransactionToken* token, + FileStatistics* stat) override; + + Status GetChildren(const string& dir, TransactionToken* token, + std::vector* result) override; + + Status GetMatchingPaths(const string& pattern, TransactionToken* token, + std::vector* results) override; + + Status DeleteFile(const string& fname, TransactionToken* token) override; + + Status CreateDir(const string& dirname, TransactionToken* token) override; + + Status DeleteDir(const string& dirname, TransactionToken* token) override; + + Status GetFileSize(const string& fname, TransactionToken* token, + uint64* file_size) override; + + Status RenameFile(const string& src, const string& target, + TransactionToken* token) override; + + Status IsDirectory(const string& fname, TransactionToken* token) override; + + Status DeleteRecursively(const string& dirname, TransactionToken* token, + int64_t* undeleted_files, + int64_t* undeleted_dirs) override; + + void FlushCaches(TransactionToken* token) override; + + /// Set an object to collect runtime statistics from the GcsFilesystem. + void SetStats(GcsStatsInterface* stats); + + /// Set an object to collect file block cache stats. + void SetCacheStats(FileBlockCacheStatsInterface* cache_stats); + + /// These accessors are mainly for testing purposes, to verify that the + /// environment variables that control these parameters are handled correctly. + size_t block_size() { + tf_shared_lock l(block_cache_lock_); + return file_block_cache_->block_size(); + } + size_t max_bytes() { + tf_shared_lock l(block_cache_lock_); + return file_block_cache_->max_bytes(); + } + uint64 max_staleness() { + tf_shared_lock l(block_cache_lock_); + return file_block_cache_->max_staleness(); + } + TimeoutConfig timeouts() const { return timeouts_; } + std::unordered_set allowed_locations() const { + return allowed_locations_; + } + + bool compose_append() const { return compose_append_; } + string additional_header_name() const { + return additional_header_ ? additional_header_->first : ""; + } + string additional_header_value() const { + return additional_header_ ? additional_header_->second : ""; + } + + uint64 stat_cache_max_age() const { return stat_cache_->max_age(); } + size_t stat_cache_max_entries() const { return stat_cache_->max_entries(); } + + uint64 matching_paths_cache_max_age() const { + return matching_paths_cache_->max_age(); + } + size_t matching_paths_cache_max_entries() const { + return matching_paths_cache_->max_entries(); + } + + /// Structure containing the information for timeouts related to accessing the + /// GCS APIs. + /// + /// All values are in seconds. + struct TimeoutConfig { + // The request connection timeout. If a connection cannot be established + // within `connect` seconds, abort the request. + uint32 connect = 120; // 2 minutes + + // The request idle timeout. If a request has seen no activity in `idle` + // seconds, abort the request. + uint32 idle = 60; // 1 minute + + // The maximum total time a metadata request can take. If a request has not + // completed within `metadata` seconds, the request is aborted. + uint32 metadata = 3600; // 1 hour + + // The maximum total time a block read request can take. If a request has + // not completed within `read` seconds, the request is aborted. + uint32 read = 3600; // 1 hour + + // The maximum total time an upload request can take. If a request has not + // completed within `write` seconds, the request is aborted. + uint32 write = 3600; // 1 hour + + TimeoutConfig() {} + TimeoutConfig(uint32 connect, uint32 idle, uint32 metadata, uint32 read, + uint32 write) + : connect(connect), + idle(idle), + metadata(metadata), + read(read), + write(write) {} + }; + + Status CreateHttpRequest(std::unique_ptr* request); + + /// \brief Sets a new AuthProvider on the GCS FileSystem. + /// + /// The new auth provider will be used for all subsequent requests. + void SetAuthProvider(std::unique_ptr auth_provider); + + /// \brief Resets the block cache and re-instantiates it with the new values. + /// + /// This method can be used to clear the existing block cache and/or to + /// re-configure the block cache for different values. + /// + /// Note: the existing block cache is not cleaned up until all existing files + /// have been closed. + void ResetFileBlockCache(size_t block_size_bytes, size_t max_bytes, + uint64 max_staleness_secs); + + protected: + virtual std::unique_ptr MakeFileBlockCache( + size_t block_size, size_t max_bytes, uint64 max_staleness); + + /// Loads file contents from GCS for a given filename, offset, and length. + virtual Status LoadBufferFromGCS(const string& fname, size_t offset, size_t n, + char* buffer, size_t* bytes_transferred); + + // Creates an upload session for an upcoming GCS object upload. + virtual Status CreateNewUploadSession(uint64 start_offset, + const std::string& object_to_upload, + const std::string& bucket, + uint64 file_size, + const std::string& gcs_path, + UploadSessionHandle* session_handle); + + // Uploads object data to session. + virtual Status UploadToSession(const std::string& session_uri, + uint64 start_offset, uint64 already_uploaded, + const std::string& tmp_content_filename, + uint64 file_size, + const std::string& file_path); + + /// \brief Requests status of a previously initiated upload session. + /// + /// If the upload has already succeeded, sets 'completed' to true. + /// Otherwise sets 'completed' to false and 'uploaded' to the currently + /// uploaded size in bytes. + virtual Status RequestUploadSessionStatus(const string& session_uri, + uint64 file_size, + const std::string& gcs_path, + bool* completed, uint64* uploaded); + + Status ParseGcsPathForScheme(StringPiece fname, string scheme, + bool empty_object_ok, string* bucket, + string* object); + + /// \brief Splits a GCS path to a bucket and an object. + /// + /// For example, "gs://bucket-name/path/to/file.txt" gets split into + /// "bucket-name" and "path/to/file.txt". + /// If fname only contains the bucket and empty_object_ok = true, the returned + /// object is empty. + virtual Status ParseGcsPath(StringPiece fname, bool empty_object_ok, + string* bucket, string* object); + + std::shared_ptr compute_engine_metadata_client_; + + // Used by a subclass. + TimeoutConfig timeouts_; + + /// The retry configuration used for retrying failed calls. + RetryConfig retry_config_; + + private: + // GCS file statistics. + struct GcsFileStat { + FileStatistics base; + int64_t generation_number = 0; + }; + + /// \brief Checks if the bucket exists. Returns OK if the check succeeded. + /// + /// 'result' is set if the function returns OK. 'result' cannot be nullptr. + Status BucketExists(const string& bucket, bool* result); + + /// \brief Retrieves the GCS bucket location. Returns OK if the location was + /// retrieved. + /// + /// Given a string bucket the GCS bucket metadata API will be called and the + /// location string filled with the location of the bucket. + /// + /// This requires the bucket metadata permission. + /// Repeated calls for the same bucket are cached so this function can be + /// called frequently without causing an extra API call + Status GetBucketLocation(const string& bucket, string* location); + + /// \brief Check if the GCS buckets location is allowed with the current + /// constraint configuration + Status CheckBucketLocationConstraint(const string& bucket); + + /// \brief Given the input bucket `bucket`, fills `result_buffer` with the + /// results of the metadata. Returns OK if the API call succeeds without + /// error. + Status GetBucketMetadata(const string& bucket, + std::vector* result_buffer); + + /// \brief Checks if the object exists. Returns OK if the check succeeded. + /// + /// 'result' is set if the function returns OK. 'result' cannot be nullptr. + Status ObjectExists(const string& fname, const string& bucket, + const string& object, bool* result); + + /// \brief Checks if the folder exists. Returns OK if the check succeeded. + /// + /// 'result' is set if the function returns OK. 'result' cannot be nullptr. + Status FolderExists(const string& dirname, bool* result); + + /// \brief Internal version of GetChildren with more knobs. + /// + /// If 'recursively' is true, returns all objects in all subfolders. + /// Otherwise only returns the immediate children in the directory. + /// + /// If 'include_self_directory_marker' is true and there is a GCS directory + /// marker at the path 'dir', GetChildrenBound will return an empty string + /// as one of the children that represents this marker. + Status GetChildrenBounded(const string& dir, uint64 max_results, + std::vector* result, bool recursively, + bool include_self_directory_marker); + + /// Retrieves file statistics assuming fname points to a GCS object. The data + /// may be read from cache or from GCS directly. + Status StatForObject(const string& fname, const string& bucket, + const string& object, GcsFileStat* stat); + /// Retrieves file statistics of file fname directly from GCS. + Status UncachedStatForObject(const string& fname, const string& bucket, + const string& object, GcsFileStat* stat); + + Status RenameObject(const string& src, const string& target); + + // Clear all the caches related to the file with name `filename`. + void ClearFileCaches(const string& fname); + + mutex mu_; + std::unique_ptr auth_provider_ TF_GUARDED_BY(mu_); + std::shared_ptr http_request_factory_; + std::unique_ptr zone_provider_; + + // Reads smaller than block_size_ will trigger a read of block_size_. + uint64 block_size_; + + // block_cache_lock_ protects the file_block_cache_ pointer (Note that + // FileBlockCache instances are themselves threadsafe). + mutex block_cache_lock_; + std::unique_ptr file_block_cache_ + TF_GUARDED_BY(block_cache_lock_); + + bool cache_enabled_; + std::unique_ptr dns_cache_; + GcsThrottle throttle_; + + using StatCache = ExpiringLRUCache; + std::unique_ptr stat_cache_; + + using MatchingPathsCache = ExpiringLRUCache>; + std::unique_ptr matching_paths_cache_; + + using BucketLocationCache = ExpiringLRUCache; + std::unique_ptr bucket_location_cache_; + std::unordered_set allowed_locations_; + bool compose_append_; + + GcsStatsInterface* stats_ = nullptr; // Not owned. + + // Additional header material to be transmitted with all GCS requests + std::unique_ptr> additional_header_; + + GcsFileSystem(const GcsFileSystem&) = delete; + void operator=(const GcsFileSystem&) = delete; +}; + +/// Google Cloud Storage implementation of a file system with retry on failures. +class RetryingGcsFileSystem : public RetryingFileSystem { + public: + RetryingGcsFileSystem(); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_FILE_SYSTEM_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_throttle.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_throttle.h new file mode 100644 index 0000000000000000000000000000000000000000..7067349d3cdecc0b2f127ea21d0cb3b746ee3bb6 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/gcs_throttle.h @@ -0,0 +1,168 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_THROTTLE_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_THROTTLE_H_ + +#include "tsl/platform/env.h" + +namespace tsl { + +/** + * GcsThrottleConfig is used to configure the GcsThrottle. + */ +struct GcsThrottleConfig { + /** + * enabled is true if GcsThrottle should throttle requests, false otherwise. + */ + bool enabled = false; + + /** + * token_rate is the number of tokens accrued every second that can be used + * for making requests to the GCS service. + */ + int64_t token_rate = + 100000; // Approximately 800 MBits/second bandwidth-only. + + /** + * bucket_size is the maximum number of available tokens the GcsThrottle can + * accrue. + */ + int64_t bucket_size = 10000000; // 10 million tokens total + + /** + * tokens_per_request determines the number of tokens consumed for every + * request. + * + * Note: tokens are also consumed in proportion to the response size. + */ + int64_t tokens_per_request = 100; + + /** + * initial_tokens determines how many tokens should be available immediately + * after the GcsThrottle is constructed. + */ + int64_t initial_tokens = 0; +}; + +/** + * GcsThrottle is used to ensure fair use of the available GCS capacity. + * + * GcsThrottle operates around a concept of tokens. Tokens are consumed when + * making requests to the GCS service. Tokens are consumed both based on the + * number of requests made, as well as the bandwidth consumed (response sizes). + * + * GcsThrottle is thread safe and can be used from multiple threads. + */ +class GcsThrottle { + public: + /** + * Constructs a GcsThrottle. + */ + explicit GcsThrottle(EnvTime* env_time = nullptr); + + /** + * AdmitRequest updates the GcsThrottle to record a request will be made. + * + * AdmitRequest should be called before any request is made. AdmitRequest + * returns false if the request should be denied. If AdmitRequest + * returns false, no tokens are consumed. If true is returned, the configured + * number of tokens are consumed. + */ + bool AdmitRequest(); + + /** + * RecordResponse updates the GcsThrottle to record a request has been made. + * + * RecordResponse should be called after the response has been received. + * RecordResponse will update the internal state based on the number of bytes + * in the response. + * + * Note: we split up the request and the response in this fashion in order to + * avoid penalizing consumers who are using large readahead buffers at higher + * layers of the I/O stack. + */ + void RecordResponse(size_t num_bytes); + + /** + * SetConfig sets the configuration for GcsThrottle and re-initializes state. + * + * After calling this, the token pool will be config.initial_tokens. + */ + void SetConfig(GcsThrottleConfig config); + + /** + * available_tokens gives a snapshot of how many tokens are available. + * + * The returned value should not be used to make admission decisions. The + * purpose of this function is to make available to monitoring or other + * instrumentation the number of available tokens in the pool. + */ + inline int64_t available_tokens() TF_LOCKS_EXCLUDED(mu_) { + mutex_lock l(mu_); + UpdateState(); + return available_tokens_; + } + + /** + * is_enabled determines if the throttle is enabled. + * + * If !is_enabled(), AdmitRequest() will always return true. To enable the + * throttle, call SetConfig passing in a configuration that has enabled set to + * true. + */ + bool is_enabled() TF_LOCKS_EXCLUDED(mu_) { + mutex_lock l(mu_); + return config_.enabled; + } + + private: + /** + * UpdateState updates the available_tokens_ and last_updated_secs_ variables. + * + * UpdateState should be called in order to mark the passage of time, and + * therefore add tokens to the available_tokens_ pool. + */ + void UpdateState() TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + inline uint64 request_bytes_to_tokens(size_t num_bytes) { + return num_bytes >> 10; + } + + mutex mu_; + + /** + * last_updated_secs_ records the number of seconds since the Unix epoch that + * the internal state of the GcsThrottle was updated. This is important when + * determining the number of tokens to add to the available_tokens_ pool. + */ + uint64 last_updated_secs_ TF_GUARDED_BY(mu_) = 0; + + /** + * available_tokens_ records how many tokens are available to be consumed. + * + * Note: it is possible for available_tokens_ to become negative. If a + * response comes back that consumes more than the available tokens, the count + * will go negative, and block future requests until we have available tokens. + */ + int64_t available_tokens_ TF_GUARDED_BY(mu_) = 0; + + EnvTime* const env_time_; + GcsThrottleConfig config_ TF_GUARDED_BY(mu_); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_GCS_THROTTLE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/google_auth_provider.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/google_auth_provider.h new file mode 100644 index 0000000000000000000000000000000000000000..63b7ea63abf5f325013e963fecdc98fe82b3c530 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/google_auth_provider.h @@ -0,0 +1,70 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_GOOGLE_AUTH_PROVIDER_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_GOOGLE_AUTH_PROVIDER_H_ + +#include + +#include "tsl/platform/cloud/auth_provider.h" +#include "tsl/platform/cloud/compute_engine_metadata_client.h" +#include "tsl/platform/cloud/oauth_client.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/thread_annotations.h" + +namespace tsl { + +/// Implementation based on Google Application Default Credentials. +class GoogleAuthProvider : public AuthProvider { + public: + GoogleAuthProvider(std::shared_ptr + compute_engine_metadata_client); + explicit GoogleAuthProvider(std::unique_ptr oauth_client, + std::shared_ptr + compute_engine_metadata_client, + Env* env); + virtual ~GoogleAuthProvider() {} + + /// \brief Returns the short-term authentication bearer token. + /// + /// Safe for concurrent use by multiple threads. + Status GetToken(string* token) override; + + private: + /// \brief Gets the bearer token from files. + /// + /// Tries the file from $GOOGLE_APPLICATION_CREDENTIALS and the + /// standard gcloud tool's location. + Status GetTokenFromFiles() TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// Gets the bearer token from Google Compute Engine environment. + Status GetTokenFromGce() TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// Gets the bearer token from the system env variable, for testing purposes. + Status GetTokenForTesting() TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + std::unique_ptr oauth_client_; + std::shared_ptr compute_engine_metadata_client_; + Env* env_; + mutex mu_; + string current_token_ TF_GUARDED_BY(mu_); + uint64 expiration_timestamp_sec_ TF_GUARDED_BY(mu_) = 0; + GoogleAuthProvider(const GoogleAuthProvider&) = delete; + void operator=(const GoogleAuthProvider&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_GOOGLE_AUTH_PROVIDER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/http_request.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/http_request.h new file mode 100644 index 0000000000000000000000000000000000000000..a3a3136d66e6f7beea6affcf3d9ae05c62d34f0f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/http_request.h @@ -0,0 +1,193 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_HTTP_REQUEST_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_HTTP_REQUEST_H_ + +#include +#include +#include + +#include "tsl/platform/env.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/protobuf.h" +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/types.h" + +namespace tsl { + +/// \brief An abstract basic HTTP client. +/// +/// The usage pattern for the class is based on the libcurl library: +/// create a request object, set request parameters and call Send(). +/// +/// For example: +/// HttpRequest request; +/// request.SetUri("http://www.google.com"); +/// request.SetResultsBuffer(out_buffer); +/// request.Send(); +class HttpRequest { + public: + class Factory { + public: + virtual ~Factory() {} + virtual HttpRequest* Create() = 0; + }; + + /// RequestMethod is used to capture what type of HTTP request is made and + /// is used in conjunction with RequestStats for instrumentation and + /// monitoring of HTTP requests and their responses. + enum class RequestMethod : char { + kGet, + kPost, + kPut, + kDelete, + }; + + /// RequestMethodName converts a RequestMethod to the canonical method string. + inline static const char* RequestMethodName(RequestMethod m) { + switch (m) { + case RequestMethod::kGet: + return "GET"; + case RequestMethod::kPost: + return "POST"; + case RequestMethod::kPut: + return "PUT"; + case RequestMethod::kDelete: + return "DELETE"; + default: + return "???"; + } + } + + /// RequestStats is a class that can be used to instrument an Http Request. + class RequestStats { + public: + virtual ~RequestStats() = default; + + /// RecordRequest is called right before a request is sent on the wire. + virtual void RecordRequest(const HttpRequest* request, const string& uri, + RequestMethod method) = 0; + + /// RecordResponse is called after the response has been received. + virtual void RecordResponse(const HttpRequest* request, const string& uri, + RequestMethod method, const Status& result) = 0; + }; + + HttpRequest() {} + virtual ~HttpRequest() {} + + /// Sets the request URI. + virtual void SetUri(const string& uri) = 0; + + /// \brief Sets the Range header. + /// + /// Used for random seeks, for example "0-999" returns the first 1000 bytes + /// (note that the right border is included). + virtual void SetRange(uint64 start, uint64 end) = 0; + + /// Sets a request header. + virtual void AddHeader(const string& name, const string& value) = 0; + + /// Sets a DNS resolve mapping (to skip DNS resolution). + /// + /// Note: because GCS is available over HTTPS, we cannot replace the hostname + /// in the URI with an IP address, as that will cause the certificate check + /// to fail. + virtual void AddResolveOverride(const string& hostname, int64_t port, + const string& ip_addr) = 0; + + /// Sets the 'Authorization' header to the value of 'Bearer ' + auth_token. + virtual void AddAuthBearerHeader(const string& auth_token) = 0; + + /// Sets the RequestStats object to use to record the request and response. + virtual void SetRequestStats(RequestStats* stats) = 0; + + /// Makes the request a DELETE request. + virtual void SetDeleteRequest() = 0; + + /// \brief Makes the request a PUT request. + /// + /// The request body will be taken from the specified file starting from + /// the given offset. + virtual Status SetPutFromFile(const string& body_filepath, size_t offset) = 0; + + /// Makes the request a PUT request with an empty body. + virtual void SetPutEmptyBody() = 0; + + /// \brief Makes the request a POST request. + /// + /// The request body will be taken from the specified buffer. + virtual void SetPostFromBuffer(const char* buffer, size_t size) = 0; + + /// Makes the request a POST request with an empty body. + virtual void SetPostEmptyBody() = 0; + + /// \brief Specifies the buffer for receiving the response body. + /// + /// Size of out_buffer after an access will be exactly the number of bytes + /// read. Existing content of the vector will be cleared. + virtual void SetResultBuffer(std::vector* out_buffer) = 0; + + /// \brief Specifies the buffer for receiving the response body. + /// + /// This method should be used when a caller knows the upper bound of the + /// size of the response data. The caller provides a pre-allocated buffer + /// and its size. After the Send() method is called, the + /// GetResultBufferDirectBytesTransferred() method may be used to learn to the + /// number of bytes that were transferred using this method. + virtual void SetResultBufferDirect(char* buffer, size_t size) = 0; + + /// \brief Returns the number of bytes transferred, when using + /// SetResultBufferDirect(). This method may only be used when using + /// SetResultBufferDirect(). + virtual size_t GetResultBufferDirectBytesTransferred() = 0; + + /// \brief Returns the response headers of a completed request. + /// + /// If the header is not found, returns an empty string. + virtual string GetResponseHeader(const string& name) const = 0; + + /// Returns the response code of a completed request. + virtual uint64 GetResponseCode() const = 0; + + /// \brief Sends the formed request. + /// + /// If the result buffer was defined, the response will be written there. + /// The object is not designed to be re-used after Send() is executed. + virtual Status Send() = 0; + + // Url encodes str and returns a new string. + virtual string EscapeString(const string& str) = 0; + + /// \brief Set timeouts for this request. + /// + /// The connection parameter controls how long we should wait for the + /// connection to be established. The inactivity parameter controls how long + /// we should wait between additional responses from the server. Finally the + /// total parameter controls the maximum total connection time to prevent + /// hanging indefinitely. + virtual void SetTimeouts(uint32 connection, uint32 inactivity, + uint32 total) = 0; + + HttpRequest(const HttpRequest&) = delete; + void operator=(const HttpRequest&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_HTTP_REQUEST_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/oauth_client.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/oauth_client.h new file mode 100644 index 0000000000000000000000000000000000000000..895c2d01cd5f8fcd646d9744d3adb700d008a62e --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/oauth_client.h @@ -0,0 +1,64 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_OAUTH_CLIENT_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_OAUTH_CLIENT_H_ + +#include + +#include "json/json.h" +#include "tsl/platform/cloud/http_request.h" +#include "tsl/platform/env.h" +#include "tsl/platform/status.h" + +namespace tsl { + +/// OAuth 2.0 client. +class OAuthClient { + public: + OAuthClient(); + explicit OAuthClient( + std::unique_ptr http_request_factory, Env* env); + virtual ~OAuthClient() {} + + /// \brief Retrieves a bearer token using a private key. + /// + /// Retrieves the authentication bearer token using a JSON file + /// with the client's private key. + virtual Status GetTokenFromServiceAccountJson( + Json::Value json, StringPiece oauth_server_uri, StringPiece scope, + string* token, uint64* expiration_timestamp_sec); + + /// Retrieves a bearer token using a refresh token. + virtual Status GetTokenFromRefreshTokenJson(Json::Value json, + StringPiece oauth_server_uri, + string* token, + uint64* expiration_timestamp_sec); + + /// Parses the JSON response with the token from an OAuth 2.0 server. + virtual Status ParseOAuthResponse(StringPiece response, + uint64 request_timestamp_sec, string* token, + uint64* expiration_timestamp_sec); + + private: + std::unique_ptr http_request_factory_; + Env* env_; + OAuthClient(const OAuthClient&) = delete; + void operator=(const OAuthClient&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_OAUTH_CLIENT_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/ram_file_block_cache.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/ram_file_block_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..76cf7eb237dc53f32f91fb5412bc35a9d40f4653 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/ram_file_block_cache.h @@ -0,0 +1,250 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_RAM_FILE_BLOCK_CACHE_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_RAM_FILE_BLOCK_CACHE_H_ + +#include +#include +#include +#include +#include +#include + +#include "tsl/platform/cloud/file_block_cache.h" +#include "tsl/platform/env.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/notification.h" +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/thread_annotations.h" +#include "tsl/platform/types.h" + +namespace tsl { + +/// \brief An LRU block cache of file contents, keyed by {filename, offset}. +/// +/// This class should be shared by read-only random access files on a remote +/// filesystem (e.g. GCS). +class RamFileBlockCache : public FileBlockCache { + public: + /// The callback executed when a block is not found in the cache, and needs to + /// be fetched from the backing filesystem. This callback is provided when the + /// cache is constructed. The returned Status should be OK as long as the + /// read from the remote filesystem succeeded (similar to the semantics of the + /// read(2) system call). + typedef std::function + BlockFetcher; + + RamFileBlockCache(size_t block_size, size_t max_bytes, uint64 max_staleness, + BlockFetcher block_fetcher, Env* env = Env::Default()) + : block_size_(block_size), + max_bytes_(max_bytes), + max_staleness_(max_staleness), + block_fetcher_(block_fetcher), + env_(env) { + if (max_staleness_ > 0) { + pruning_thread_.reset(env_->StartThread(ThreadOptions(), "TF_prune_FBC", + [this] { Prune(); })); + } + VLOG(1) << "GCS file block cache is " + << (IsCacheEnabled() ? "enabled" : "disabled"); + } + + ~RamFileBlockCache() override { + if (pruning_thread_) { + stop_pruning_thread_.Notify(); + // Destroying pruning_thread_ will block until Prune() receives the above + // notification and returns. + pruning_thread_.reset(); + } + } + + /// Read `n` bytes from `filename` starting at `offset` into `out`. This + /// method will return: + /// + /// 1) The error from the remote filesystem, if the read from the remote + /// filesystem failed. + /// 2) PRECONDITION_FAILED if the read from the remote filesystem succeeded, + /// but the read returned a partial block, and the LRU cache contained a + /// block at a higher offset (indicating that the partial block should have + /// been a full block). + /// 3) OUT_OF_RANGE if the read from the remote filesystem succeeded, but + /// the file contents do not extend past `offset` and thus nothing was + /// placed in `out`. + /// 4) OK otherwise (i.e. the read succeeded, and at least one byte was placed + /// in `out`). + Status Read(const string& filename, size_t offset, size_t n, char* buffer, + size_t* bytes_transferred) override; + + // Validate the given file signature with the existing file signature in the + // cache. Returns true if the signature doesn't change or the file doesn't + // exist before. If the signature changes, update the existing signature with + // the new one and remove the file from cache. + bool ValidateAndUpdateFileSignature(const string& filename, + int64_t file_signature) override + TF_LOCKS_EXCLUDED(mu_); + + /// Remove all cached blocks for `filename`. + void RemoveFile(const string& filename) override TF_LOCKS_EXCLUDED(mu_); + + /// Remove all cached data. + void Flush() override TF_LOCKS_EXCLUDED(mu_); + + /// Accessors for cache parameters. + size_t block_size() const override { return block_size_; } + size_t max_bytes() const override { return max_bytes_; } + uint64 max_staleness() const override { return max_staleness_; } + + /// The current size (in bytes) of the cache. + size_t CacheSize() const override TF_LOCKS_EXCLUDED(mu_); + + // Returns true if the cache is enabled. If false, the BlockFetcher callback + // is always executed during Read. + bool IsCacheEnabled() const override { + return block_size_ > 0 && max_bytes_ > 0; + } + + private: + /// The size of the blocks stored in the LRU cache, as well as the size of the + /// reads from the underlying filesystem. + const size_t block_size_; + /// The maximum number of bytes (sum of block sizes) allowed in the LRU cache. + const size_t max_bytes_; + /// The maximum staleness of any block in the LRU cache, in seconds. + const uint64 max_staleness_; + /// The callback to read a block from the underlying filesystem. + const BlockFetcher block_fetcher_; + /// The Env from which we read timestamps. + Env* const env_; // not owned + + /// \brief The key type for the file block cache. + /// + /// The file block cache key is a {filename, offset} pair. + typedef std::pair Key; + + /// \brief The state of a block. + /// + /// A block begins in the CREATED stage. The first thread will attempt to read + /// the block from the filesystem, transitioning the state of the block to + /// FETCHING. After completing, if the read was successful the state should + /// be FINISHED. Otherwise the state should be ERROR. A subsequent read can + /// re-fetch the block if the state is ERROR. + enum class FetchState { + CREATED, + FETCHING, + FINISHED, + ERROR, + }; + + /// \brief A block of a file. + /// + /// A file block consists of the block data, the block's current position in + /// the LRU cache, the timestamp (seconds since epoch) at which the block + /// was cached, a coordination lock, and state & condition variables. + /// + /// Thread safety: + /// The iterator and timestamp fields should only be accessed while holding + /// the block-cache-wide mu_ instance variable. The state variable should only + /// be accessed while holding the Block's mu lock. The data vector should only + /// be accessed after state == FINISHED, and it should never be modified. + /// + /// In order to prevent deadlocks, never grab the block-cache-wide mu_ lock + /// AFTER grabbing any block's mu lock. It is safe to grab mu without locking + /// mu_. + struct Block { + /// The block data. + std::vector data; + /// A list iterator pointing to the block's position in the LRU list. + std::list::iterator lru_iterator; + /// A list iterator pointing to the block's position in the LRA list. + std::list::iterator lra_iterator; + /// The timestamp (seconds since epoch) at which the block was cached. + uint64 timestamp; + /// Mutex to guard state variable + mutex mu; + /// The state of the block. + FetchState state TF_GUARDED_BY(mu) = FetchState::CREATED; + /// Wait on cond_var if state is FETCHING. + condition_variable cond_var; + }; + + /// \brief The block map type for the file block cache. + /// + /// The block map is an ordered map from Key to Block. + typedef std::map> BlockMap; + + /// Prune the cache by removing files with expired blocks. + void Prune() TF_LOCKS_EXCLUDED(mu_); + + bool BlockNotStale(const std::shared_ptr& block) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// Look up a Key in the block cache. + std::shared_ptr Lookup(const Key& key) TF_LOCKS_EXCLUDED(mu_); + + Status MaybeFetch(const Key& key, const std::shared_ptr& block) + TF_LOCKS_EXCLUDED(mu_); + + /// Trim the block cache to make room for another entry. + void Trim() TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// Update the LRU iterator for the block at `key`. + Status UpdateLRU(const Key& key, const std::shared_ptr& block) + TF_LOCKS_EXCLUDED(mu_); + + /// Remove all blocks of a file, with mu_ already held. + void RemoveFile_Locked(const string& filename) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// Remove the block `entry` from the block map and LRU list, and update the + /// cache size accordingly. + void RemoveBlock(BlockMap::iterator entry) TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + /// The cache pruning thread that removes files with expired blocks. + std::unique_ptr pruning_thread_; + + /// Notification for stopping the cache pruning thread. + Notification stop_pruning_thread_; + + /// Guards access to the block map, LRU list, and cached byte count. + mutable mutex mu_; + + /// The block map (map from Key to Block). + BlockMap block_map_ TF_GUARDED_BY(mu_); + + /// The LRU list of block keys. The front of the list identifies the most + /// recently accessed block. + std::list lru_list_ TF_GUARDED_BY(mu_); + + /// The LRA (least recently added) list of block keys. The front of the list + /// identifies the most recently added block. + /// + /// Note: blocks are added to lra_list_ only after they have successfully been + /// fetched from the underlying block store. + std::list lra_list_ TF_GUARDED_BY(mu_); + + /// The combined number of bytes in all of the cached blocks. + size_t cache_size_ TF_GUARDED_BY(mu_) = 0; + + // A filename->file_signature map. + std::map file_signature_map_ TF_GUARDED_BY(mu_); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_RAM_FILE_BLOCK_CACHE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/time_util.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/time_util.h new file mode 100644 index 0000000000000000000000000000000000000000..5eb116c6aca75d1041b68da57b834ebadd81ff07 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/time_util.h @@ -0,0 +1,29 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_TIME_UTIL_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_TIME_UTIL_H_ + +#include "tsl/platform/status.h" + +namespace tsl { + +/// Parses the timestamp in RFC 3339 format and returns it +/// as nanoseconds since epoch. +Status ParseRfc3339Time(const string& time, int64_t* mtime_nsec); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_TIME_UTIL_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/zone_provider.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/zone_provider.h new file mode 100644 index 0000000000000000000000000000000000000000..8c000e08437d4e9fc8f9263cd2c7cf9b73289bcf --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/cloud/zone_provider.h @@ -0,0 +1,49 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CLOUD_ZONE_PROVIDER_H_ +#define TENSORFLOW_TSL_PLATFORM_CLOUD_ZONE_PROVIDER_H_ + +#include + +#include "tsl/platform/errors.h" +#include "tsl/platform/status.h" + +namespace tsl { + +/// Interface for a provider of cloud instance zone +class ZoneProvider { + public: + virtual ~ZoneProvider() {} + + /// \brief Gets the zone of the Cloud instance and set the result in `zone`. + /// Returns OK if success. + /// + /// Returns an empty string in the case where the zone does not match the + /// expected format + /// Safe for concurrent use by multiple threads. + virtual Status GetZone(string* zone) = 0; + + static Status GetZone(ZoneProvider* provider, string* zone) { + if (!provider) { + return errors::Internal("Zone provider is required."); + } + return provider->GetZone(zone); + } +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_CLOUD_ZONE_PROVIDER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/crash_analysis.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/crash_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..64825ff83f1c72fd48f8b18c8d8a420006a3335f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/crash_analysis.h @@ -0,0 +1,28 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CRASH_ANALYSIS_H_ +#define TENSORFLOW_TSL_PLATFORM_CRASH_ANALYSIS_H_ + +#include "tsl/platform/platform.h" + +// Include appropriate platform-dependent implementations +#if defined(PLATFORM_GOOGLE) +#include "tsl/platform/google/crash_analysis.h" // IWYU pragma: export +#else +#include "tsl/platform/default/crash_analysis.h" // IWYU pragma: export +#endif + +#endif // TENSORFLOW_TSL_PLATFORM_CRASH_ANALYSIS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/criticality.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/criticality.h new file mode 100644 index 0000000000000000000000000000000000000000..2f05dcef4c02614360fd95245c00264be83c27ad --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/criticality.h @@ -0,0 +1,50 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CRITICALITY_H_ +#define TENSORFLOW_TSL_PLATFORM_CRITICALITY_H_ + +#include "tsl/platform/platform.h" + +namespace tsl { + +namespace criticality { + +enum class Criticality { + // Frequent full and paritial unavailability is expected and not a cause for + // concern. + kSheddable = 0, + // Partial unavailability is expected and not necessarily a cause for concern. + kSheddablePlus = 1, + // Any outage is a serious concern. This is the default priority for RPCs + // sent from production jobs. + kCritical = 2, + // Any outage is a serious concern. Less than 50% of requests to a service + // can be in this band. During an outage, this band will be prioritized above + // all others. + kCriticalPlus = 3, +}; + +} // namespace criticality + +} // namespace tsl + +#if defined(PLATFORM_GOOGLE) +#include "tsl/platform/google/criticality.h" // IWYU pragma: export +#else +#include "tsl/platform/default/criticality.h" // IWYU pragma: export +#endif + +#endif // TENSORFLOW_TSL_PLATFORM_CRITICALITY_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/ctstring_internal.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/ctstring_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..43e909a8065aaaa70ddb26ab45a4e222d79ba574 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/ctstring_internal.h @@ -0,0 +1,455 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_CTSTRING_INTERNAL_H_ +#define TENSORFLOW_TSL_PLATFORM_CTSTRING_INTERNAL_H_ + +#include +#include +#include +#include + +#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ + defined(_WIN32) +#define TF_TSTRING_LITTLE_ENDIAN 1 +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \ + __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define TF_TSTRING_LITTLE_ENDIAN 0 +#else +#error "Unable to detect endianness." +#endif + +#if defined(__clang__) || \ + (defined(__GNUC__) && \ + ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5)) +static inline uint32_t TF_swap32(uint32_t host_int) { + return __builtin_bswap32(host_int); +} + +#elif defined(_MSC_VER) +static inline uint32_t TF_swap32(uint32_t host_int) { + return _byteswap_ulong(host_int); +} + +#elif defined(__APPLE__) +static inline uint32_t TF_swap32(uint32_t host_int) { + return OSSwapInt32(host_int); +} + +#else +static inline uint32_t TF_swap32(uint32_t host_int) { +#if defined(__GLIBC__) + return bswap_32(host_int); +#else // defined(__GLIBC__) + return (((host_int & uint32_t{0xFF}) << 24) | + ((host_int & uint32_t{0xFF00}) << 8) | + ((host_int & uint32_t{0xFF0000}) >> 8) | + ((host_int & uint32_t{0xFF000000}) >> 24)); +#endif // defined(__GLIBC__) +} +#endif + +#if TF_TSTRING_LITTLE_ENDIAN +#define TF_le32toh(x) x +#else // TF_TSTRING_LITTLE_ENDIAN +#define TF_le32toh(x) TF_swap32(x) +#endif // TF_TSTRING_LITTLE_ENDIAN + +static inline size_t TF_align16(size_t i) { return (i + 0xF) & ~0xF; } + +static inline size_t TF_max(size_t a, size_t b) { return a > b ? a : b; } +static inline size_t TF_min(size_t a, size_t b) { return a < b ? a : b; } + +typedef enum TF_TString_Type { // NOLINT + TF_TSTR_SMALL = 0x00, + TF_TSTR_LARGE = 0x01, + TF_TSTR_OFFSET = 0x02, + TF_TSTR_VIEW = 0x03, + TF_TSTR_TYPE_MASK = 0x03 +} TF_TString_Type; + +typedef struct TF_TString_Large { // NOLINT + size_t size; + size_t cap; + char *ptr; +} TF_TString_Large; + +typedef struct TF_TString_Offset { // NOLINT + uint32_t size; + uint32_t offset; + uint32_t count; +} TF_TString_Offset; + +typedef struct TF_TString_View { // NOLINT + size_t size; + const char *ptr; +} TF_TString_View; + +typedef struct TF_TString_Raw { // NOLINT + uint8_t raw[24]; +} TF_TString_Raw; + +typedef union TF_TString_Union { // NOLINT + TF_TString_Large large; + TF_TString_Offset offset; + TF_TString_View view; + TF_TString_Raw raw; +} TF_TString_Union; + +enum { + TF_TString_SmallCapacity = + (sizeof(TF_TString_Union) - sizeof(/* null delim */ char) - + sizeof(/* uint8_t size */ uint8_t)), +}; + +typedef struct TF_TString_Small { // NOLINT + uint8_t size; + char str[TF_TString_SmallCapacity + sizeof(/* null delim */ char)]; +} TF_TString_Small; + +typedef struct TF_TString { // NOLINT + union { + // small conflicts with '#define small char' in RpcNdr.h for MSVC, so we use + // smll instead. + TF_TString_Small smll; + TF_TString_Large large; + TF_TString_Offset offset; + TF_TString_View view; + TF_TString_Raw raw; + } u; +} TF_TString; + +// TODO(dero): Fix for OSS, and add C only build test. +// _Static_assert(CHAR_BIT == 8); +// _Static_assert(sizeof(TF_TString) == 24); + +static inline TF_TString_Type TF_TString_GetType(const TF_TString *str) { + return (TF_TString_Type)(str->u.raw.raw[0] & TF_TSTR_TYPE_MASK); // NOLINT +} + +// XXX(dero): For the big-endian case, this function could potentially be more +// performant and readable by always storing the string size as little-endian +// and always byte-swapping on big endian, resulting in a simple 'bswap'+'shr' +// (for architectures that have a bswap op). +static inline size_t TF_TString_ToActualSizeT(size_t size) { +#if TF_TSTRING_LITTLE_ENDIAN + return size >> 2; +#else // TF_TSTRING_LITTLE_ENDIAN + // 0xFF000000 or 0xFF00000000000000 depending on platform + static const size_t mask = ~((~(size_t)0) >> 8); + + return (((mask << 2) & size) >> 2) | (~mask & size); +#endif // TF_TSTRING_LITTLE_ENDIAN +} + +static inline size_t TF_TString_ToInternalSizeT(size_t size, + TF_TString_Type type) { +#if TF_TSTRING_LITTLE_ENDIAN + return (size << 2) | type; +#else // TF_TSTRING_LITTLE_ENDIAN + // 0xFF000000 or 0xFF00000000000000 depending on platform + static const size_t mask = ~((~(size_t)0) >> 8); + + return (mask & (size << 2)) | (~mask & size) | + ((size_t)type << ((sizeof(size_t) - 1) * 8)); // NOLINT +#endif // TF_TSTRING_LITTLE_ENDIAN +} + +static inline void TF_TString_Init(TF_TString *str) { + memset(str->u.raw.raw, 0, sizeof(TF_TString_Raw)); +} + +static inline void TF_TString_Dealloc(TF_TString *str) { + if (TF_TString_GetType(str) == TF_TSTR_LARGE && + str->u.large.ptr != NULL) { // NOLINT + free(str->u.large.ptr); + TF_TString_Init(str); + } +} + +static inline size_t TF_TString_GetSize(const TF_TString *str) { + switch (TF_TString_GetType(str)) { + case TF_TSTR_SMALL: + return str->u.smll.size >> 2; + case TF_TSTR_LARGE: + return TF_TString_ToActualSizeT(str->u.large.size); + case TF_TSTR_OFFSET: + return TF_le32toh(str->u.offset.size) >> 2; + case TF_TSTR_VIEW: + return TF_TString_ToActualSizeT(str->u.view.size); + default: + return 0; // Unreachable. + } +} + +static inline size_t TF_TString_GetCapacity(const TF_TString *str) { + switch (TF_TString_GetType(str)) { + case TF_TSTR_SMALL: + return TF_TString_SmallCapacity; + case TF_TSTR_LARGE: + return str->u.large.cap; + case TF_TSTR_OFFSET: + case TF_TSTR_VIEW: + default: + return 0; + } +} + +static inline const char *TF_TString_GetDataPointer(const TF_TString *str) { + switch (TF_TString_GetType(str)) { + case TF_TSTR_SMALL: + return str->u.smll.str; + case TF_TSTR_LARGE: + return str->u.large.ptr; + case TF_TSTR_OFFSET: + return (const char *)str + TF_le32toh(str->u.offset.offset); // NOLINT + case TF_TSTR_VIEW: + return str->u.view.ptr; + default: + // Unreachable. + return NULL; // NOLINT + } +} + +static inline char *TF_TString_ResizeUninitialized(TF_TString *str, + size_t new_size) { + size_t curr_size = TF_TString_GetSize(str); + size_t copy_size = TF_min(new_size, curr_size); + + TF_TString_Type curr_type = TF_TString_GetType(str); + const char *curr_ptr = TF_TString_GetDataPointer(str); + + // Case: SMALL/LARGE/VIEW/OFFSET -> SMALL + if (new_size <= TF_TString_SmallCapacity) { + str->u.smll.size = (uint8_t)((new_size << 2) | TF_TSTR_SMALL); // NOLINT + str->u.smll.str[new_size] = '\0'; + + if (curr_type != TF_TSTR_SMALL && copy_size) { + memcpy(str->u.smll.str, curr_ptr, copy_size); + } + + if (curr_type == TF_TSTR_LARGE) { + free((void *)curr_ptr); // NOLINT + } + + // We do not clear out the newly excluded region. + + return str->u.smll.str; + } + + // Case: SMALL/LARGE/VIEW/OFFSET -> LARGE + size_t new_cap; + size_t curr_cap = TF_TString_GetCapacity(str); + + if (new_size < curr_size && new_size < curr_cap / 2) { + // TODO(dero): Replace with shrink_to_fit flag. + new_cap = TF_align16(curr_cap / 2 + 1) - 1; + } else if (new_size > curr_cap) { + new_cap = TF_align16(new_size + 1) - 1; + } else { + new_cap = curr_cap; + } + + char *new_ptr; + if (new_cap == curr_cap) { + new_ptr = str->u.large.ptr; + } else if (curr_type == TF_TSTR_LARGE) { + new_ptr = (char *)realloc(str->u.large.ptr, new_cap + 1); // NOLINT + } else { + new_ptr = (char *)malloc(new_cap + 1); // NOLINT + if (copy_size) { + memcpy(new_ptr, curr_ptr, copy_size); + } + } + + str->u.large.size = TF_TString_ToInternalSizeT(new_size, TF_TSTR_LARGE); + str->u.large.ptr = new_ptr; + str->u.large.ptr[new_size] = '\0'; + str->u.large.cap = new_cap; + + return str->u.large.ptr; +} + +static inline char *TF_TString_GetMutableDataPointer(TF_TString *str) { + switch (TF_TString_GetType(str)) { + case TF_TSTR_SMALL: + return str->u.smll.str; + case TF_TSTR_OFFSET: + case TF_TSTR_VIEW: + // Convert OFFSET/VIEW to SMALL/LARGE + TF_TString_ResizeUninitialized(str, TF_TString_GetSize(str)); + return (TF_TString_GetType(str) == TF_TSTR_SMALL) ? str->u.smll.str + : str->u.large.ptr; + case TF_TSTR_LARGE: + return str->u.large.ptr; + default: + // Unreachable. + return NULL; // NOLINT + } +} + +static inline void TF_TString_Reserve(TF_TString *str, size_t new_cap) { + TF_TString_Type curr_type = TF_TString_GetType(str); + + if (new_cap <= TF_TString_SmallCapacity) { + // We do nothing, we let Resize/GetMutableDataPointer handle the + // conversion to SMALL from VIEW/OFFSET when the need arises. + // In the degenerate case, where new_cap <= TF_TString_SmallCapacity, + // curr_size > TF_TString_SmallCapacity, and the type is VIEW/OFFSET, we + // defer the malloc to Resize/GetMutableDataPointer. + return; + } + + if (curr_type == TF_TSTR_LARGE && new_cap <= str->u.large.cap) { + // We handle reduced cap in resize. + return; + } + + // Case: VIEW/OFFSET -> LARGE or grow an existing LARGE type + size_t curr_size = TF_TString_GetSize(str); + const char *curr_ptr = TF_TString_GetDataPointer(str); + + // Since VIEW and OFFSET types are read-only, their capacity is effectively 0. + // So we make sure we have enough room in the VIEW and OFFSET cases. + new_cap = TF_align16(TF_max(new_cap, curr_size) + 1) - 1; + + if (curr_type == TF_TSTR_LARGE) { + str->u.large.ptr = + (char *)realloc(str->u.large.ptr, new_cap + 1); // NOLINT + } else { + // Convert to Large + char *new_ptr = (char *)malloc(new_cap + 1); // NOLINT + memcpy(new_ptr, curr_ptr, curr_size); + + str->u.large.size = TF_TString_ToInternalSizeT(curr_size, TF_TSTR_LARGE); + str->u.large.ptr = new_ptr; + str->u.large.ptr[curr_size] = '\0'; + } + + str->u.large.cap = new_cap; +} + +static inline void TF_TString_ReserveAmortized(TF_TString *str, + size_t new_cap) { + const size_t curr_cap = TF_TString_GetCapacity(str); + if (new_cap > curr_cap) { + TF_TString_Reserve(str, new_cap > 2 * curr_cap ? new_cap : 2 * curr_cap); + } +} + +static inline char *TF_TString_Resize(TF_TString *str, size_t new_size, + char c) { + size_t curr_size = TF_TString_GetSize(str); + char *cstr = TF_TString_ResizeUninitialized(str, new_size); + + if (new_size > curr_size) { + memset(cstr + curr_size, c, new_size - curr_size); + } + + return cstr; +} + +static inline void TF_TString_AssignView(TF_TString *dst, const char *src, + size_t size) { + TF_TString_Dealloc(dst); + + dst->u.view.size = TF_TString_ToInternalSizeT(size, TF_TSTR_VIEW); + dst->u.view.ptr = src; +} + +static inline void TF_TString_AppendN(TF_TString *dst, const char *src, + size_t src_size) { + if (!src_size) return; + + size_t dst_size = TF_TString_GetSize(dst); + + // For append use cases, we want to ensure amortized growth. + TF_TString_ReserveAmortized(dst, dst_size + src_size); + char *dst_c = TF_TString_ResizeUninitialized(dst, dst_size + src_size); + + memcpy(dst_c + dst_size, src, src_size); +} + +static inline void TF_TString_Append(TF_TString *dst, const TF_TString *src) { + const char *src_c = TF_TString_GetDataPointer(src); + size_t size = TF_TString_GetSize(src); + + TF_TString_AppendN(dst, src_c, size); +} + +static inline void TF_TString_Copy(TF_TString *dst, const char *src, + size_t size) { + char *dst_c = TF_TString_ResizeUninitialized(dst, size); + + if (size) memcpy(dst_c, src, size); +} + +static inline void TF_TString_Assign(TF_TString *dst, const TF_TString *src) { + if (dst == src) return; + + TF_TString_Dealloc(dst); + + switch (TF_TString_GetType(src)) { + case TF_TSTR_SMALL: + case TF_TSTR_VIEW: + *dst = *src; + return; + case TF_TSTR_LARGE: { + const char *src_c = TF_TString_GetDataPointer(src); + size_t size = TF_TString_GetSize(src); + + TF_TString_Copy(dst, src_c, size); + } + return; + case TF_TSTR_OFFSET: { + const char *src_c = TF_TString_GetDataPointer(src); + size_t size = TF_TString_GetSize(src); + + TF_TString_AssignView(dst, src_c, size); + } + return; + default: + return; // Unreachable. + } +} + +static inline void TF_TString_Move(TF_TString *dst, TF_TString *src) { + if (dst == src) return; + + TF_TString_Dealloc(dst); + + switch (TF_TString_GetType(src)) { + case TF_TSTR_SMALL: + case TF_TSTR_VIEW: + *dst = *src; + return; + case TF_TSTR_LARGE: + *dst = *src; + TF_TString_Init(src); + return; + case TF_TSTR_OFFSET: { + const char *src_c = TF_TString_GetDataPointer(src); + size_t size = TF_TString_GetSize(src); + + TF_TString_AssignView(dst, src_c, size); + } + return; + default: + return; // Unreachable. + } +} + +#endif // TENSORFLOW_TSL_PLATFORM_CTSTRING_INTERNAL_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/casts.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/casts.h new file mode 100644 index 0000000000000000000000000000000000000000..bdae0f93bcc26c01ec87b070abbcfefe8f50a48d --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/casts.h @@ -0,0 +1,92 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_CASTS_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_CASTS_H_ + +#include // for use with down_cast<> + +#include + +namespace tensorflow { + +// An "upcast", i.e. a conversion from a pointer to an object to a pointer to a +// base subobject, always succeeds if the base is unambiguous and accessible, +// and so it's fine to use implicit_cast. +// +// A "downcast", i.e. a conversion from a pointer to an object to a pointer +// to a more-derived object that may contain the original object as a base +// subobject, cannot safely be done using static_cast, because you do not +// generally know whether the source object is really the base subobject of +// a containing, more-derived object of the target type. Thus, when you +// downcast in a polymorphic type hierarchy, you should use the following +// function template. +// +// In debug mode, we use dynamic_cast to double-check whether the downcast is +// legal (we die if it's not). In normal mode, we do the efficient static_cast +// instead. Thus, it's important to test in debug mode to make sure the cast is +// legal! +// +// This is the only place in the codebase we should use dynamic_cast. +// In particular, you should NOT use dynamic_cast for RTTI, e.g. for +// code like this: +// if (auto* p = dynamic_cast(foo)) HandleASubclass1Object(p); +// if (auto* p = dynamic_cast(foo)) HandleASubclass2Object(p); +// You should design the code some other way not to need this. + +template // use like this: down_cast(foo); +inline To down_cast(From* f) { // so we only accept pointers + static_assert( + (std::is_base_of::type>::value), + "target type not derived from source type"); + + // We skip the assert and hence the dynamic_cast if RTTI is disabled. +#if !defined(__GNUC__) || defined(__GXX_RTTI) + // Uses RTTI in dbg and fastbuild. asserts are disabled in opt builds. + assert(f == nullptr || dynamic_cast(f) != nullptr); +#endif // !defined(__GNUC__) || defined(__GXX_RTTI) + + return static_cast(f); +} + +// Overload of down_cast for references. Use like this: down_cast(foo). +// The code is slightly convoluted because we're still using the pointer +// form of dynamic cast. (The reference form throws an exception if it +// fails.) +// +// There's no need for a special const overload either for the pointer +// or the reference form. If you call down_cast with a const T&, the +// compiler will just bind From to const T. +template +inline To down_cast(From& f) { + static_assert(std::is_lvalue_reference::value, + "target type not a reference"); + static_assert( + (std::is_base_of::type>::value), + "target type not derived from source type"); + + // We skip the assert and hence the dynamic_cast if RTTI is disabled. +#if !defined(__GNUC__) || defined(__GXX_RTTI) + // RTTI: debug mode only + assert(dynamic_cast::type*>(&f) != + nullptr); +#endif // !defined(__GNUC__) || defined(__GXX_RTTI) + + return static_cast(f); +} + +} // namespace tensorflow + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_CASTS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/context.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/context.h new file mode 100644 index 0000000000000000000000000000000000000000..df75d22e5ec86760a57a4ecfb33f54403e985f3d --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/context.h @@ -0,0 +1,37 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_CONTEXT_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_CONTEXT_H_ + +namespace tsl { + +class Context { + public: + Context() {} + Context(const ContextKind kind) {} + + bool operator==(const Context& other) const { return true; } +}; + +class WithContext { + public: + explicit WithContext(const Context& x) {} + ~WithContext() {} +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_CONTEXT_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/crash_analysis.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/crash_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..09c33a824d00571992d042f2626fafc25c38ca6c --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/crash_analysis.h @@ -0,0 +1,48 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_ + +#include + +#include "tsl/platform/protobuf.h" + +namespace tensorflow { +namespace crash_analysis { + +class BufferedDataSource {}; + +// Reports `message` proto which will be stored in the `file_name` in case +// of a process crash. +// Default implementation is currently NOOP. +BufferedDataSource* ReportProtoDataOnCrash( + const std::string& file_name, const tsl::protobuf::Message& message); + +// Removes `data_source` from the list of data reported in case of a process +// crash. +// Default implementation is currently NOOP. +void RemoveReportData(const BufferedDataSource* data_source); + +// Reports `event_data` with the associated `message` under `event_name` to the +// crash analysis system. This does not require process crash. +// Default implementation is currently NOOP. +void ReportEvent(const std::string& event_name, const std::string& message, + const std::string& event_data); + +} // namespace crash_analysis +} // namespace tensorflow + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/criticality.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/criticality.h new file mode 100644 index 0000000000000000000000000000000000000000..e6a93e3c836751d971ceecb80775dc1fc43240d9 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/criticality.h @@ -0,0 +1,32 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_CRITICALITY_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_CRITICALITY_H_ + +namespace tsl { + +namespace criticality { + +inline Criticality GetCriticality() { + // For default platforms, return the default criticality. + return Criticality::kCritical; +} + +} // namespace criticality + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_CRITICALITY_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/dso_loader.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/dso_loader.h new file mode 100644 index 0000000000000000000000000000000000000000..6f72484d504f533c79df52156ff5d784a93d55b5 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/dso_loader.h @@ -0,0 +1,95 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Common DSO loading functionality: exposes callables that dlopen DSOs +// in either the runfiles directories + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_DSO_LOADER_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_DSO_LOADER_H_ + +#include "absl/status/status.h" +#include "absl/status/statusor.h" + +namespace tsl { +namespace internal { + +namespace DsoLoader { +// The following methods either load the DSO of interest and return a dlopen +// handle or error status. +absl::StatusOr GetCudaDriverDsoHandle(); +absl::StatusOr GetCudaRuntimeDsoHandle(); +absl::StatusOr GetCublasDsoHandle(); +absl::StatusOr GetCublasLtDsoHandle(); +absl::StatusOr GetCufftDsoHandle(); +absl::StatusOr GetCusolverDsoHandle(); +absl::StatusOr GetCusparseDsoHandle(); +absl::StatusOr GetCuptiDsoHandle(); +absl::StatusOr GetCudnnDsoHandle(); +absl::StatusOr GetNcclDsoHandle(); +absl::StatusOr GetNvInferDsoHandle(); +absl::StatusOr GetNvInferPluginDsoHandle(); + +absl::StatusOr GetRocblasDsoHandle(); +absl::StatusOr GetMiopenDsoHandle(); +absl::StatusOr GetHipfftDsoHandle(); +absl::StatusOr GetRocrandDsoHandle(); +absl::StatusOr GetRoctracerDsoHandle(); +absl::StatusOr GetRocsolverDsoHandle(); +absl::StatusOr GetHipsolverDsoHandle(); +absl::StatusOr GetHipsparseDsoHandle(); +absl::StatusOr GetHipDsoHandle(); + +// The following method tries to dlopen all necessary GPU libraries for the GPU +// platform TF is built with (CUDA or ROCm) only when these libraries should be +// dynamically loaded. Error status is returned when any of the libraries cannot +// be dlopened. +absl::Status MaybeTryDlopenGPULibraries(); + +// The following method tries to dlopen all necessary TensorRT libraries when +// these libraries should be dynamically loaded. Error status is returned when +// any of the libraries cannot be dlopened. +absl::Status TryDlopenTensorRTLibraries(); +} // namespace DsoLoader + +// Wrapper around the DsoLoader that prevents us from dlopen'ing any of the DSOs +// more than once. +namespace CachedDsoLoader { +// Cached versions of the corresponding DsoLoader methods above. +absl::StatusOr GetCudaDriverDsoHandle(); +absl::StatusOr GetCudaRuntimeDsoHandle(); +absl::StatusOr GetCublasDsoHandle(); +absl::StatusOr GetCublasLtDsoHandle(); +absl::StatusOr GetCufftDsoHandle(); +absl::StatusOr GetCusolverDsoHandle(); +absl::StatusOr GetCusparseDsoHandle(); +absl::StatusOr GetCuptiDsoHandle(); +absl::StatusOr GetCudnnDsoHandle(); + +absl::StatusOr GetRocblasDsoHandle(); +absl::StatusOr GetMiopenDsoHandle(); +absl::StatusOr GetHipfftDsoHandle(); +absl::StatusOr GetRocrandDsoHandle(); +absl::StatusOr GetRocsolverDsoHandle(); +absl::StatusOr GetHipsolverDsoHandle(); +absl::StatusOr GetRoctracerDsoHandle(); +absl::StatusOr GetHipsparseDsoHandle(); +absl::StatusOr GetHipblasltDsoHandle(); +absl::StatusOr GetHipDsoHandle(); +} // namespace CachedDsoLoader + +} // namespace internal +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_DSO_LOADER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/integral_types.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/integral_types.h new file mode 100644 index 0000000000000000000000000000000000000000..6f2f4c560cade78de6c700ad2d38cf73e79be811 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/integral_types.h @@ -0,0 +1,38 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_ + +#include + +// IWYU pragma: private, include "tsl/platform/types.h" +// IWYU pragma: friend third_party/tensorflow/tsl/platform/types.h + +namespace tsl { + +typedef signed char int8; +typedef short int16; +typedef int int32; +typedef ::std::int64_t int64; + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +typedef std::uint64_t uint64; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/logging.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/logging.h new file mode 100644 index 0000000000000000000000000000000000000000..c8bad4bedefe111bb8821ac45591ea8c7fee345f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/logging.h @@ -0,0 +1,651 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#if defined(_WIN32) +// prevent compile error because MSVC doesn't realize in debug build that +// LOG(FATAL) finally invokes abort() +#pragma warning(disable : 4716) +#endif // _WIN32 + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_LOGGING_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_LOGGING_H_ + +// IWYU pragma: private, include "tsl/platform/logging.h" +// IWYU pragma: friend third_party/tensorflow/tsl/platform/logging.h + +#include +#include +#include +#include +#include +#include + +#include "absl/base/log_severity.h" +#include "absl/strings/string_view.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/types.h" + +// TODO(mrry): Prevent this Windows.h #define from leaking out of our headers. +#undef ERROR + +// Undef everything in case we're being mixed with some other Google library +// which already defined them itself. Presumably all Google libraries will +// support the same syntax for these so it should not be a big deal if they +// end up using our definitions instead. +#undef LOG +#undef LOG_EVERY_N +#undef LOG_FIRST_N +#undef LOG_EVERY_POW_2 +#undef LOG_EVERY_N_SEC +#undef VLOG + +#undef CHECK +#undef CHECK_EQ +#undef CHECK_NE +#undef CHECK_LT +#undef CHECK_LE +#undef CHECK_GT +#undef CHECK_GE + +#undef DCHECK +#undef DCHECK_EQ +#undef DCHECK_NE +#undef DCHECK_LT +#undef DCHECK_LE +#undef DCHECK_GT +#undef DCHECK_GE + +#undef QCHECK +#undef QCHECK_EQ +#undef QCHECK_NE +#undef QCHECK_LT +#undef QCHECK_LE +#undef QCHECK_GT +#undef QCHECK_GE + +#undef PCHECK + +namespace tsl { +const int INFO = 0; // base_logging::INFO; +const int WARNING = 1; // base_logging::WARNING; +const int ERROR = 2; // base_logging::ERROR; +const int FATAL = 3; // base_logging::FATAL; +const int NUM_SEVERITIES = 4; // base_logging::NUM_SEVERITIES; + +namespace internal { + +// Emit "message" as a log message to the log for the specified +// "severity" as if it came from a LOG call at "fname:line" +void LogString(const char* fname, int line, int severity, + const std::string& message); + +class LogMessage : public std::basic_ostringstream { + public: + LogMessage(const char* fname, int line, int severity); + ~LogMessage() override; + + // Change the location of the log message. + LogMessage& AtLocation(const char* fname, int line); + + // Returns the maximum log level for VLOG statements. + // E.g., if MaxVLogLevel() is 2, then VLOG(2) statements will produce output, + // but VLOG(3) will not. Defaults to 0. + static int64_t MaxVLogLevel(); + + // Returns whether VLOG level lvl is activated for the file fname. + // + // E.g. if the environment variable TF_CPP_VMODULE contains foo=3 and fname is + // foo.cc and lvl is <= 3, this will return true. It will also return true if + // the level is lower or equal to TF_CPP_MAX_VLOG_LEVEL (default zero). + // + // It is expected that the result of this query will be cached in the VLOG-ing + // call site to avoid repeated lookups. This routine performs a hash-map + // access against the VLOG-ing specification provided by the env var. + static bool VmoduleActivated(const char* fname, int level); + + protected: + void GenerateLogMessage(); + + private: + const char* fname_; + int line_; + int severity_; +}; + +// Uses the lower operator & precedence to voidify a LogMessage reference, so +// that the ternary VLOG() implementation is balanced, type wise. +struct Voidifier { + template + void operator&(const T&) const {} +}; + +// LogMessageFatal ensures the process will exit in failure after +// logging this message. +class LogMessageFatal : public LogMessage { + public: + LogMessageFatal(const char* file, int line) TF_ATTRIBUTE_COLD; + TF_ATTRIBUTE_NORETURN ~LogMessageFatal() override; +}; + +// LogMessageNull supports the DVLOG macro by simply dropping any log messages. +class LogMessageNull : public std::basic_ostringstream { + public: + LogMessageNull() {} + ~LogMessageNull() override {} +}; + +#define _TF_LOG_INFO \ + ::tsl::internal::LogMessage(__FILE__, __LINE__, ::tsl::INFO) +#define _TF_LOG_WARNING \ + ::tsl::internal::LogMessage(__FILE__, __LINE__, ::tsl::WARNING) +#define _TF_LOG_ERROR \ + ::tsl::internal::LogMessage(__FILE__, __LINE__, ::tsl::ERROR) +#define _TF_LOG_FATAL ::tsl::internal::LogMessageFatal(__FILE__, __LINE__) + +#define _TF_LOG_QFATAL _TF_LOG_FATAL + +#ifdef NDEBUG +#define _TF_LOG_DFATAL _TF_LOG_ERROR +#else +#define _TF_LOG_DFATAL _TF_LOG_FATAL +#endif + +#define LOG(severity) _TF_LOG_##severity + +#ifdef IS_MOBILE_PLATFORM + +// Turn VLOG off when under mobile devices for considerations of binary size. +#define VLOG_IS_ON(lvl) ((lvl) <= 0) + +#else + +// Otherwise, set TF_CPP_MAX_VLOG_LEVEL environment to update minimum log level +// of VLOG, or TF_CPP_VMODULE to set the minimum log level for individual +// translation units. +#define VLOG_IS_ON(lvl) \ + (([](int level, const char* fname) { \ + static const bool vmodule_activated = \ + ::tsl::internal::LogMessage::VmoduleActivated(fname, level); \ + return vmodule_activated; \ + })(lvl, __FILE__)) + +#endif + +#define VLOG(level) \ + TF_PREDICT_TRUE(!VLOG_IS_ON(level)) \ + ? (void)0 \ + : ::tsl::internal::Voidifier() & \ + ::tsl::internal::LogMessage(__FILE__, __LINE__, tsl::INFO) + +// `DVLOG` behaves like `VLOG` in debug mode (i.e. `#ifndef NDEBUG`). +// Otherwise, it compiles away and does nothing. +#ifndef NDEBUG +#define DVLOG VLOG +#else +#define DVLOG(verbose_level) \ + while (false && (verbose_level) > 0) ::tsl::internal::LogMessageNull() +#endif + +class LogEveryNState { + public: + bool ShouldLog(int n); + uint32_t counter() { return counter_.load(std::memory_order_relaxed); } + + private: + std::atomic counter_{0}; +}; + +class LogFirstNState { + public: + bool ShouldLog(int n); + uint32 counter() { return counter_.load(std::memory_order_relaxed); } + + private: + std::atomic counter_{0}; +}; + +class LogEveryPow2State { + public: + bool ShouldLog(int ignored); + uint32 counter() { return counter_.load(std::memory_order_relaxed); } + + private: + std::atomic counter_{0}; +}; + +class LogEveryNSecState { + public: + bool ShouldLog(double seconds); + uint32 counter() { return counter_.load(std::memory_order_relaxed); } + + private: + std::atomic counter_{0}; + // Cycle count according to CycleClock that we should next log at. + std::atomic next_log_time_cycles_{0}; +}; + +// This macro has a lot going on! +// +// * A local static (`logging_internal_stateful_condition_state`) is +// declared in a scope such that each `LOG_EVERY_N` (etc.) line has its own +// state. +// * `COUNTER`, the third variable, is used to support `<< COUNTER`. It is not +// mangled, so shadowing can be a problem, albeit more of a +// shoot-yourself-in-the-foot one. Don't name your variables `COUNTER`. +// * A single for loop can declare state and also test +// `condition && state.ShouldLog()`, but there's no way to constrain it to run +// only once (or not at all) without declaring another variable. The outer +// for-loop declares this variable (`do_log`). +// * Using for loops instead of if statements means there's no risk of an +// ambiguous dangling else statement. +#define LOGGING_INTERNAL_STATEFUL_CONDITION(kind, condition, arg) \ + for (bool logging_internal_stateful_condition_do_log(condition); \ + logging_internal_stateful_condition_do_log; \ + logging_internal_stateful_condition_do_log = false) \ + for (static ::tsl::internal::Log##kind##State \ + logging_internal_stateful_condition_state; \ + logging_internal_stateful_condition_do_log && \ + logging_internal_stateful_condition_state.ShouldLog(arg); \ + logging_internal_stateful_condition_do_log = false) \ + for (const uint32_t COUNTER ABSL_ATTRIBUTE_UNUSED = \ + logging_internal_stateful_condition_state.counter(); \ + logging_internal_stateful_condition_do_log; \ + logging_internal_stateful_condition_do_log = false) + +// An instance of `LOG_EVERY_N` increments a hidden zero-initialized counter +// every time execution passes through it and logs the specified message when +// the counter's value is a multiple of `n`, doing nothing otherwise. Each +// instance has its own counter. The counter's value can be logged by streaming +// the symbol `COUNTER`. `LOG_EVERY_N` is thread-safe. +// Example: +// +// for (const auto& user : all_users) { +// LOG_EVERY_N(INFO, 1000) << "Processing user #" << COUNTER; +// ProcessUser(user); +// } +#define LOG_EVERY_N(severity, n) \ + LOGGING_INTERNAL_STATEFUL_CONDITION(EveryN, true, n) \ + LOG(severity) +// `LOG_FIRST_N` behaves like `LOG_EVERY_N` except that the specified message is +// logged when the counter's value is less than `n`. `LOG_FIRST_N` is +// thread-safe. +#define LOG_FIRST_N(severity, n) \ + LOGGING_INTERNAL_STATEFUL_CONDITION(FirstN, true, n) \ + LOG(severity) +// `LOG_EVERY_POW_2` behaves like `LOG_EVERY_N` except that the specified +// message is logged when the counter's value is a power of 2. +// `LOG_EVERY_POW_2` is thread-safe. +#define LOG_EVERY_POW_2(severity) \ + LOGGING_INTERNAL_STATEFUL_CONDITION(EveryPow2, true, 0) \ + LOG(severity) +// An instance of `LOG_EVERY_N_SEC` uses a hidden state variable to log the +// specified message at most once every `n_seconds`. A hidden counter of +// executions (whether a message is logged or not) is also maintained and can be +// logged by streaming the symbol `COUNTER`. `LOG_EVERY_N_SEC` is thread-safe. +// Example: +// +// LOG_EVERY_N_SEC(INFO, 2.5) << "Got " << COUNTER << " cookies so far"; +#define LOG_EVERY_N_SEC(severity, n_seconds) \ + LOGGING_INTERNAL_STATEFUL_CONDITION(EveryNSec, true, n_seconds) \ + LOG(severity) + +// CHECK dies with a fatal error if condition is not true. It is *not* +// controlled by NDEBUG, so the check will be executed regardless of +// compilation mode. Therefore, it is safe to do things like: +// CHECK(fp->Write(x) == 4) +#define CHECK(condition) \ + if (TF_PREDICT_FALSE(!(condition))) \ + LOG(FATAL) << "Check failed: " #condition " " + +// Function is overloaded for integral types to allow static const +// integrals declared in classes and not defined to be used as arguments to +// CHECK* macros. It's not encouraged though. +template +inline const T& GetReferenceableValue(const T& t) { + return t; +} +inline char GetReferenceableValue(char t) { return t; } +inline unsigned char GetReferenceableValue(unsigned char t) { return t; } +inline signed char GetReferenceableValue(signed char t) { return t; } +inline int16 GetReferenceableValue(int16_t t) { return t; } +inline uint16 GetReferenceableValue(uint16 t) { return t; } +inline int GetReferenceableValue(int t) { return t; } +inline unsigned int GetReferenceableValue(unsigned int t) { return t; } +inline int64_t GetReferenceableValue(int64_t t) { return t; } +inline uint64 GetReferenceableValue(uint64 t) { return t; } + +// This formats a value for a failing CHECK_XX statement. Ordinarily, +// it uses the definition for operator<<, with a few special cases below. +template +inline void MakeCheckOpValueString(std::ostream* os, const T& v) { + (*os) << v; +} + +// Overrides for char types provide readable values for unprintable +// characters. +template <> +void MakeCheckOpValueString(std::ostream* os, const char& v); +template <> +void MakeCheckOpValueString(std::ostream* os, const signed char& v); +template <> +void MakeCheckOpValueString(std::ostream* os, const unsigned char& v); + +#if LANG_CXX11 +// We need an explicit specialization for std::nullptr_t. +template <> +void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& v); +#endif + +// A container for a string pointer which can be evaluated to a bool - +// true iff the pointer is non-NULL. +struct CheckOpString { + explicit CheckOpString(string* str) : str_(str) {} + // No destructor: if str_ is non-NULL, we're about to LOG(FATAL), + // so there's no point in cleaning up str_. + explicit operator bool() const { return TF_PREDICT_FALSE(str_ != nullptr); } + string* str_; +}; + +// Build the error message string. Specify no inlining for code size. +template +string* MakeCheckOpString(const T1& v1, const T2& v2, + const char* exprtext) TF_ATTRIBUTE_NOINLINE; + +// A helper class for formatting "expr (V1 vs. V2)" in a CHECK_XX +// statement. See MakeCheckOpString for sample usage. Other +// approaches were considered: use of a template method (e.g., +// base::BuildCheckOpString(exprtext, base::Print, &v1, +// base::Print, &v2), however this approach has complications +// related to volatile arguments and function-pointer arguments). +class CheckOpMessageBuilder { + public: + // Inserts "exprtext" and " (" to the stream. + explicit CheckOpMessageBuilder(const char* exprtext); + // Deletes "stream_". + ~CheckOpMessageBuilder(); + // For inserting the first variable. + std::ostream* ForVar1() { return stream_; } + // For inserting the second variable (adds an intermediate " vs. "). + std::ostream* ForVar2(); + // Get the result (inserts the closing ")"). + string* NewString(); + + private: + std::ostringstream* stream_; +}; + +template +string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) { + CheckOpMessageBuilder comb(exprtext); + MakeCheckOpValueString(comb.ForVar1(), v1); + MakeCheckOpValueString(comb.ForVar2(), v2); + return comb.NewString(); +} + +// Helper functions for CHECK_OP macro. +// We use the full name Check_EQ, Check_NE, etc. in case the file including +// base/logging.h provides its own #defines for the simpler names EQ, NE, etc. +// This happens if, for example, those are used as token names in a +// yacc grammar. +// The (int, int) overload works around the issue that the compiler +// will not instantiate the template version of the function on values of +// unnamed enum type - see comment below. +#define TF_DEFINE_CHECK_OP_IMPL(name, op) \ + template \ + inline string* name##Impl(const T1& v1, const T2& v2, \ + const char* exprtext) { \ + if (TF_PREDICT_TRUE(v1 op v2)) \ + return NULL; \ + else \ + return ::tsl::internal::MakeCheckOpString(v1, v2, exprtext); \ + } \ + inline string* name##Impl(int v1, int v2, const char* exprtext) { \ + return name##Impl(v1, v2, exprtext); \ + } + +// The (size_t, int) and (int, size_t) specialization are to handle unsigned +// comparison errors while still being thorough with the comparison. + +TF_DEFINE_CHECK_OP_IMPL(Check_EQ, ==) +// Compilation error with CHECK_EQ(NULL, x)? +// Use CHECK(x == NULL) instead. + +inline string* Check_EQImpl(int v1, size_t v2, const char* exprtext) { + if (TF_PREDICT_FALSE(v1 < 0)) + ::tsl::internal::MakeCheckOpString(v1, v2, exprtext); + + return Check_EQImpl(size_t(v1), v2, exprtext); +} + +inline string* Check_EQImpl(size_t v1, int v2, const char* exprtext) { + return Check_EQImpl(v2, v1, exprtext); +} + +TF_DEFINE_CHECK_OP_IMPL(Check_NE, !=) + +inline string* Check_NEImpl(int v1, size_t v2, const char* exprtext) { + if (v1 < 0) return NULL; + + return Check_NEImpl(size_t(v1), v2, exprtext); +} + +inline string* Check_NEImpl(size_t v1, int v2, const char* exprtext) { + return Check_NEImpl(v2, v1, exprtext); +} + +TF_DEFINE_CHECK_OP_IMPL(Check_LE, <=) + +inline string* Check_LEImpl(int v1, size_t v2, const char* exprtext) { + if (v1 <= 0) return NULL; + + return Check_LEImpl(size_t(v1), v2, exprtext); +} + +inline string* Check_LEImpl(size_t v1, int v2, const char* exprtext) { + if (TF_PREDICT_FALSE(v2 < 0)) + return ::tsl::internal::MakeCheckOpString(v1, v2, exprtext); + return Check_LEImpl(v1, size_t(v2), exprtext); +} + +TF_DEFINE_CHECK_OP_IMPL(Check_LT, <) + +inline string* Check_LTImpl(int v1, size_t v2, const char* exprtext) { + if (v1 < 0) return NULL; + + return Check_LTImpl(size_t(v1), v2, exprtext); +} + +inline string* Check_LTImpl(size_t v1, int v2, const char* exprtext) { + if (v2 < 0) return ::tsl::internal::MakeCheckOpString(v1, v2, exprtext); + return Check_LTImpl(v1, size_t(v2), exprtext); +} + +// Implement GE,GT in terms of LE,LT +template +inline string* Check_GEImpl(const T1& v1, const T2& v2, const char* exprtext) { + return Check_LEImpl(v2, v1, exprtext); +} + +template +inline string* Check_GTImpl(const T1& v1, const T2& v2, const char* exprtext) { + return Check_LTImpl(v2, v1, exprtext); +} + +#undef TF_DEFINE_CHECK_OP_IMPL + +// In optimized mode, use CheckOpString to hint to compiler that +// the while condition is unlikely. +#define CHECK_OP_LOG(name, op, val1, val2) \ + while (::tsl::internal::CheckOpString _result{::tsl::internal::name##Impl( \ + ::tsl::internal::GetReferenceableValue(val1), \ + ::tsl::internal::GetReferenceableValue(val2), #val1 " " #op " " #val2)}) \ + ::tsl::internal::LogMessageFatal(__FILE__, __LINE__) << *(_result.str_) + +#define CHECK_OP(name, op, val1, val2) CHECK_OP_LOG(name, op, val1, val2) + +// CHECK_EQ/NE/... +#define CHECK_EQ(val1, val2) CHECK_OP(Check_EQ, ==, val1, val2) +#define CHECK_NE(val1, val2) CHECK_OP(Check_NE, !=, val1, val2) +#define CHECK_LE(val1, val2) CHECK_OP(Check_LE, <=, val1, val2) +#define CHECK_LT(val1, val2) CHECK_OP(Check_LT, <, val1, val2) +#define CHECK_GE(val1, val2) CHECK_OP(Check_GE, >=, val1, val2) +#define CHECK_GT(val1, val2) CHECK_OP(Check_GT, >, val1, val2) +#define CHECK_NOTNULL(val) \ + ::tsl::internal::CheckNotNull(__FILE__, __LINE__, \ + "'" #val "' Must be non NULL", (val)) + +#ifndef NDEBUG +// DCHECK_EQ/NE/... +#define DCHECK(condition) CHECK(condition) +#define DCHECK_EQ(val1, val2) CHECK_EQ(val1, val2) +#define DCHECK_NE(val1, val2) CHECK_NE(val1, val2) +#define DCHECK_LE(val1, val2) CHECK_LE(val1, val2) +#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2) +#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2) +#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2) + +#else + +#define DCHECK(condition) \ + while (false && (condition)) LOG(FATAL) + +// NDEBUG is defined, so DCHECK_EQ(x, y) and so on do nothing. +// However, we still want the compiler to parse x and y, because +// we don't want to lose potentially useful errors and warnings. +// _DCHECK_NOP is a helper, and should not be used outside of this file. +#define _TF_DCHECK_NOP(x, y) \ + while (false && ((void)(x), (void)(y), 0)) LOG(FATAL) + +#define DCHECK_EQ(x, y) _TF_DCHECK_NOP(x, y) +#define DCHECK_NE(x, y) _TF_DCHECK_NOP(x, y) +#define DCHECK_LE(x, y) _TF_DCHECK_NOP(x, y) +#define DCHECK_LT(x, y) _TF_DCHECK_NOP(x, y) +#define DCHECK_GE(x, y) _TF_DCHECK_NOP(x, y) +#define DCHECK_GT(x, y) _TF_DCHECK_NOP(x, y) + +#endif + +// These are for when you don't want a CHECK failure to print a verbose +// stack trace. The implementation of CHECK* in this file already doesn't. +#define QCHECK(condition) CHECK(condition) +#define QCHECK_EQ(x, y) CHECK_EQ(x, y) +#define QCHECK_NE(x, y) CHECK_NE(x, y) +#define QCHECK_LE(x, y) CHECK_LE(x, y) +#define QCHECK_LT(x, y) CHECK_LT(x, y) +#define QCHECK_GE(x, y) CHECK_GE(x, y) +#define QCHECK_GT(x, y) CHECK_GT(x, y) + +template +T&& CheckNotNull(const char* file, int line, const char* exprtext, T&& t) { + if (t == nullptr) { + LogMessageFatal(file, line) << string(exprtext); + } + return std::forward(t); +} + +int64_t MinLogLevelFromEnv(); + +int64_t MaxVLogLevelFromEnv(); + +} // namespace internal + +// LogSink support adapted from //base/logging.h +// +// `LogSink` is an interface which can be extended to intercept and process +// all log messages. LogSink implementations must be thread-safe. A single +// instance will be called from whichever thread is performing a logging +// operation. +class TFLogEntry { + static absl::LogSeverity AsAbslLogSeverity(int severity) { + return static_cast(severity); + } + + public: + explicit TFLogEntry(int severity, absl::string_view message) + : severity_(AsAbslLogSeverity(severity)), message_(message) {} + + explicit TFLogEntry(int severity, absl::string_view fname, int line, + absl::string_view message) + : severity_(AsAbslLogSeverity(severity)), + fname_(fname), + line_(line), + message_(message) {} + + absl::LogSeverity log_severity() const { return severity_; } + std::string FName() const { return fname_; } + int Line() const { return line_; } + std::string ToString() const { return message_; } + absl::string_view text_message() const { return message_; } + + // Returning similar result as `text_message` as there is no prefix in this + // implementation. + absl::string_view text_message_with_prefix() const { return message_; } + + private: + const absl::LogSeverity severity_; + const std::string fname_; + int line_ = -1; + const std::string message_; +}; + +class TFLogSink { + public: + virtual ~TFLogSink() = default; + + // `Send` is called synchronously during the log statement. The logging + // module guarantees not to call `Send` concurrently on the same log sink. + // Implementations should be careful not to call`LOG` or `CHECK` or take + // any locks that might be held by the `LOG` caller, to avoid deadlock. + // + // `e` is guaranteed to remain valid until the subsequent call to + // `WaitTillSent` completes, so implementations may store a pointer to or + // copy of `e` (e.g. in a thread local variable) for use in `WaitTillSent`. + virtual void Send(const TFLogEntry& entry) = 0; + + // `WaitTillSent` blocks the calling thread (the thread that generated a log + // message) until the sink has finished processing the log message. + // `WaitTillSent` is called once per log message, following the call to + // `Send`. This may be useful when log messages are buffered or processed + // asynchronously by an expensive log sink. + // The default implementation returns immediately. Like `Send`, + // implementations should be careful not to call `LOG` or `CHECK or take any + // locks that might be held by the `LOG` caller, to avoid deadlock. + virtual void WaitTillSent() {} +}; + +// This is the default log sink. This log sink is used if there are no other +// log sinks registered. To disable the default log sink, set the +// "no_default_logger" Bazel config setting to true or define a +// NO_DEFAULT_LOGGER preprocessor symbol. This log sink will always log to +// stderr. +class TFDefaultLogSink : public TFLogSink { + public: + void Send(const TFLogEntry& entry) override; +}; + +// Add or remove a `LogSink` as a consumer of logging data. Thread-safe. +void TFAddLogSink(TFLogSink* sink); +void TFRemoveLogSink(TFLogSink* sink); + +// Get all the log sinks. Thread-safe. +std::vector TFGetLogSinks(); + +// Change verbose level of pre-defined files if envorionment +// variable `env_var` is defined. This is currently a no op. +void UpdateLogVerbosityIfDefined(const char* env_var); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_LOGGING_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..6cf290c7c13bcf577465a20d027f7ffff6967314 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex.h @@ -0,0 +1,39 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_H_ + +// IWYU pragma: private, include "tsl/platform/mutex.h" +// IWYU pragma: friend third_party/tensorflow/tsl/platform/mutex.h + +namespace tsl { + +namespace internal { +std::cv_status wait_until_system_clock( + CVData *cv_data, MuData *mu_data, + const std::chrono::system_clock::time_point timeout_time); +} // namespace internal + +template +std::cv_status condition_variable::wait_for( + mutex_lock &lock, std::chrono::duration dur) { + return tsl::internal::wait_until_system_clock( + &this->cv_, &lock.mutex()->mu_, std::chrono::system_clock::now() + dur); +} + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex_data.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex_data.h new file mode 100644 index 0000000000000000000000000000000000000000..5c73d559fb8b0076981a6cce0a80d583a05ac564 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/mutex_data.h @@ -0,0 +1,35 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_DATA_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_DATA_H_ + +namespace tsl { +namespace internal { + +// The internal state of a mutex. +struct MuData { + void* space[2]; +}; + +// The internal state of a condition_variable. +struct CVData { + void* space[2]; +}; + +} // namespace internal +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_MUTEX_DATA_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/posix_file_system.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/posix_file_system.h new file mode 100644 index 0000000000000000000000000000000000000000..2da9f03889c46b49fbb1790c76df1824a261ccf5 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/posix_file_system.h @@ -0,0 +1,84 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_POSIX_FILE_SYSTEM_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_POSIX_FILE_SYSTEM_H_ + +#include "tsl/platform/env.h" +#include "tsl/platform/path.h" + +namespace tsl { + +class PosixFileSystem : public FileSystem { + public: + PosixFileSystem() {} + + ~PosixFileSystem() override {} + + TF_USE_FILESYSTEM_METHODS_WITH_NO_TRANSACTION_SUPPORT; + + Status NewRandomAccessFile( + const string& filename, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewWritableFile(const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewAppendableFile(const string& fname, TransactionToken* token, + std::unique_ptr* result) override; + + Status NewReadOnlyMemoryRegionFromFile( + const string& filename, TransactionToken* token, + std::unique_ptr* result) override; + + Status FileExists(const string& fname, TransactionToken* token) override; + + Status GetChildren(const string& dir, TransactionToken* token, + std::vector* result) override; + + Status Stat(const string& fname, TransactionToken* token, + FileStatistics* stats) override; + + Status GetMatchingPaths(const string& pattern, TransactionToken* token, + std::vector* results) override; + + Status DeleteFile(const string& fname, TransactionToken* token) override; + + Status CreateDir(const string& name, TransactionToken* token) override; + + Status DeleteDir(const string& name, TransactionToken* token) override; + + Status GetFileSize(const string& fname, TransactionToken* token, + uint64* size) override; + + Status RenameFile(const string& src, const string& target, + TransactionToken* token) override; + + Status CopyFile(const string& src, const string& target, + TransactionToken* token) override; +}; + +class LocalPosixFileSystem : public PosixFileSystem { + public: + string TranslateName(const string& name) const override { + StringPiece scheme, host, path; + io::ParseURI(name, &scheme, &host, &path); + return string(path); + } +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_POSIX_FILE_SYSTEM_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/stacktrace.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/stacktrace.h new file mode 100644 index 0000000000000000000000000000000000000000..be05fdb88fe1468007c62232ed22cc260387e5af --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/stacktrace.h @@ -0,0 +1,102 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_STACKTRACE_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_STACKTRACE_H_ + +// clang-format off +#include "tsl/platform/platform.h" +// clang-format on + +#if !defined(IS_MOBILE_PLATFORM) && (defined(__clang__) || defined(__GNUC__)) +#define TF_HAS_STACKTRACE +#endif + +#if defined(TF_HAS_STACKTRACE) +#include +#include +#include +#include +#include +#endif // defined(TF_GENERATE_BACKTRACE) + +#include +#include + +#include "tsl/platform/abi.h" + +namespace tsl { + +// Function to create a pretty stacktrace. +inline std::string CurrentStackTrace() { +#if defined(TF_HAS_STACKTRACE) + std::stringstream ss(""); + ss << "*** Begin stack trace ***" << std::endl; + + // Get the mangled stack trace. + int buffer_size = 128; + void* trace[128]; + buffer_size = backtrace(trace, buffer_size); + + for (int i = 0; i < buffer_size; ++i) { + const char* symbol = ""; + Dl_info info; + if (dladdr(trace[i], &info)) { + if (info.dli_sname != nullptr) { + symbol = info.dli_sname; + } + } + + std::string demangled = port::MaybeAbiDemangle(symbol); + if (demangled.length()) { + ss << "\t" << demangled << std::endl; + } else { + ss << "\t" << symbol << std::endl; + } + } + + ss << "*** End stack trace ***" << std::endl; + return ss.str(); +#else + return std::string(); +#endif // defined(TF_HAS_STACKTRACE) +} + +inline void DebugWriteToString(const char* data, void* arg) { + reinterpret_cast(arg)->append(data); +} + +// A dummy class that does nothing. Someday, add real support. +class SavedStackTrace { + public: + SavedStackTrace() {} + + void CreateCurrent(int skip_count) {} + + void Reset() {} + + typedef void DebugWriter(const char*, void*); + void Dump(DebugWriter* writerfn, void* arg) const {} + + int depth() const { return 0; } + void* const* stack() const { return stack_; } + + private: + void* stack_[32]; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_STACKTRACE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/status.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/status.h new file mode 100644 index 0000000000000000000000000000000000000000..1de5de28ba1cac76851fcefdc4f0105db0543982 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/status.h @@ -0,0 +1,23 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUS_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUS_H_ + +#define MAYBE_ADD_SOURCE_LOCATION(status) \ + {} + +#define ADD_SOURCE_LOCATION(status) status + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/statusor.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/statusor.h new file mode 100644 index 0000000000000000000000000000000000000000..6af26492d16594117f5a9b8757f220ac99c44db1 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/statusor.h @@ -0,0 +1,33 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUSOR_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUSOR_H_ + +#include "absl/status/statusor.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/status.h" + +#define TF_ASSIGN_OR_RETURN(lhs, rexpr) \ + TF_ASSIGN_OR_RETURN_IMPL( \ + TF_STATUS_MACROS_CONCAT_NAME(_status_or_value, __COUNTER__), lhs, rexpr) + +#define TF_ASSIGN_OR_RETURN_IMPL(statusor, lhs, rexpr) \ + auto statusor = (rexpr); \ + if (TF_PREDICT_FALSE(!statusor.ok())) { \ + return statusor.status(); \ + } \ + lhs = std::move(statusor).value() + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_STATUSOR_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/subprocess.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/subprocess.h new file mode 100644 index 0000000000000000000000000000000000000000..5b6e1f31065a179194b6be4e22e62cbd786f37d3 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/subprocess.h @@ -0,0 +1,132 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_SUBPROCESS_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_SUBPROCESS_H_ + +#include +#include + +#include +#include + +#include "tsl/platform/macros.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/types.h" + +namespace tsl { + +class SubProcess { + public: + // SubProcess() + // nfds: The number of file descriptors to use. + explicit SubProcess(int nfds = 3); + + // Virtual for backwards compatibility; do not create new subclasses. + // It is illegal to delete the SubProcess within its exit callback. + virtual ~SubProcess(); + + // SetChannelAction() + // Set how to handle a channel. The default action is ACTION_CLOSE. + // The action is set for all subsequent processes, until SetChannel() + // is called again. + // + // SetChannel may not be called while the process is running. + // + // chan: Which channel this applies to. + // action: What to do with the channel. + // Virtual for backwards compatibility; do not create new subclasses. + virtual void SetChannelAction(Channel chan, ChannelAction action); + + // SetProgram() + // Set up a program and argument list for execution, with the full + // "raw" argument list passed as a vector of strings. argv[0] + // should be the program name, just as in execv(). + // + // file: The file containing the program. This must be an absolute path + // name - $PATH is not searched. + // argv: The argument list. + virtual void SetProgram(const string& file, const std::vector& argv); + + // Start() + // Run the command that was previously set up with SetProgram(). + // The following are fatal programming errors: + // * Attempting to start when a process is already running. + // * Attempting to start without first setting the command. + // Note, however, that Start() does not try to validate that the binary + // does anything reasonable (e.g. exists or can execute); as such, you can + // specify a non-existent binary and Start() will still return true. You + // will get a failure from the process, but only after Start() returns. + // + // Return true normally, or false if the program couldn't be started + // because of some error. + // Virtual for backwards compatibility; do not create new subclasses. + virtual bool Start(); + + // Kill() + // Send the given signal to the process. + // Return true normally, or false if we couldn't send the signal - likely + // because the process doesn't exist. + virtual bool Kill(int signal); + + // Wait() + // Block until the process exits. + // Return true normally, or false if the process wasn't running. + virtual bool Wait(); + + // Communicate() + // Read from stdout and stderr and writes to stdin until all pipes have + // closed, then waits for the process to exit. + // Note: Do NOT call Wait() after calling Communicate as it will always + // fail, since Communicate calls Wait() internally. + // 'stdin_input', 'stdout_output', and 'stderr_output' may be NULL. + // If this process is not configured to send stdout or stderr to pipes, + // the output strings will not be modified. + // If this process is not configured to take stdin from a pipe, stdin_input + // will be ignored. + // Returns the command's exit status. + virtual int Communicate(const string* stdin_input, string* stdout_output, + string* stderr_output); + + private: + static constexpr int kNFds = 3; + static bool chan_valid(int chan) { return ((chan >= 0) && (chan < kNFds)); } + static bool retry(int e) { + return ((e == EINTR) || (e == EAGAIN) || (e == EWOULDBLOCK)); + } + void FreeArgs() TF_EXCLUSIVE_LOCKS_REQUIRED(data_mu_); + void ClosePipes() TF_EXCLUSIVE_LOCKS_REQUIRED(data_mu_); + bool WaitInternal(int* status); + + // The separation between proc_mu_ and data_mu_ mutexes allows Kill() to be + // called by a thread while another thread is inside Wait() or Communicate(). + mutable mutex proc_mu_; + bool running_ TF_GUARDED_BY(proc_mu_); + pid_t pid_ TF_GUARDED_BY(proc_mu_); + + mutable mutex data_mu_ TF_ACQUIRED_AFTER(proc_mu_); + char* exec_path_ TF_GUARDED_BY(data_mu_); + char** exec_argv_ TF_GUARDED_BY(data_mu_); + ChannelAction action_[kNFds] TF_GUARDED_BY(data_mu_); + int parent_pipe_[kNFds] TF_GUARDED_BY(data_mu_); + int child_pipe_[kNFds] TF_GUARDED_BY(data_mu_); + + SubProcess(const SubProcess&) = delete; + void operator=(const SubProcess&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_SUBPROCESS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/tracing_impl.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/tracing_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..8e06e4f60e8ae52de82e4571282e60d6ff0fdbca --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/tracing_impl.h @@ -0,0 +1,41 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_TRACING_IMPL_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_TRACING_IMPL_H_ + +// Stub implementations of tracing functionality. + +// Definitions that do nothing for platforms that don't have underlying thread +// tracing support. +#define TRACELITERAL(a) \ + do { \ + } while (0) +#define TRACESTRING(s) \ + do { \ + } while (0) +#define TRACEPRINTF(format, ...) \ + do { \ + } while (0) + +namespace tsl { +namespace tracing { + +inline bool EventCollector::IsEnabled() { return false; } + +} // namespace tracing +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_TRACING_IMPL_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/unbounded_work_queue.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/unbounded_work_queue.h new file mode 100644 index 0000000000000000000000000000000000000000..2f3563785d68c318bc9ef07aaf904d369a273655 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/default/unbounded_work_queue.h @@ -0,0 +1,68 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_DEFAULT_UNBOUNDED_WORK_QUEUE_H_ +#define TENSORFLOW_TSL_PLATFORM_DEFAULT_UNBOUNDED_WORK_QUEUE_H_ + +#include +#include +#include + +#include "tsl/platform/env.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/notification.h" + +namespace tsl { + +// An `UnboundedWorkQueue` provides a mechanism for temporally multiplexing a +// potentially large number of "logical" threads onto a smaller number of +// "physical" threads. The multiplexing is achieved by maintaining an internal +// pool of long-running "physical" threads that are used to execute the +// "logical" threads. Like a regular thread, a "logical" thread may block on +// other threads, and the size of the pool will increase to ensure that progress +// is made. This mechanism is recommended in situations where short-lived +// threads are created repeatedly, to avoid the overhead and memory +// fragmentation that can result from excessive thread creation. +class UnboundedWorkQueue { + public: + UnboundedWorkQueue(Env* env, const string& thread_name, + const ThreadOptions& thread_options = {}); + ~UnboundedWorkQueue(); + + using WorkFunction = std::function; + + // Schedule `fn` on a thread. `fn` may perform blocking work, so if all the + // existing threads are blocked or busy, this may spawn a new thread which + // will be added to the thread pool managed by this work queue. + void Schedule(WorkFunction fn); + + private: + void PooledThreadFunc(); + + Env* const env_; // Not owned. + const string thread_name_; + const ThreadOptions thread_options_; + mutex work_queue_mu_; + condition_variable work_queue_cv_ TF_GUARDED_BY(work_queue_mu_); + size_t num_idle_threads_ TF_GUARDED_BY(work_queue_mu_) = 0; + bool cancelled_ TF_GUARDED_BY(work_queue_mu_) = false; + std::deque work_queue_ TF_GUARDED_BY(work_queue_mu_); + mutex thread_pool_mu_; + std::vector> thread_pool_ + TF_GUARDED_BY(thread_pool_mu_); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_DEFAULT_UNBOUNDED_WORK_QUEUE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/env_time.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/env_time.h new file mode 100644 index 0000000000000000000000000000000000000000..2ec888069ead327d32bddce4b912810cfaae8b42 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/env_time.h @@ -0,0 +1,65 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_ +#define TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_ + +#include + +#include "tsl/platform/types.h" + +namespace tsl { + +/// \brief An interface used by the tsl implementation to +/// access timer related operations. +class EnvTime { + public: + static constexpr uint64 kMicrosToPicos = 1000ULL * 1000ULL; + static constexpr uint64 kMicrosToNanos = 1000ULL; + static constexpr uint64 kMillisToMicros = 1000ULL; + static constexpr uint64 kMillisToNanos = 1000ULL * 1000ULL; + static constexpr uint64 kNanosToPicos = 1000ULL; + static constexpr uint64 kSecondsToMillis = 1000ULL; + static constexpr uint64 kSecondsToMicros = 1000ULL * 1000ULL; + static constexpr uint64 kSecondsToNanos = 1000ULL * 1000ULL * 1000ULL; + + EnvTime() = default; + virtual ~EnvTime() = default; + + /// \brief Returns the number of nano-seconds since the Unix epoch. + static uint64 NowNanos(); + + /// \brief Returns the number of micro-seconds since the Unix epoch. + static uint64 NowMicros() { return NowNanos() / kMicrosToNanos; } + + /// \brief Returns the number of seconds since the Unix epoch. + static uint64 NowSeconds() { return NowNanos() / kSecondsToNanos; } + + /// \brief A version of NowNanos() that may be overridden by a subclass. + virtual uint64 GetOverridableNowNanos() const { return NowNanos(); } + + /// \brief A version of NowMicros() that may be overridden by a subclass. + virtual uint64 GetOverridableNowMicros() const { + return GetOverridableNowNanos() / kMicrosToNanos; + } + + /// \brief A version of NowSeconds() that may be overridden by a subclass. + virtual uint64 GetOverridableNowSeconds() const { + return GetOverridableNowNanos() / kSecondsToNanos; + } +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/intrusive_ptr.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/intrusive_ptr.h new file mode 100644 index 0000000000000000000000000000000000000000..3793ba3e8610ee5f8a93e1a1c9329d1361c8eee1 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/intrusive_ptr.h @@ -0,0 +1,81 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_INTRUSIVE_PTR_H_ +#define TENSORFLOW_TSL_PLATFORM_INTRUSIVE_PTR_H_ + +#include +namespace tsl { +namespace core { + +// A utility for managing the lifetime of ref-counted objects. +// +// Generally used for objects that derive from `tensorflow::RefCounted`. +template +class IntrusivePtr { + public: + // add_ref=false indicates that IntrusivePtr owns the underlying pointer. + // + // In most cases, we expect this to be called with add_ref=false, except in + // special circumstances where the lifetime of the underlying RefCounted + // object needs to be externally managed. + IntrusivePtr(T* h, bool add_ref) { reset(h, add_ref); } + IntrusivePtr(const IntrusivePtr& o) { reset(o.handle_, /*add_ref=*/true); } + IntrusivePtr(IntrusivePtr&& o) { *this = std::move(o); } + IntrusivePtr() {} + void reset(T* h, bool add_ref) { + if (h != handle_) { + if (add_ref && h) h->Ref(); + if (handle_) handle_->Unref(); + handle_ = h; + } + } + IntrusivePtr& operator=(const IntrusivePtr& o) { + reset(o.handle_, /*add_ref=*/true); + return *this; + } + IntrusivePtr& operator=(IntrusivePtr&& o) { + if (handle_ != o.handle_) { + // Must clear o.handle_ before calling reset to capture the case where + // handle_->member == o. In this case, calling handle_->Unref first would + // delete o.handle_ so we clear it out first. + reset(o.detach(), /*add_ref=*/false); + } + return *this; + } + bool operator==(const IntrusivePtr& o) const { return handle_ == o.handle_; } + T* operator->() const { return handle_; } + T& operator*() const { return *handle_; } + explicit operator bool() const noexcept { return get(); } + T* get() const { return handle_; } + // Releases ownership of the pointer without unreffing. Caller is responsible + // for calling Unref on the returned pointer. + T* detach() { + T* handle = handle_; + handle_ = nullptr; + return handle; + } + + ~IntrusivePtr() { + if (handle_) handle_->Unref(); + } + + private: + T* handle_ = nullptr; +}; + +} // namespace core +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_INTRUSIVE_PTR_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform.h new file mode 100644 index 0000000000000000000000000000000000000000..aca7a8141bc11bca1f79beb65b8a52c1c555f50f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform.h @@ -0,0 +1,87 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PLATFORM_H_ +#define TENSORFLOW_TSL_PLATFORM_PLATFORM_H_ + +// Set one PLATFORM_* macro and set IS_MOBILE_PLATFORM if the platform is for +// mobile. + +#if !defined(PLATFORM_POSIX) && !defined(PLATFORM_GOOGLE) && \ + !defined(PLATFORM_POSIX_ANDROID) && !defined(PLATFORM_GOOGLE_ANDROID) && \ + !defined(PLATFORM_WINDOWS) + +// Choose which platform we are on. +#if defined(ANDROID) || defined(__ANDROID__) +#define PLATFORM_POSIX_ANDROID +#define IS_MOBILE_PLATFORM + +#elif defined(__APPLE__) +#include "TargetConditionals.h" +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#define PLATFORM_POSIX_IOS +#define IS_MOBILE_PLATFORM +#else +// If no platform specified, use: +#define PLATFORM_POSIX +#endif + +#elif defined(_WIN32) +#define PLATFORM_WINDOWS + +#elif defined(__EMSCRIPTEN__) +#define PLATFORM_PORTABLE_GOOGLE +#define PLATFORM_POSIX +// EMSCRIPTEN builds are considered "mobile" for the sake of portability. +#define IS_MOBILE_PLATFORM + +#elif defined(__TF_CHROMIUMOS__) +#define PLATFORM_PORTABLE_GOOGLE +#define PLATFORM_POSIX +#define PLATFORM_CHROMIUMOS + +#elif defined(__Fuchsia__) +#define PLATFORM_FUCHSIA +// PLATFORM_GOOGLE needs to be defined by default to get the right header +// files. +#define PLATFORM_GOOGLE + +#else +// If no platform specified, use: +#define PLATFORM_POSIX + +#endif +#endif + +// Look for both gcc/clang and Visual Studio macros indicating we're compiling +// for an x86 device. +#if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \ + defined(_M_X64) +#define PLATFORM_IS_X86 +#endif + +// Check if we are compmiling for an arm device. +#if defined(__arm__) || defined(__aarch64__) +#define PLATFORM_IS_ARM +#if defined(__aarch64__) +#define PLATFORM_IS_ARM64 +#else +#define PLATFORM_IS_ARM32 +#endif +#endif + +#define TSL_IS_IN_OSS 1 + +#endif // TENSORFLOW_TSL_PLATFORM_PLATFORM_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform_strings_computed.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform_strings_computed.h new file mode 100644 index 0000000000000000000000000000000000000000..6938fca75a1435c341d26f0b4acbfc793d7640fb --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/platform_strings_computed.h @@ -0,0 +1,735 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// Generated from platform_strings.h. + +#ifndef TENSORFLOW_TSL_PLATFORM_PLATFORM_STRINGS_COMPUTED_H_ +#define TENSORFLOW_TSL_PLATFORM_PLATFORM_STRINGS_COMPUTED_H_ + +#if defined(_M_IX86_FP) +#define TF_PLAT_STR__M_IX86_FP TF_PLAT_STR_(_M_IX86_FP) +#else +#define TF_PLAT_STR__M_IX86_FP +#endif +#if defined(_NO_PREFETCHW) +#define TF_PLAT_STR__NO_PREFETCHW TF_PLAT_STR_(_NO_PREFETCHW) +#else +#define TF_PLAT_STR__NO_PREFETCHW +#endif +#if defined(__3dNOW_A__) +#define TF_PLAT_STR___3dNOW_A__ TF_PLAT_STR_(__3dNOW_A__) +#else +#define TF_PLAT_STR___3dNOW_A__ +#endif +#if defined(__3dNOW__) +#define TF_PLAT_STR___3dNOW__ TF_PLAT_STR_(__3dNOW__) +#else +#define TF_PLAT_STR___3dNOW__ +#endif +#if defined(__ABM__) +#define TF_PLAT_STR___ABM__ TF_PLAT_STR_(__ABM__) +#else +#define TF_PLAT_STR___ABM__ +#endif +#if defined(__ADX__) +#define TF_PLAT_STR___ADX__ TF_PLAT_STR_(__ADX__) +#else +#define TF_PLAT_STR___ADX__ +#endif +#if defined(__AES__) +#define TF_PLAT_STR___AES__ TF_PLAT_STR_(__AES__) +#else +#define TF_PLAT_STR___AES__ +#endif +#if defined(__AVX2__) +#define TF_PLAT_STR___AVX2__ TF_PLAT_STR_(__AVX2__) +#else +#define TF_PLAT_STR___AVX2__ +#endif +#if defined(__AVX512BW__) +#define TF_PLAT_STR___AVX512BW__ TF_PLAT_STR_(__AVX512BW__) +#else +#define TF_PLAT_STR___AVX512BW__ +#endif +#if defined(__AVX512CD__) +#define TF_PLAT_STR___AVX512CD__ TF_PLAT_STR_(__AVX512CD__) +#else +#define TF_PLAT_STR___AVX512CD__ +#endif +#if defined(__AVX512DQ__) +#define TF_PLAT_STR___AVX512DQ__ TF_PLAT_STR_(__AVX512DQ__) +#else +#define TF_PLAT_STR___AVX512DQ__ +#endif +#if defined(__AVX512ER__) +#define TF_PLAT_STR___AVX512ER__ TF_PLAT_STR_(__AVX512ER__) +#else +#define TF_PLAT_STR___AVX512ER__ +#endif +#if defined(__AVX512F__) +#define TF_PLAT_STR___AVX512F__ TF_PLAT_STR_(__AVX512F__) +#else +#define TF_PLAT_STR___AVX512F__ +#endif +#if defined(__AVX512IFMA__) +#define TF_PLAT_STR___AVX512IFMA__ TF_PLAT_STR_(__AVX512IFMA__) +#else +#define TF_PLAT_STR___AVX512IFMA__ +#endif +#if defined(__AVX512PF__) +#define TF_PLAT_STR___AVX512PF__ TF_PLAT_STR_(__AVX512PF__) +#else +#define TF_PLAT_STR___AVX512PF__ +#endif +#if defined(__AVX512VBMI__) +#define TF_PLAT_STR___AVX512VBMI__ TF_PLAT_STR_(__AVX512VBMI__) +#else +#define TF_PLAT_STR___AVX512VBMI__ +#endif +#if defined(__AVX512VL__) +#define TF_PLAT_STR___AVX512VL__ TF_PLAT_STR_(__AVX512VL__) +#else +#define TF_PLAT_STR___AVX512VL__ +#endif +#if defined(__AVX__) +#define TF_PLAT_STR___AVX__ TF_PLAT_STR_(__AVX__) +#else +#define TF_PLAT_STR___AVX__ +#endif +#if defined(__BMI2__) +#define TF_PLAT_STR___BMI2__ TF_PLAT_STR_(__BMI2__) +#else +#define TF_PLAT_STR___BMI2__ +#endif +#if defined(__BMI__) +#define TF_PLAT_STR___BMI__ TF_PLAT_STR_(__BMI__) +#else +#define TF_PLAT_STR___BMI__ +#endif +#if defined(__CLFLUSHOPT__) +#define TF_PLAT_STR___CLFLUSHOPT__ TF_PLAT_STR_(__CLFLUSHOPT__) +#else +#define TF_PLAT_STR___CLFLUSHOPT__ +#endif +#if defined(__CLZERO__) +#define TF_PLAT_STR___CLZERO__ TF_PLAT_STR_(__CLZERO__) +#else +#define TF_PLAT_STR___CLZERO__ +#endif +#if defined(__F16C__) +#define TF_PLAT_STR___F16C__ TF_PLAT_STR_(__F16C__) +#else +#define TF_PLAT_STR___F16C__ +#endif +#if defined(__FMA4__) +#define TF_PLAT_STR___FMA4__ TF_PLAT_STR_(__FMA4__) +#else +#define TF_PLAT_STR___FMA4__ +#endif +#if defined(__FMA__) +#define TF_PLAT_STR___FMA__ TF_PLAT_STR_(__FMA__) +#else +#define TF_PLAT_STR___FMA__ +#endif +#if defined(__FP_FAST_FMA) +#define TF_PLAT_STR___FP_FAST_FMA TF_PLAT_STR_(__FP_FAST_FMA) +#else +#define TF_PLAT_STR___FP_FAST_FMA +#endif +#if defined(__FP_FAST_FMAF) +#define TF_PLAT_STR___FP_FAST_FMAF TF_PLAT_STR_(__FP_FAST_FMAF) +#else +#define TF_PLAT_STR___FP_FAST_FMAF +#endif +#if defined(__FSGSBASE__) +#define TF_PLAT_STR___FSGSBASE__ TF_PLAT_STR_(__FSGSBASE__) +#else +#define TF_PLAT_STR___FSGSBASE__ +#endif +#if defined(__FXSR__) +#define TF_PLAT_STR___FXSR__ TF_PLAT_STR_(__FXSR__) +#else +#define TF_PLAT_STR___FXSR__ +#endif +#if defined(__LWP__) +#define TF_PLAT_STR___LWP__ TF_PLAT_STR_(__LWP__) +#else +#define TF_PLAT_STR___LWP__ +#endif +#if defined(__LZCNT__) +#define TF_PLAT_STR___LZCNT__ TF_PLAT_STR_(__LZCNT__) +#else +#define TF_PLAT_STR___LZCNT__ +#endif +#if defined(__MMX__) +#define TF_PLAT_STR___MMX__ TF_PLAT_STR_(__MMX__) +#else +#define TF_PLAT_STR___MMX__ +#endif +#if defined(__MWAITX__) +#define TF_PLAT_STR___MWAITX__ TF_PLAT_STR_(__MWAITX__) +#else +#define TF_PLAT_STR___MWAITX__ +#endif +#if defined(__PCLMUL__) +#define TF_PLAT_STR___PCLMUL__ TF_PLAT_STR_(__PCLMUL__) +#else +#define TF_PLAT_STR___PCLMUL__ +#endif +#if defined(__PKU__) +#define TF_PLAT_STR___PKU__ TF_PLAT_STR_(__PKU__) +#else +#define TF_PLAT_STR___PKU__ +#endif +#if defined(__POPCNT__) +#define TF_PLAT_STR___POPCNT__ TF_PLAT_STR_(__POPCNT__) +#else +#define TF_PLAT_STR___POPCNT__ +#endif +#if defined(__PRFCHW__) +#define TF_PLAT_STR___PRFCHW__ TF_PLAT_STR_(__PRFCHW__) +#else +#define TF_PLAT_STR___PRFCHW__ +#endif +#if defined(__RDRND__) +#define TF_PLAT_STR___RDRND__ TF_PLAT_STR_(__RDRND__) +#else +#define TF_PLAT_STR___RDRND__ +#endif +#if defined(__RDSEED__) +#define TF_PLAT_STR___RDSEED__ TF_PLAT_STR_(__RDSEED__) +#else +#define TF_PLAT_STR___RDSEED__ +#endif +#if defined(__RTM__) +#define TF_PLAT_STR___RTM__ TF_PLAT_STR_(__RTM__) +#else +#define TF_PLAT_STR___RTM__ +#endif +#if defined(__SHA__) +#define TF_PLAT_STR___SHA__ TF_PLAT_STR_(__SHA__) +#else +#define TF_PLAT_STR___SHA__ +#endif +#if defined(__SSE2_MATH__) +#define TF_PLAT_STR___SSE2_MATH__ TF_PLAT_STR_(__SSE2_MATH__) +#else +#define TF_PLAT_STR___SSE2_MATH__ +#endif +#if defined(__SSE2__) +#define TF_PLAT_STR___SSE2__ TF_PLAT_STR_(__SSE2__) +#else +#define TF_PLAT_STR___SSE2__ +#endif +#if defined(__SSE_MATH__) +#define TF_PLAT_STR___SSE_MATH__ TF_PLAT_STR_(__SSE_MATH__) +#else +#define TF_PLAT_STR___SSE_MATH__ +#endif +#if defined(__SSE__) +#define TF_PLAT_STR___SSE__ TF_PLAT_STR_(__SSE__) +#else +#define TF_PLAT_STR___SSE__ +#endif +#if defined(__SSE3__) +#define TF_PLAT_STR___SSE3__ TF_PLAT_STR_(__SSE3__) +#else +#define TF_PLAT_STR___SSE3__ +#endif +#if defined(__SSE4A__) +#define TF_PLAT_STR___SSE4A__ TF_PLAT_STR_(__SSE4A__) +#else +#define TF_PLAT_STR___SSE4A__ +#endif +#if defined(__SSE4_1__) +#define TF_PLAT_STR___SSE4_1__ TF_PLAT_STR_(__SSE4_1__) +#else +#define TF_PLAT_STR___SSE4_1__ +#endif +#if defined(__SSE4_2__) +#define TF_PLAT_STR___SSE4_2__ TF_PLAT_STR_(__SSE4_2__) +#else +#define TF_PLAT_STR___SSE4_2__ +#endif +#if defined(__SSSE3__) +#define TF_PLAT_STR___SSSE3__ TF_PLAT_STR_(__SSSE3__) +#else +#define TF_PLAT_STR___SSSE3__ +#endif +#if defined(__TBM__) +#define TF_PLAT_STR___TBM__ TF_PLAT_STR_(__TBM__) +#else +#define TF_PLAT_STR___TBM__ +#endif +#if defined(__XOP__) +#define TF_PLAT_STR___XOP__ TF_PLAT_STR_(__XOP__) +#else +#define TF_PLAT_STR___XOP__ +#endif +#if defined(__XSAVEC__) +#define TF_PLAT_STR___XSAVEC__ TF_PLAT_STR_(__XSAVEC__) +#else +#define TF_PLAT_STR___XSAVEC__ +#endif +#if defined(__XSAVEOPT__) +#define TF_PLAT_STR___XSAVEOPT__ TF_PLAT_STR_(__XSAVEOPT__) +#else +#define TF_PLAT_STR___XSAVEOPT__ +#endif +#if defined(__XSAVES__) +#define TF_PLAT_STR___XSAVES__ TF_PLAT_STR_(__XSAVES__) +#else +#define TF_PLAT_STR___XSAVES__ +#endif +#if defined(__XSAVE__) +#define TF_PLAT_STR___XSAVE__ TF_PLAT_STR_(__XSAVE__) +#else +#define TF_PLAT_STR___XSAVE__ +#endif +#if defined(_SOFT_DOUBLE) +#define TF_PLAT_STR__SOFT_DOUBLE TF_PLAT_STR_(_SOFT_DOUBLE) +#else +#define TF_PLAT_STR__SOFT_DOUBLE +#endif +#if defined(_SOFT_FLOAT) +#define TF_PLAT_STR__SOFT_FLOAT TF_PLAT_STR_(_SOFT_FLOAT) +#else +#define TF_PLAT_STR__SOFT_FLOAT +#endif +#if defined(__ALTIVEC__) +#define TF_PLAT_STR___ALTIVEC__ TF_PLAT_STR_(__ALTIVEC__) +#else +#define TF_PLAT_STR___ALTIVEC__ +#endif +#if defined(__APPLE_ALTIVEC__) +#define TF_PLAT_STR___APPLE_ALTIVEC__ TF_PLAT_STR_(__APPLE_ALTIVEC__) +#else +#define TF_PLAT_STR___APPLE_ALTIVEC__ +#endif +#if defined(__CRYPTO__) +#define TF_PLAT_STR___CRYPTO__ TF_PLAT_STR_(__CRYPTO__) +#else +#define TF_PLAT_STR___CRYPTO__ +#endif +#if defined(__FLOAT128_HARDWARE__) +#define TF_PLAT_STR___FLOAT128_HARDWARE__ TF_PLAT_STR_(__FLOAT128_HARDWARE__) +#else +#define TF_PLAT_STR___FLOAT128_HARDWARE__ +#endif +#if defined(__FLOAT128_TYPE__) +#define TF_PLAT_STR___FLOAT128_TYPE__ TF_PLAT_STR_(__FLOAT128_TYPE__) +#else +#define TF_PLAT_STR___FLOAT128_TYPE__ +#endif +#if defined(__FP_FAST_FMA) +#define TF_PLAT_STR___FP_FAST_FMA TF_PLAT_STR_(__FP_FAST_FMA) +#else +#define TF_PLAT_STR___FP_FAST_FMA +#endif +#if defined(__FP_FAST_FMAF) +#define TF_PLAT_STR___FP_FAST_FMAF TF_PLAT_STR_(__FP_FAST_FMAF) +#else +#define TF_PLAT_STR___FP_FAST_FMAF +#endif +#if defined(__HTM__) +#define TF_PLAT_STR___HTM__ TF_PLAT_STR_(__HTM__) +#else +#define TF_PLAT_STR___HTM__ +#endif +#if defined(__NO_FPRS__) +#define TF_PLAT_STR___NO_FPRS__ TF_PLAT_STR_(__NO_FPRS__) +#else +#define TF_PLAT_STR___NO_FPRS__ +#endif +#if defined(__NO_LWSYNC__) +#define TF_PLAT_STR___NO_LWSYNC__ TF_PLAT_STR_(__NO_LWSYNC__) +#else +#define TF_PLAT_STR___NO_LWSYNC__ +#endif +#if defined(__POWER8_VECTOR__) +#define TF_PLAT_STR___POWER8_VECTOR__ TF_PLAT_STR_(__POWER8_VECTOR__) +#else +#define TF_PLAT_STR___POWER8_VECTOR__ +#endif +#if defined(__POWER9_VECTOR__) +#define TF_PLAT_STR___POWER9_VECTOR__ TF_PLAT_STR_(__POWER9_VECTOR__) +#else +#define TF_PLAT_STR___POWER9_VECTOR__ +#endif +#if defined(__PPC405__) +#define TF_PLAT_STR___PPC405__ TF_PLAT_STR_(__PPC405__) +#else +#define TF_PLAT_STR___PPC405__ +#endif +#if defined(__QUAD_MEMORY_ATOMIC__) +#define TF_PLAT_STR___QUAD_MEMORY_ATOMIC__ TF_PLAT_STR_(__QUAD_MEMORY_ATOMIC__) +#else +#define TF_PLAT_STR___QUAD_MEMORY_ATOMIC__ +#endif +#if defined(__RECIPF__) +#define TF_PLAT_STR___RECIPF__ TF_PLAT_STR_(__RECIPF__) +#else +#define TF_PLAT_STR___RECIPF__ +#endif +#if defined(__RECIP_PRECISION__) +#define TF_PLAT_STR___RECIP_PRECISION__ TF_PLAT_STR_(__RECIP_PRECISION__) +#else +#define TF_PLAT_STR___RECIP_PRECISION__ +#endif +#if defined(__RECIP__) +#define TF_PLAT_STR___RECIP__ TF_PLAT_STR_(__RECIP__) +#else +#define TF_PLAT_STR___RECIP__ +#endif +#if defined(__RSQRTEF__) +#define TF_PLAT_STR___RSQRTEF__ TF_PLAT_STR_(__RSQRTEF__) +#else +#define TF_PLAT_STR___RSQRTEF__ +#endif +#if defined(__RSQRTE__) +#define TF_PLAT_STR___RSQRTE__ TF_PLAT_STR_(__RSQRTE__) +#else +#define TF_PLAT_STR___RSQRTE__ +#endif +#if defined(__TM_FENCE__) +#define TF_PLAT_STR___TM_FENCE__ TF_PLAT_STR_(__TM_FENCE__) +#else +#define TF_PLAT_STR___TM_FENCE__ +#endif +#if defined(__UPPER_REGS_DF__) +#define TF_PLAT_STR___UPPER_REGS_DF__ TF_PLAT_STR_(__UPPER_REGS_DF__) +#else +#define TF_PLAT_STR___UPPER_REGS_DF__ +#endif +#if defined(__UPPER_REGS_SF__) +#define TF_PLAT_STR___UPPER_REGS_SF__ TF_PLAT_STR_(__UPPER_REGS_SF__) +#else +#define TF_PLAT_STR___UPPER_REGS_SF__ +#endif +#if defined(__VEC__) +#define TF_PLAT_STR___VEC__ TF_PLAT_STR_(__VEC__) +#else +#define TF_PLAT_STR___VEC__ +#endif +#if defined(__VSX__) +#define TF_PLAT_STR___VSX__ TF_PLAT_STR_(__VSX__) +#else +#define TF_PLAT_STR___VSX__ +#endif +#if defined(__ARM_ARCH) +#define TF_PLAT_STR___ARM_ARCH TF_PLAT_STR_(__ARM_ARCH) +#else +#define TF_PLAT_STR___ARM_ARCH +#endif +#if defined(__ARM_FEATURE_CLZ) +#define TF_PLAT_STR___ARM_FEATURE_CLZ TF_PLAT_STR_(__ARM_FEATURE_CLZ) +#else +#define TF_PLAT_STR___ARM_FEATURE_CLZ +#endif +#if defined(__ARM_FEATURE_CRC32) +#define TF_PLAT_STR___ARM_FEATURE_CRC32 TF_PLAT_STR_(__ARM_FEATURE_CRC32) +#else +#define TF_PLAT_STR___ARM_FEATURE_CRC32 +#endif +#if defined(__ARM_FEATURE_CRC32) +#define TF_PLAT_STR___ARM_FEATURE_CRC32 TF_PLAT_STR_(__ARM_FEATURE_CRC32) +#else +#define TF_PLAT_STR___ARM_FEATURE_CRC32 +#endif +#if defined(__ARM_FEATURE_CRYPTO) +#define TF_PLAT_STR___ARM_FEATURE_CRYPTO TF_PLAT_STR_(__ARM_FEATURE_CRYPTO) +#else +#define TF_PLAT_STR___ARM_FEATURE_CRYPTO +#endif +#if defined(__ARM_FEATURE_DIRECTED_ROUNDING) +#define TF_PLAT_STR___ARM_FEATURE_DIRECTED_ROUNDING \ + TF_PLAT_STR_(__ARM_FEATURE_DIRECTED_ROUNDING) +#else +#define TF_PLAT_STR___ARM_FEATURE_DIRECTED_ROUNDING +#endif +#if defined(__ARM_FEATURE_DSP) +#define TF_PLAT_STR___ARM_FEATURE_DSP TF_PLAT_STR_(__ARM_FEATURE_DSP) +#else +#define TF_PLAT_STR___ARM_FEATURE_DSP +#endif +#if defined(__ARM_FEATURE_FMA) +#define TF_PLAT_STR___ARM_FEATURE_FMA TF_PLAT_STR_(__ARM_FEATURE_FMA) +#else +#define TF_PLAT_STR___ARM_FEATURE_FMA +#endif +#if defined(__ARM_FEATURE_IDIV) +#define TF_PLAT_STR___ARM_FEATURE_IDIV TF_PLAT_STR_(__ARM_FEATURE_IDIV) +#else +#define TF_PLAT_STR___ARM_FEATURE_IDIV +#endif +#if defined(__ARM_FEATURE_LDREX) +#define TF_PLAT_STR___ARM_FEATURE_LDREX TF_PLAT_STR_(__ARM_FEATURE_LDREX) +#else +#define TF_PLAT_STR___ARM_FEATURE_LDREX +#endif +#if defined(__ARM_FEATURE_NUMERIC_MAXMIN) +#define TF_PLAT_STR___ARM_FEATURE_NUMERIC_MAXMIN \ + TF_PLAT_STR_(__ARM_FEATURE_NUMERIC_MAXMIN) +#else +#define TF_PLAT_STR___ARM_FEATURE_NUMERIC_MAXMIN +#endif +#if defined(__ARM_FEATURE_QBIT) +#define TF_PLAT_STR___ARM_FEATURE_QBIT TF_PLAT_STR_(__ARM_FEATURE_QBIT) +#else +#define TF_PLAT_STR___ARM_FEATURE_QBIT +#endif +#if defined(__ARM_FEATURE_QRDMX) +#define TF_PLAT_STR___ARM_FEATURE_QRDMX TF_PLAT_STR_(__ARM_FEATURE_QRDMX) +#else +#define TF_PLAT_STR___ARM_FEATURE_QRDMX +#endif +#if defined(__ARM_FEATURE_SAT) +#define TF_PLAT_STR___ARM_FEATURE_SAT TF_PLAT_STR_(__ARM_FEATURE_SAT) +#else +#define TF_PLAT_STR___ARM_FEATURE_SAT +#endif +#if defined(__ARM_FEATURE_SIMD32) +#define TF_PLAT_STR___ARM_FEATURE_SIMD32 TF_PLAT_STR_(__ARM_FEATURE_SIMD32) +#else +#define TF_PLAT_STR___ARM_FEATURE_SIMD32 +#endif +#if defined(__ARM_FEATURE_UNALIGNED) +#define TF_PLAT_STR___ARM_FEATURE_UNALIGNED \ + TF_PLAT_STR_(__ARM_FEATURE_UNALIGNED) +#else +#define TF_PLAT_STR___ARM_FEATURE_UNALIGNED +#endif +#if defined(__ARM_FP) +#define TF_PLAT_STR___ARM_FP TF_PLAT_STR_(__ARM_FP) +#else +#define TF_PLAT_STR___ARM_FP +#endif +#if defined(__ARM_NEON_FP) +#define TF_PLAT_STR___ARM_NEON_FP TF_PLAT_STR_(__ARM_NEON_FP) +#else +#define TF_PLAT_STR___ARM_NEON_FP +#endif +#if defined(__ARM_NEON__) +#define TF_PLAT_STR___ARM_NEON__ TF_PLAT_STR_(__ARM_NEON__) +#else +#define TF_PLAT_STR___ARM_NEON__ +#endif +#if defined(__ARM_WMMX) +#define TF_PLAT_STR___ARM_WMMX TF_PLAT_STR_(__ARM_WMMX) +#else +#define TF_PLAT_STR___ARM_WMMX +#endif +#if defined(__IWMMXT2__) +#define TF_PLAT_STR___IWMMXT2__ TF_PLAT_STR_(__IWMMXT2__) +#else +#define TF_PLAT_STR___IWMMXT2__ +#endif +#if defined(__IWMMXT__) +#define TF_PLAT_STR___IWMMXT__ TF_PLAT_STR_(__IWMMXT__) +#else +#define TF_PLAT_STR___IWMMXT__ +#endif +#if defined(__VFP_FP__) +#define TF_PLAT_STR___VFP_FP__ TF_PLAT_STR_(__VFP_FP__) +#else +#define TF_PLAT_STR___VFP_FP__ +#endif +#if defined(TARGET_IPHONE_SIMULATOR) +#define TF_PLAT_STR_TARGET_IPHONE_SIMULATOR \ + TF_PLAT_STR_(TARGET_IPHONE_SIMULATOR) +#else +#define TF_PLAT_STR_TARGET_IPHONE_SIMULATOR +#endif +#if defined(TARGET_OS_IOS) +#define TF_PLAT_STR_TARGET_OS_IOS TF_PLAT_STR_(TARGET_OS_IOS) +#else +#define TF_PLAT_STR_TARGET_OS_IOS +#endif +#if defined(TARGET_OS_IPHONE) +#define TF_PLAT_STR_TARGET_OS_IPHONE TF_PLAT_STR_(TARGET_OS_IPHONE) +#else +#define TF_PLAT_STR_TARGET_OS_IPHONE +#endif +#if defined(_MSC_VER) +#define TF_PLAT_STR__MSC_VER TF_PLAT_STR_(_MSC_VER) +#else +#define TF_PLAT_STR__MSC_VER +#endif +#if defined(_M_ARM) +#define TF_PLAT_STR__M_ARM TF_PLAT_STR_(_M_ARM) +#else +#define TF_PLAT_STR__M_ARM +#endif +#if defined(_M_ARM64) +#define TF_PLAT_STR__M_ARM64 TF_PLAT_STR_(_M_ARM64) +#else +#define TF_PLAT_STR__M_ARM64 +#endif +#if defined(_M_ARM_ARMV7VE) +#define TF_PLAT_STR__M_ARM_ARMV7VE TF_PLAT_STR_(_M_ARM_ARMV7VE) +#else +#define TF_PLAT_STR__M_ARM_ARMV7VE +#endif +#if defined(_M_ARM_FP) +#define TF_PLAT_STR__M_ARM_FP TF_PLAT_STR_(_M_ARM_FP) +#else +#define TF_PLAT_STR__M_ARM_FP +#endif +#if defined(_M_IX86) +#define TF_PLAT_STR__M_IX86 TF_PLAT_STR_(_M_IX86) +#else +#define TF_PLAT_STR__M_IX86 +#endif +#if defined(_M_X64) +#define TF_PLAT_STR__M_X64 TF_PLAT_STR_(_M_X64) +#else +#define TF_PLAT_STR__M_X64 +#endif +#if defined(_WIN32) +#define TF_PLAT_STR__WIN32 TF_PLAT_STR_(_WIN32) +#else +#define TF_PLAT_STR__WIN32 +#endif +#if defined(_WIN64) +#define TF_PLAT_STR__WIN64 TF_PLAT_STR_(_WIN64) +#else +#define TF_PLAT_STR__WIN64 +#endif +#if defined(__ANDROID__) +#define TF_PLAT_STR___ANDROID__ TF_PLAT_STR_(__ANDROID__) +#else +#define TF_PLAT_STR___ANDROID__ +#endif +#if defined(__APPLE__) +#define TF_PLAT_STR___APPLE__ TF_PLAT_STR_(__APPLE__) +#else +#define TF_PLAT_STR___APPLE__ +#endif +#if defined(__BYTE_ORDER__) +#define TF_PLAT_STR___BYTE_ORDER__ TF_PLAT_STR_(__BYTE_ORDER__) +#else +#define TF_PLAT_STR___BYTE_ORDER__ +#endif +#if defined(__CYGWIN__) +#define TF_PLAT_STR___CYGWIN__ TF_PLAT_STR_(__CYGWIN__) +#else +#define TF_PLAT_STR___CYGWIN__ +#endif +#if defined(__FreeBSD__) +#define TF_PLAT_STR___FreeBSD__ TF_PLAT_STR_(__FreeBSD__) +#else +#define TF_PLAT_STR___FreeBSD__ +#endif +#if defined(__LITTLE_ENDIAN__) +#define TF_PLAT_STR___LITTLE_ENDIAN__ TF_PLAT_STR_(__LITTLE_ENDIAN__) +#else +#define TF_PLAT_STR___LITTLE_ENDIAN__ +#endif +#if defined(__NetBSD__) +#define TF_PLAT_STR___NetBSD__ TF_PLAT_STR_(__NetBSD__) +#else +#define TF_PLAT_STR___NetBSD__ +#endif +#if defined(__OpenBSD__) +#define TF_PLAT_STR___OpenBSD__ TF_PLAT_STR_(__OpenBSD__) +#else +#define TF_PLAT_STR___OpenBSD__ +#endif +#if defined(____MSYS__) +#define TF_PLAT_STR_____MSYS__ TF_PLAT_STR_(____MSYS__) +#else +#define TF_PLAT_STR_____MSYS__ +#endif +#if defined(__aarch64__) +#define TF_PLAT_STR___aarch64__ TF_PLAT_STR_(__aarch64__) +#else +#define TF_PLAT_STR___aarch64__ +#endif +#if defined(__alpha__) +#define TF_PLAT_STR___alpha__ TF_PLAT_STR_(__alpha__) +#else +#define TF_PLAT_STR___alpha__ +#endif +#if defined(__arm__) +#define TF_PLAT_STR___arm__ TF_PLAT_STR_(__arm__) +#else +#define TF_PLAT_STR___arm__ +#endif +#if defined(__i386__) +#define TF_PLAT_STR___i386__ TF_PLAT_STR_(__i386__) +#else +#define TF_PLAT_STR___i386__ +#endif +#if defined(__i686__) +#define TF_PLAT_STR___i686__ TF_PLAT_STR_(__i686__) +#else +#define TF_PLAT_STR___i686__ +#endif +#if defined(__ia64__) +#define TF_PLAT_STR___ia64__ TF_PLAT_STR_(__ia64__) +#else +#define TF_PLAT_STR___ia64__ +#endif +#if defined(__linux__) +#define TF_PLAT_STR___linux__ TF_PLAT_STR_(__linux__) +#else +#define TF_PLAT_STR___linux__ +#endif +#if defined(__mips32__) +#define TF_PLAT_STR___mips32__ TF_PLAT_STR_(__mips32__) +#else +#define TF_PLAT_STR___mips32__ +#endif +#if defined(__mips64__) +#define TF_PLAT_STR___mips64__ TF_PLAT_STR_(__mips64__) +#else +#define TF_PLAT_STR___mips64__ +#endif +#if defined(__powerpc64__) +#define TF_PLAT_STR___powerpc64__ TF_PLAT_STR_(__powerpc64__) +#else +#define TF_PLAT_STR___powerpc64__ +#endif +#if defined(__powerpc__) +#define TF_PLAT_STR___powerpc__ TF_PLAT_STR_(__powerpc__) +#else +#define TF_PLAT_STR___powerpc__ +#endif +#if defined(__riscv___) +#define TF_PLAT_STR___riscv___ TF_PLAT_STR_(__riscv___) +#else +#define TF_PLAT_STR___riscv___ +#endif +#if defined(__s390x__) +#define TF_PLAT_STR___s390x__ TF_PLAT_STR_(__s390x__) +#else +#define TF_PLAT_STR___s390x__ +#endif +#if defined(__sparc64__) +#define TF_PLAT_STR___sparc64__ TF_PLAT_STR_(__sparc64__) +#else +#define TF_PLAT_STR___sparc64__ +#endif +#if defined(__sparc__) +#define TF_PLAT_STR___sparc__ TF_PLAT_STR_(__sparc__) +#else +#define TF_PLAT_STR___sparc__ +#endif +#if defined(__x86_64__) +#define TF_PLAT_STR___x86_64__ TF_PLAT_STR_(__x86_64__) +#else +#define TF_PLAT_STR___x86_64__ +#endif + +#endif // TENSORFLOW_TSL_PLATFORM_PLATFORM_STRINGS_COMPUTED_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/png.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/png.h new file mode 100644 index 0000000000000000000000000000000000000000..c66e88a5dcd6afb07c4abc00852a257b9e8573b8 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/png.h @@ -0,0 +1,30 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PNG_H_ +#define TENSORFLOW_TSL_PLATFORM_PNG_H_ + +#include "tsl/platform/platform.h" + +#if defined(PLATFORM_GOOGLE) && !defined(IS_MOBILE_PLATFORM) +#include "png.h" // from @png // IWYU pragma: export +#elif defined(PLATFORM_POSIX) || defined(PLATFORM_WINDOWS) || \ + defined(PLATFORM_POSIX_ANDROID) || defined(IS_MOBILE_PLATFORM) +#include // IWYU pragma: export +#else +#error Define the appropriate PLATFORM_ macro for this platform +#endif + +#endif // TENSORFLOW_TSL_PLATFORM_PNG_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/android_armv7a_cpu_utils_helper.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/android_armv7a_cpu_utils_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..b178af8f8648d0659ce58a21c55426493ae1af57 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/android_armv7a_cpu_utils_helper.h @@ -0,0 +1,69 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_ANDROID_ARMV7A_CPU_UTILS_HELPER_H_ +#define TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_ANDROID_ARMV7A_CPU_UTILS_HELPER_H_ + +#include + +#include "tsl/platform/macros.h" +#include "tsl/platform/profile_utils/i_cpu_utils_helper.h" +#include "tsl/platform/types.h" + +#if defined(__ANDROID__) && (__ANDROID_API__ >= 21) && \ + (defined(__ARM_ARCH_7A__) || defined(__aarch64__)) + +struct perf_event_attr; + +namespace tsl { +namespace profile_utils { + +// Implementation of CpuUtilsHelper for Android armv7a +class AndroidArmV7ACpuUtilsHelper : public ICpuUtilsHelper { + public: + AndroidArmV7ACpuUtilsHelper() = default; + void ResetClockCycle() final; + uint64 GetCurrentClockCycle() final; + void EnableClockCycleProfiling() final; + void DisableClockCycleProfiling() final; + int64 CalculateCpuFrequency() final; + + private: + static constexpr int INVALID_FD = -1; + static constexpr int64 INVALID_CPU_FREQUENCY = -1; + + void InitializeInternal(); + + // syscall __NR_perf_event_open with arguments + int OpenPerfEvent(perf_event_attr *const hw_event, const pid_t pid, + const int cpu, const int group_fd, + const unsigned long flags); + + int64 ReadCpuFrequencyFile(const int cpu_id, const char *const type); + + bool is_initialized_{false}; + int fd_{INVALID_FD}; + + AndroidArmV7ACpuUtilsHelper(const AndroidArmV7ACpuUtilsHelper &) = delete; + void operator=(const AndroidArmV7ACpuUtilsHelper &) = delete; +}; + +} // namespace profile_utils +} // namespace tsl + +#endif // defined(__ANDROID__) && (__ANDROID_API__ >= 21) && + // (defined(__ARM_ARCH_7A__) || defined(__aarch64__)) + +#endif // TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_ANDROID_ARMV7A_CPU_UTILS_HELPER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/clock_cycle_profiler.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/clock_cycle_profiler.h new file mode 100644 index 0000000000000000000000000000000000000000..364921abc58021b3bf4b45c4b4c9599274d16714 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/clock_cycle_profiler.h @@ -0,0 +1,107 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_ +#define TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_ + +#include + +#include "tsl/platform/logging.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/profile_utils/cpu_utils.h" + +namespace tsl { + +class ClockCycleProfiler { + public: + ClockCycleProfiler() = default; + + // Start counting clock cycle. + inline void Start() { + CHECK(!IsStarted()) << "Profiler has been already started."; + start_clock_ = GetCurrentClockCycleInternal(); + } + + // Stop counting clock cycle. + inline void Stop() { + CHECK(IsStarted()) << "Profiler is not started yet."; + AccumulateClockCycle(); + } + + // Get how many times Start() is called. + inline double GetCount() { + CHECK(!IsStarted()); + return count_; + } + + // Get average clock cycle. + inline double GetAverageClockCycle() { + CHECK(!IsStarted()); + return average_clock_cycle_; + } + + // TODO(satok): Support more statistics (e.g. standard deviation) + // Get worst clock cycle. + inline double GetWorstClockCycle() { + CHECK(!IsStarted()); + return worst_clock_cycle_; + } + + // Dump statistics + void DumpStatistics(const string& tag); + + private: + inline uint64 GetCurrentClockCycleInternal() { + const uint64 clockCycle = profile_utils::CpuUtils::GetCurrentClockCycle(); + if (clockCycle <= 0) { + if (valid_) { + LOG(WARNING) << "GetCurrentClockCycle is not implemented." + << " Return 1 instead."; + valid_ = false; + } + return 1; + } else { + return clockCycle; + } + } + + inline bool IsStarted() const { return start_clock_ > 0; } + + inline void AccumulateClockCycle() { + const uint64 now = GetCurrentClockCycleInternal(); + const double clock_diff = static_cast(now - start_clock_); + const double next_count = count_ + 1.0; + const double next_count_inv = 1.0 / next_count; + const double next_ave_cpu_clock = + next_count_inv * (average_clock_cycle_ * count_ + clock_diff); + count_ = next_count; + average_clock_cycle_ = next_ave_cpu_clock; + worst_clock_cycle_ = std::max(worst_clock_cycle_, clock_diff); + start_clock_ = 0; + } + + uint64 start_clock_{0}; + double count_{0.0}; + double average_clock_cycle_{0.0}; + double worst_clock_cycle_{0.0}; + bool valid_{true}; + + ClockCycleProfiler(const ClockCycleProfiler&) = delete; + void operator=(const ClockCycleProfiler&) = delete; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/cpu_utils.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/cpu_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a6b153cfa37bbfefc102046d930ea988c56ed0ca --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/cpu_utils.h @@ -0,0 +1,193 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// This class is designed to get accurate profile for programs. + +#ifndef TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CPU_UTILS_H_ +#define TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CPU_UTILS_H_ + +#include +#include + +#include "tsl/platform/macros.h" +#include "tsl/platform/profile_utils/i_cpu_utils_helper.h" +#include "tsl/platform/types.h" + +#if defined(ARMV6) || defined(__ARM_ARCH_7A__) +#include +#endif + +#if defined(_WIN32) +#include +#endif + +namespace tsl { + +namespace profile_utils { + +// CpuUtils is a profiling tool with static functions +// designed to be called from multiple classes. +// A dedicated class which inherits ICpuUtilsHelper is +// stored as a function-local static variable which inherits +// GetCpuUtilsHelperSingletonInstance that caches CPU information, +// because loading CPU information may take a long time. +// Users must call EnableClockCycleProfiling before using CpuUtils. +class CpuUtils { + public: + // Constant for invalid frequency. + // This value is returned when the frequency is not obtained somehow. + static constexpr int64_t INVALID_FREQUENCY = -1; + static constexpr uint64 DUMMY_CYCLE_CLOCK = 1; + + // Return current clock cycle. This function is designed to + // minimize the overhead to get clock and maximize the accuracy of + // time for profile. + // This returns unsigned int because there is no guarantee that rdtsc + // is less than 2 ^ 61. + static inline uint64 GetCurrentClockCycle() { +#if defined(__ANDROID__) + return GetCpuUtilsHelperSingletonInstance().GetCurrentClockCycle(); +// ---------------------------------------------------------------- +#elif defined(_WIN32) + return __rdtsc(); +// ---------------------------------------------------------------- +#elif defined(__x86_64__) || defined(__amd64__) + uint64_t high, low; + __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); + return (high << 32) | low; +// ---------------------------------------------------------------- +#elif defined(__aarch64__) + // System timer of ARMv8 runs at a different frequency than the CPU's. + // The frequency is fixed, typically in the range 1-50MHz. It can because + // read at CNTFRQ special register. We assume the OS has set up + // the virtual timer properly. + uint64_t virtual_timer_value; + asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value)); + return virtual_timer_value; +// ---------------------------------------------------------------- +// V6 is the earliest arm that has a standard cyclecount +#elif defined(ARMV6) || defined(__ARM_ARCH_7A__) + uint32_t pmccntr; + uint32_t pmuseren; + uint32_t pmcntenset; + // Read the user mode perf monitor counter access permissions. + asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren)); + if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. + asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset)); + if (pmcntenset & 0x80000000ul) { // Is it counting? + asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr)); + // The counter is set up to count every 64th cyclecount + return static_cast(pmccntr) * 64; // Should optimize to << 64 + } + } + // Returning dummy clock when can't access to the counter + return DUMMY_CYCLE_CLOCK; +#elif defined(__powerpc64__) || defined(__ppc64__) + uint64 __t; + __asm__ __volatile__("mfspr %0,268" : "=r"(__t)); + return __t; + +#elif defined(__powerpc__) || defined(__ppc__) + uint64 upper, lower, tmp; + __asm__ volatile( + "0: \n" + "\tmftbu %0 \n" + "\tmftb %1 \n" + "\tmftbu %2 \n" + "\tcmpw %2,%0 \n" + "\tbne 0b \n" + : "=r"(upper), "=r"(lower), "=r"(tmp)); + return ((static_cast(upper) << 32) | lower); +#elif defined(__s390x__) + // TOD Clock of s390x runs at a different frequency than the CPU's. + // The stepping is 244 picoseconds (~4Ghz). + uint64 t; + __asm__ __volatile__("stckf %0" : "=Q"(t)); + return t; +#else + // TODO(satok): Support generic way to emulate clock count. + // TODO(satok): Support other architectures if wanted. + // Returning dummy clock when can't access to the counter + return DUMMY_CYCLE_CLOCK; +#endif + } + +// Return cycle counter frequency. +// As this method caches the cpu frequency internally, +// the first call will incur overhead, but not subsequent calls. +#if (defined(__powerpc__) || \ + defined(__ppc__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || \ + (defined(__s390x__)) + static uint64 GetCycleCounterFrequency(); +#else + static int64_t GetCycleCounterFrequency(); +#endif + + // Return micro second per each clock + // As this method caches the cpu frequency internally, + // the first call will incur overhead, but not subsequent calls. + static double GetMicroSecPerClock(); + + // Reset clock cycle + // Resetting clock cycle is recommended to prevent + // clock cycle counters from overflowing on some platforms. + static void ResetClockCycle(); + + // Enable/Disable clock cycle profile + // You can enable / disable profile if it's supported by the platform + static void EnableClockCycleProfiling(); + static void DisableClockCycleProfiling(); + + // Return chrono::duration per each clock + static std::chrono::duration ConvertClockCycleToTime( + const int64_t clock_cycle); + + private: + class DefaultCpuUtilsHelper : public ICpuUtilsHelper { + public: + DefaultCpuUtilsHelper() = default; + void ResetClockCycle() final {} + uint64 GetCurrentClockCycle() final { return DUMMY_CYCLE_CLOCK; } + void EnableClockCycleProfiling() final {} + void DisableClockCycleProfiling() final {} + int64_t CalculateCpuFrequency() final { return INVALID_FREQUENCY; } + + private: + DefaultCpuUtilsHelper(const DefaultCpuUtilsHelper&) = delete; + void operator=(const DefaultCpuUtilsHelper&) = delete; + }; + + // Return cpu frequency. + // CAVEAT: as this method calls system call and parse the message, + // this call may be slow. This is why this class caches the value by + // StaticVariableInitializer. + static int64_t GetCycleCounterFrequencyImpl(); + + // Return a singleton of ICpuUtilsHelper + // ICpuUtilsHelper is declared as a function-local static variable + // for the following two reasons: + // 1. Avoid passing instances to all classes which want + // to use profiling tools in CpuUtils + // 2. Minimize the overhead of acquiring ICpuUtilsHelper + static ICpuUtilsHelper& GetCpuUtilsHelperSingletonInstance(); + + CpuUtils(const CpuUtils&) = delete; + void operator=(const CpuUtils&) = delete; +}; + +} // namespace profile_utils + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_CPU_UTILS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/i_cpu_utils_helper.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/i_cpu_utils_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..03b1dd20f497cb825e75f54c648f292acce0122f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/profile_utils/i_cpu_utils_helper.h @@ -0,0 +1,55 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_I_CPU_UTILS_HELPER_H_ +#define TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_I_CPU_UTILS_HELPER_H_ + +#include "tsl/platform/macros.h" +#include "tsl/platform/types.h" + +namespace tsl { +namespace profile_utils { + +// ICpuUtilsHelper is an interface class for cpu_utils which proxies +// the difference of profiling functions of different platforms. +// Overridden functions must be thread safe. +class ICpuUtilsHelper { + public: + ICpuUtilsHelper() = default; + virtual ~ICpuUtilsHelper() = default; + // Reset clock cycle. + // Resetting clock cycle is recommended to prevent + // clock cycle counters from overflowing on some platforms. + virtual void ResetClockCycle() = 0; + // Return current clock cycle. + virtual uint64 GetCurrentClockCycle() = 0; + // Enable/Disable clock cycle profile + // You can enable / disable profile if it's supported by the platform + virtual void EnableClockCycleProfiling() = 0; + virtual void DisableClockCycleProfiling() = 0; + // Return cpu frequency. + // CAVEAT: as this method may read file and/or call system calls, + // this call is supposed to be slow. + virtual int64_t CalculateCpuFrequency() = 0; + + private: + ICpuUtilsHelper(const ICpuUtilsHelper&) = delete; + void operator=(const ICpuUtilsHelper&) = delete; +}; + +} // namespace profile_utils +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_PROFILE_UTILS_I_CPU_UTILS_HELPER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/protobuf_compiler.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/protobuf_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..a796133b841ba9c2cc60d05a8e251c6e532cc205 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/protobuf_compiler.h @@ -0,0 +1,21 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_PROTOBUF_COMPILER_H_ +#define TENSORFLOW_TSL_PLATFORM_PROTOBUF_COMPILER_H_ + +#include "google/protobuf/compiler/importer.h" // IWYU pragma: export + +#endif // TENSORFLOW_TSL_PLATFORM_PROTOBUF_COMPILER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/refcount.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/refcount.h new file mode 100644 index 0000000000000000000000000000000000000000..1b3944bf3e13cfcc1f76e03df4ae4487df8b1bb0 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/refcount.h @@ -0,0 +1,355 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_REFCOUNT_H_ +#define TENSORFLOW_TSL_PLATFORM_REFCOUNT_H_ + +#include +#include +#include + +#include "tsl/platform/logging.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/thread_annotations.h" + +namespace tsl { +namespace core { + +class RefCounted { + public: + // Initial reference count is one. + RefCounted(); + + // Increments reference count by one. + void Ref() const; + + // Decrements reference count by one. If the count remains + // positive, returns false. When the count reaches zero, returns + // true and deletes this, in which case the caller must not access + // the object afterward. + bool Unref() const; + + // Gets the current reference count. + int_fast32_t RefCount() const; + + // Return whether the reference count is one. + // If the reference count is used in the conventional way, a + // reference count of 1 implies that the current thread owns the + // reference and no other thread shares it. + // This call performs the test for a reference count of one, and + // performs the memory barrier needed for the owning thread + // to act on the object, knowing that it has exclusive access to the + // object. + bool RefCountIsOne() const; + + protected: + // Make destructor protected so that RefCounted objects cannot + // be instantiated directly. Only subclasses can be instantiated. + virtual ~RefCounted(); + + // Increments reference count by one if the object is not being destructed. + // This function is used by WeakRefCounted for securely acquiring a + // strong reference. It is only safe to call this as part of the weak + // reference implementation. + bool TryRef() const; + + // Notifies the instance is deleted. This function is used by WeakRefCounted + // for securely propagating the delete notification before the destruction + // sequence starts. + virtual void NotifyDeleted() const; + + private: + mutable std::atomic_int_fast32_t ref_; + + RefCounted(const RefCounted&) = delete; + void operator=(const RefCounted&) = delete; +}; + +// A deleter class to form a std::unique_ptr that unrefs objects. +struct RefCountDeleter { + void operator()(const RefCounted* o) const { o->Unref(); } +}; + +template +class RefCountPtr; + +// Adds a new reference to a RefCounted pointer. +template +ABSL_MUST_USE_RESULT RefCountPtr GetNewRef(T* ptr) { + static_assert(std::is_base_of::value); + + if (ptr == nullptr) return RefCountPtr(); + ptr->Ref(); + RefCountPtr ret(ptr); + return ret; +} + +// A unique_ptr that unrefs the owned object on destruction. +template +class RefCountPtr : public std::unique_ptr { + public: + using std::unique_ptr::unique_ptr; + ABSL_MUST_USE_RESULT RefCountPtr GetNewRef() const { + if (this->get() == nullptr) return RefCountPtr(); + this->get()->Ref(); + return RefCountPtr(this->get()); + } +}; + +// Helper class to unref an object when out-of-scope. +class ScopedUnref { + public: + explicit ScopedUnref(const RefCounted* o) : obj_(o) {} + ~ScopedUnref() { + if (obj_) obj_->Unref(); + } + + private: + const RefCounted* obj_; + + ScopedUnref(const ScopedUnref&) = delete; + void operator=(const ScopedUnref&) = delete; +}; + +// Forward declaration for friend class of WeakRefCounted. +template +class WeakPtr; + +// A WeakNotifyFn is called when the weakly referred object is being destroyed. +// The object may already be destructed when the call occurs. A WeakNotifyFn +// can be passed into WeakPtr at construction. +using WeakNotifyFn = std::function; + +// A base class for RefCounted objects that allow weak references by WeakPtr. +// WeakRefCounted and every WeakPtr to it, each holds a strong reference to a +// WeakRefData. +// +// If the WeakRefCounted is valid, WeakPtr::GetNewRef() returns a new strong +// reference to the WeakRefCounted. +// If the WeakRefCounted is being destructed, `WeakRefCounted::ref_ == 0`; +// if the WeakRefcounted is already destructed,`WeakRefData::ptr == nullptr`. +// In either case, WeakPtr::GetNewRef() returns a nullptr. +class WeakRefCounted : public RefCounted { + public: + int WeakRefCount() const { + // Each weak ref owns one ref to data_, and *this owns the last one. + return data_->RefCount() - 1; + } + + protected: + void NotifyDeleted() const override { data_->Notify(); } + + private: + struct WeakRefData : public RefCounted { + explicit WeakRefData(WeakRefCounted* ptr) : ptr(ptr), next_notifier_id(1) {} + + mutable mutex mu; + WeakRefCounted* ptr TF_GUARDED_BY(mu); + std::map notifiers; + int next_notifier_id; + + // Notifies WeakPtr instances that this object is being destructed. + void Notify() { + mutex_lock ml(mu); + + while (!notifiers.empty()) { + auto iter = notifiers.begin(); + WeakNotifyFn notify_fn = std::move(iter->second); + notifiers.erase(iter); + + mu.unlock(); + notify_fn(); + mu.lock(); + } + ptr = nullptr; + } + + WeakRefCounted* GetNewRef() { + mutex_lock ml(mu); + if (ptr != nullptr && ptr->TryRef()) { + return ptr; + } + return nullptr; + } + + // Inserts notify_fn and returns a non-zero id. + // Returns 0 if insertion fails due to the object is being destroyed. + // 0 is also used by WeakPtr to represent "no notify_fn". + int AddNotifier(WeakNotifyFn notify_fn) { + mutex_lock ml(mu); + if (ptr == nullptr) { + return 0; + } + int notifier_id = next_notifier_id++; + notifiers.emplace(notifier_id, std::move(notify_fn)); + return notifier_id; + } + + int DupNotifier(int notifier_id) { + mutex_lock ml(mu); + auto iter = notifiers.find(notifier_id); + if (iter != notifiers.end()) { + int notifier_id = next_notifier_id++; + notifiers.emplace(notifier_id, iter->second); + return notifier_id; + } + return 0; + } + + void RemoveNotifier(int notifier_id) { + mutex_lock ml(mu); + notifiers.erase(notifier_id); + } + }; + + mutable RefCountPtr data_{new WeakRefData(this)}; + + template + friend class WeakPtr; + // MSVC14 workaround: access permission of a nested class member is not + // treated as an ordinary member in MSVC14. + friend struct WeakRefData; +}; + +// A weak reference to a WeakRefCounted object. Refer to WeakRefCounted. +template +class WeakPtr { + public: + // Creates a weak reference. + // When the object is being destroyed, notify_fn is called. + explicit WeakPtr(WeakRefCounted* ptr = nullptr, + WeakNotifyFn notify_fn = nullptr) + : data_(nullptr), notifier_id_(0) { + if (ptr != nullptr) { + ptr->data_->Ref(); + data_.reset(ptr->data_.get()); + if (notify_fn) { + notifier_id_ = data_->AddNotifier(notify_fn); + } + } + } + + ~WeakPtr() { + if (data_ != nullptr && notifier_id_ != 0) { + data_->RemoveNotifier(notifier_id_); + } + } + + WeakPtr(const WeakPtr& other) { operator=(other); } + + WeakPtr& operator=(const WeakPtr& other) { + if (data_ != nullptr && notifier_id_ != 0) { + data_->RemoveNotifier(notifier_id_); + } + other.data_->Ref(); + data_.reset(other.data_.get()); + notifier_id_ = data_->DupNotifier(other.notifier_id_); + return *this; + } + + WeakPtr(WeakPtr&& other) { + data_ = std::move(other.data_); + notifier_id_ = other.notifier_id_; + other.notifier_id_ = 0; + } + + WeakPtr& operator=(WeakPtr&& other) { + if (this != &other) { + if (data_ != nullptr && notifier_id_ != 0) { + data_->RemoveNotifier(notifier_id_); + } + data_ = std::move(other.data_); + notifier_id_ = other.notifier_id_; + other.notifier_id_ = 0; + } + return *this; + } + + // Returns a new strong reference to the referred object, or nullptr if the + // object is in an invalid state (being destructed or already destructed). + RefCountPtr GetNewRef() const { + RefCountPtr ref; + if (data_ != nullptr) { + WeakRefCounted* ptr = data_->GetNewRef(); + ref.reset(static_cast(ptr)); + } + return std::move(ref); + } + + private: + RefCountPtr data_; + int notifier_id_; +}; + +// Inlined routines, since these are performance critical +inline RefCounted::RefCounted() : ref_(1) {} + +inline RefCounted::~RefCounted() { + // A destructing object has ref_ == 0. + // It is a bug if the object is resurrected (ref_ > 0) before delete is + // called by Unref(). + DCHECK_EQ(ref_.load(), 0); +} + +inline void RefCounted::Ref() const { + // Ref() uses relaxed order because it is never called with old_ref == 0. + // When old_ref >= 1, no actions depend on the new value of ref. + int_fast32_t old_ref = ref_.fetch_add(1, std::memory_order_relaxed); + DCHECK_GT(old_ref, 0); +} + +inline bool RefCounted::TryRef() const { + // This is not on a hot path. + // Be conservative and use seq_cst to prevent racing with Unref() when + // old_ref == 0, as done in LLVM libstdc++. + int_fast32_t old_ref = ref_.load(); + while (old_ref != 0) { + if (ref_.compare_exchange_weak(old_ref, old_ref + 1)) { + return true; + } + } + // Already destructing, cannot increase ref. + return false; +} + +inline bool RefCounted::Unref() const { + DCHECK_GT(ref_.load(), 0); + // acq_rel is used to prevent reordering introduces object access after + // destruction. + + // Using release alone is a bug on systems where acq_rel differs from release. + // (e.g. arm), according to Herb Sutter's 2012 talk on "Atomic<> Weapons". + if (ref_.fetch_sub(1, std::memory_order_acq_rel) == 1) { + NotifyDeleted(); + delete this; + return true; + } + return false; +} + +inline int_fast32_t RefCounted::RefCount() const { + return ref_.load(std::memory_order_acquire); +} + +inline void RefCounted::NotifyDeleted() const {} + +inline bool RefCounted::RefCountIsOne() const { + return (ref_.load(std::memory_order_acquire) == 1); +} + +} // namespace core +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_REFCOUNT_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/regexp.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/regexp.h new file mode 100644 index 0000000000000000000000000000000000000000..dbab940e81a0ddbe61356bfb1dca49f5544d1af0 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/regexp.h @@ -0,0 +1,27 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_REGEXP_H_ +#define TENSORFLOW_TSL_PLATFORM_REGEXP_H_ + +#include "tsl/platform/platform.h" + +#if TSL_IS_IN_OSS +#include "re2/re2.h" +#else +#include "third_party/re2/re2.h" +#endif // TSL_IS_IN_OSS + +#endif // TENSORFLOW_TSL_PLATFORM_REGEXP_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/resource.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/resource.h new file mode 100644 index 0000000000000000000000000000000000000000..8d96cf336007b20665b76afa6d982acafa0154be --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/resource.h @@ -0,0 +1,44 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_RESOURCE_H_ +#define TENSORFLOW_TSL_PLATFORM_RESOURCE_H_ + +#include + +#include "tsl/platform/stringpiece.h" + +namespace tsl { + +// ResourceTagger objects should only be allocated on the stack. +class ResourceTagger { + public: + ResourceTagger(StringPiece key, StringPiece value); + ~ResourceTagger(); + + // Do not allow copying or moving ResourceTagger + ResourceTagger(const ResourceTagger&) = delete; + ResourceTagger(ResourceTagger&&) = delete; + ResourceTagger& operator=(const ResourceTagger&) = delete; + ResourceTagger& operator=(ResourceTagger&&) = delete; + + private: + class ResourceTaggerImpl; + const std::unique_ptr impl_; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_RESOURCE_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/retrying_utils.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/retrying_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..3252da2637c4d2e2f54d619ce06f984686c2e9a7 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/retrying_utils.h @@ -0,0 +1,81 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_RETRYING_UTILS_H_ +#define TENSORFLOW_TSL_PLATFORM_RETRYING_UTILS_H_ + +#include + +#include "absl/time/time.h" +#include "tsl/platform/status.h" + +namespace tsl { + +// Default time before reporting failure: ~100 seconds. +struct RetryConfig { + RetryConfig(int64_t init_delay_time_us = 100 * 1000, + int64_t max_delay_time_us = 32 * 1000 * 1000, + int max_retries = 10) { + this->init_delay_time_us = init_delay_time_us; + this->max_delay_time_us = max_delay_time_us; + this->max_retries = max_retries; + } + + // In case of failure, every call will be retried max_retries times. + int max_retries; + + // Initial backoff time + int64_t init_delay_time_us; + + // Maximum backoff time in microseconds. + int64_t max_delay_time_us; +}; + +class RetryingUtils { + public: + /// \brief Retries the function in case of failure with exponential backoff. + /// + /// The provided callback is retried with an exponential backoff until it + /// returns OK or a non-retriable error status. + /// If initial_delay_microseconds is zero, no delays will be made between + /// retries. + /// If all retries failed, returns the last error status. + static Status CallWithRetries(const std::function& f, + const RetryConfig& config); + + /// sleep_usec is a function that sleeps for the given number of microseconds. + static Status CallWithRetries(const std::function& f, + const std::function& sleep_usec, + const RetryConfig& config); + /// \brief A retrying wrapper for a function that deletes a resource. + /// + /// The function takes care of the scenario when a delete operation + /// returns a failure but succeeds under the hood: if a retry returns + /// NOT_FOUND, the whole operation is considered a success. + static Status DeleteWithRetries(const std::function& delete_func, + const RetryConfig& config); +}; + +// Given the total number of retries attempted, returns a randomized duration of +// time to delay before the next retry. +// +// The average computed backoff increases with the number of retries attempted. +// See implementation for details on the calculations. +absl::Duration ComputeRetryBackoff( + int current_retry_attempt, absl::Duration min_delay = absl::Milliseconds(1), + absl::Duration max_delay = absl::Seconds(10)); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_RETRYING_UTILS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stack_frame.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stack_frame.h new file mode 100644 index 0000000000000000000000000000000000000000..a52a8d53fca60d38bb07450e720c4aef2f6b6432 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stack_frame.h @@ -0,0 +1,52 @@ +#ifndef TENSORFLOW_TSL_PLATFORM_STACK_FRAME_H_ +#define TENSORFLOW_TSL_PLATFORM_STACK_FRAME_H_ + +/* Copyright 2020 Google LLC. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include +#include + +namespace tsl { + +// A struct representing a frame in a stack trace. +struct StackFrame { + std::string file_name; + int line_number; + std::string function_name; + + StackFrame() = default; + StackFrame(std::string file_name, int line_number, std::string function_name) + : file_name(std::move(file_name)), + line_number(line_number), + function_name(std::move(function_name)) {} + + bool operator==(const StackFrame& other) const { + return line_number == other.line_number && + function_name == other.function_name && file_name == other.file_name; + } + + bool operator!=(const StackFrame& other) const { return !(*this == other); } + + template + friend H AbslHashValue(H h, const StackFrame& frame) { + return h.combine(std::move(h), frame.file_name, frame.line_number, + frame.function_name); + } +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_STACK_FRAME_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stacktrace_handler.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stacktrace_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..57c04ead7416c84aa9a16205bdf1fabfa61806fa --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/stacktrace_handler.h @@ -0,0 +1,31 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_STACKTRACE_HANDLER_H_ +#define TENSORFLOW_TSL_PLATFORM_STACKTRACE_HANDLER_H_ + +namespace tsl { +namespace testing { + +// Installs signal handlers to print out stack trace. +// Although GoogleTest has support for generating stacktraces with abseil via +// https://github.com/google/googletest/pull/1653, this doesn't cover our use +// case of getting C++ stacktraces in our python tests. +void InstallStacktraceHandler(); + +} // namespace testing +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_STACKTRACE_HANDLER_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status.h new file mode 100644 index 0000000000000000000000000000000000000000..5ce7703d306f73cd4f07f8cf6e42401d07a23313 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status.h @@ -0,0 +1,218 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_STATUS_H_ +#define TENSORFLOW_TSL_PLATFORM_STATUS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/base/attributes.h" +#include "absl/base/macros.h" +#include "absl/functional/function_ref.h" +#include "absl/status/status.h" +#include "absl/strings/cord.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "tsl/platform/logging.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/platform.h" +#include "tsl/platform/stack_frame.h" +#include "tsl/platform/types.h" +#include "tsl/protobuf/error_codes.pb.h" + +// Include appropriate platform-dependent parts of status. +#if defined(PLATFORM_GOOGLE) +#include "tsl/platform/google/status.h" // IWYU pragma: export +#else +#include "tsl/platform/default/status.h" // IWYU pragma: export +#endif + +// This macro should eventually be provided by Abseil. +#ifndef ABSL_DEPRECATE_AND_INLINE +#define ABSL_DEPRECATE_AND_INLINE() +#endif + +namespace tsl { + +// Since April 2023, tensorflow::Status is an alias to absl::Status. The first +// TF release including this change will be TF 2.14 (the latest release in +// April 2023 is 2.13). +// At the same time `tsl::errors::Code` aliases `absl::StatusCode`. +// +// Here is a set of correspondences: +// - Use `absl::OkStatus()` instead of `tsl::OkStatus()`. +typedef absl::Status Status ABSL_DEPRECATE_AND_INLINE(); + +namespace errors { +typedef absl::StatusCode Code ABSL_DEPRECATE_AND_INLINE(); +} // namespace errors +namespace error { +typedef ::tensorflow::error::Code Code; +} // namespace error +} // namespace tsl + +// Transparent comparison between tensorflow::error::Code protobuf enum and +// absl::Status. +// +// The longer term objective is to delete these when we have done the transition +// to absl::Status. +namespace tensorflow::error { +inline bool operator==(const ::tensorflow::error::Code& c1, + const absl::StatusCode& c2) { + return static_cast(c1) == static_cast(c2); +} + +inline bool operator!=(const ::tensorflow::error::Code& c1, + const absl::StatusCode& c2) { + return static_cast(c1) != static_cast(c2); +} +} // namespace tensorflow::error + +namespace absl { +inline bool operator==(const ::absl::StatusCode& c1, + const ::tensorflow::error::Code& c2) { + return static_cast(c1) == static_cast(c2); +} + +inline bool operator!=(const ::absl::StatusCode& c1, + const ::tensorflow::error::Code& c2) { + return static_cast(c1) != static_cast(c2); +} +} // namespace absl + +namespace tsl { + +// OkStatus() +// +// Returns an OK status, equivalent to a default constructed instance. Prefer +// usage of `OkStatus()` when constructing such an OK status. +ABSL_DEPRECATE_AND_INLINE() inline absl::Status OkStatus() { + return absl::OkStatus(); +}; + +ABSL_DEPRECATE_AND_INLINE() +inline absl::Status FromAbslStatus(const absl::Status& s) { return s; } +ABSL_DEPRECATE_AND_INLINE() +inline absl::Status ToAbslStatus(const ::absl::Status& s) { return s; } + +// Given `Status.message()` does not guarantee to be always backed by a +// null-terminated string, we have this utility function when it's needed for +// the Tensorflow C-API. +// A more robust API would be to get both a `char*` of the beginning of the +// string, plus the size (see e.g. `XlaCustomCallStatusSetFailure`). +const char* NullTerminatedMessage(const Status& status); + +// TODO(b/197552541) Move this namespace to errors.h. +namespace errors { + +void SetStackTrace(::tsl::Status& status, std::vector stack_trace); + +std::vector GetStackTrace(const ::tsl::Status& status); +} // namespace errors + +// Helper class to manage multiple child status values. +class StatusGroup { + public: + StatusGroup(); + // Constructor to form a StatusGroup from any N set of Status arguments. + // Usage: StatusGroup({status_a, status_b, status_c}); + StatusGroup(std::initializer_list statuses); + + // Utility function to mark a Status as derived. By marking derived status, + // Derived status messages are ignored when reporting errors to end users. + static Status MakeDerived(const Status& s); + static bool IsDerived(const Status& s); + + // Enable warning and error log collection for appending to the aggregated + // status. This function may be called more than once. + static void ConfigureLogHistory(); + + // Returns merged payloads of all statuses. In case multiple statuses have the + // same payload key, non-derived statuses have priority over derived ones, + // otherwise one payload value will be chosen in an unspecified but + // deterministic order. + // NOTE: The payload marking derived statuses as derived will not be returned. + std::unordered_map GetPayloads() const; + + // Return a merged status with combined child status messages with a summary. + Status as_summary_status() const; + // Return a merged status with combined child status messages with + // concatenation. + Status as_concatenated_status() const; + + bool ok() const { return ok_; } + + // Augment this group with the child status `status`. + void Update(const Status& status); + + // Attach recent warning and error log messages + void AttachLogMessages(); + bool HasLogMessages() const { return !recent_logs_.empty(); } + + private: + bool ok_ = true; + size_t num_ok_ = 0; + + // Maintain a sorted collection of statuses. + struct CompareStatus { + bool operator()(const Status& a, const Status& b) const { + return a.ToString() > b.ToString(); + } + }; + // Using std::set instead of absl::btree_set to keep size for certain + // dependent libraries under the limit. + std::set derived_; + std::set non_derived_; + + std::vector recent_logs_; // recent warning and error logs +}; + + +typedef std::function StatusCallback; + +extern ::tsl::string* TfCheckOpHelperOutOfLine(const ::tsl::Status& v, + const char* msg); + +inline ::tsl::string* TfCheckOpHelper(::tsl::Status v, const char* msg) { + if (v.ok()) return nullptr; + return TfCheckOpHelperOutOfLine(v, msg); +} + +#define TF_DO_CHECK_OK(val, level) \ + while (auto* _result = ::tsl::TfCheckOpHelper(val, #val)) \ + LOG(level) << *(_result) + +#define TF_CHECK_OK(val) TF_DO_CHECK_OK(val, FATAL) +#define TF_QCHECK_OK(val) TF_DO_CHECK_OK(val, QFATAL) + +// DEBUG only version of TF_CHECK_OK. Compiler still parses 'val' even in opt +// mode. +#ifndef NDEBUG +#define TF_DCHECK_OK(val) TF_CHECK_OK(val) +#else +#define TF_DCHECK_OK(val) \ + while (false && (::tsl::OkStatus() == (val))) LOG(FATAL) +#endif + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_STATUS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status_matchers.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status_matchers.h new file mode 100644 index 0000000000000000000000000000000000000000..ee2144dca8a698db46ec9426151c1814fe48c97f --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/status_matchers.h @@ -0,0 +1,341 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_TSL_PLATFORM_STATUS_MATCHERS_H_ +#define TENSORFLOW_TSL_PLATFORM_STATUS_MATCHERS_H_ + +#include +#include +#include + +#include "tsl/platform/status.h" +#include "tsl/platform/statusor.h" +#include "tsl/platform/test.h" +#include "tsl/protobuf/error_codes.pb.h" + +// Defines the following utilities: +// +// =============== +// IsOkAndHolds(m) +// =============== +// +// This matcher matches a StatusOr value whose status is OK and whose inner +// value matches matcher m. Example: +// +// using ::tsl::testing::IsOkAndHolds; +// using ::testing::HasSubstr; +// ... +// StatusOr status_or_message("Hello, world"); +// EXPECT_THAT(status_or_message, IsOkAndHolds("Hello, world"))); +// EXPECT_THAT(status_or_message, IsOkAndHolds(HasSubstr("Hello,"))); +// +// =============================== +// StatusIs(status_code_matcher, +// error_message_matcher) +// =============================== +// +// This matcher matches a Status or StatusOr if the following are true: +// +// - the status's code() matches status_code_matcher, and +// - the status's error_message() matches error_message_matcher. +// +// Example: +// +// using ::tsl::testing::StatusIs; +// using ::testing::HasSubstr; +// using ::testing::MatchesRegex; +// using ::testing::Ne; +// using ::testing::_; +// StatusOr GetMessage(int id); +// ... +// +// // The status code must be CANCELLED; the error message can be anything. +// EXPECT_THAT(GetName(42), +// StatusIs(tsl::error::CANCELLED, _)); +// +// // The status code can be anything; the error message must match the regex. +// EXPECT_THAT(GetName(43), +// StatusIs(_, MatchesRegex("server.*time-out"))); +// +// // The status code should not be CANCELLED; the error message can be +// // anything with "Cancelled" in it. +// EXPECT_THAT(GetName(44), +// StatusIs(Ne(tsl::error::CANCELLED), +// HasSubstr("Cancelled")))); +// +// ============================= +// StatusIs(status_code_matcher) +// ============================= +// +// This is a shorthand for +// StatusIs(status_code_matcher, ::testing::_) +// +// In other words, it's like the two-argument StatusIs(), except that it ignores +// error messages. +// +// ====== +// IsOk() +// ====== +// +// Matches a Status or StatusOr whose status value is OK. +// Equivalent to 'StatusIs(error::OK)'. +// +// Example: +// ... +// StatusOr message("Hello, world"); +// EXPECT_THAT(message, IsOk()); +// Status status = OkStatus(); +// EXPECT_THAT(status, IsOk()); + +namespace tsl { + +inline void PrintTo(const tsl::error::Code code, std::ostream* os) { + *os << Code_Name(code); +} + +template +void PrintTo(const StatusOr& status_or, std::ostream* os) { + *os << ::testing::PrintToString(status_or.status()); + if (status_or.ok()) { + *os << ": " << ::testing::PrintToString(status_or.value()); + } +} + +namespace testing { +namespace internal_status { + +inline const Status& GetStatus(const Status& status) { return status; } + +template +inline const Status& GetStatus(const StatusOr& status) { + return status.status(); +} + +//////////////////////////////////////////////////////////// +// Implementation of IsOkAndHolds(). +// +// Monomorphic implementation of matcher IsOkAndHolds(m). StatusOrType is a +// reference to StatusOr. +template +class IsOkAndHoldsMatcherImpl + : public ::testing::MatcherInterface { + public: + typedef + typename std::remove_reference::type::value_type value_type; + + template + explicit IsOkAndHoldsMatcherImpl(InnerMatcher&& inner_matcher) + : inner_matcher_(::testing::SafeMatcherCast( + std::forward(inner_matcher))) {} + + void DescribeTo(std::ostream* os) const override { + *os << "is OK and has a value that "; + inner_matcher_.DescribeTo(os); + } + + void DescribeNegationTo(std::ostream* os) const override { + *os << "isn't OK or has a value that "; + inner_matcher_.DescribeNegationTo(os); + } + + bool MatchAndExplain( + StatusOrType actual_value, + ::testing::MatchResultListener* result_listener) const override { + if (!actual_value.ok()) { + *result_listener << "which has status " << actual_value.status(); + return false; + } + + ::testing::StringMatchResultListener inner_listener; + const bool matches = + inner_matcher_.MatchAndExplain(*actual_value, &inner_listener); + const std::string inner_explanation = inner_listener.str(); + if (!inner_explanation.empty()) { + *result_listener << "which contains value " + << ::testing::PrintToString(*actual_value) << ", " + << inner_explanation; + } + return matches; + } + + private: + const ::testing::Matcher inner_matcher_; +}; + +// Implements IsOkAndHolds(m) as a polymorphic matcher. +template +class IsOkAndHoldsMatcher { + public: + explicit IsOkAndHoldsMatcher(InnerMatcher inner_matcher) + : inner_matcher_(std::move(inner_matcher)) {} + + // Converts this polymorphic matcher to a monomorphic matcher of the given + // type. StatusOrType can be either StatusOr or a reference to StatusOr. + template + operator ::testing::Matcher() const { // NOLINT + return ::testing::Matcher( + new IsOkAndHoldsMatcherImpl(inner_matcher_)); + } + + private: + const InnerMatcher inner_matcher_; +}; + +//////////////////////////////////////////////////////////// +// Implementation of StatusIs(). +// +// StatusIs() is a polymorphic matcher. This class is the common +// implementation of it shared by all types T where StatusIs() can be used as +// a Matcher. + +class StatusIsMatcherCommonImpl { + public: + StatusIsMatcherCommonImpl( + ::testing::Matcher code_matcher, + ::testing::Matcher message_matcher) + : code_matcher_(std::move(code_matcher)), + message_matcher_(std::move(message_matcher)) {} + + void DescribeTo(std::ostream* os) const; + + void DescribeNegationTo(std::ostream* os) const; + + bool MatchAndExplain(const Status& status, + ::testing::MatchResultListener* result_listener) const; + + private: + const ::testing::Matcher code_matcher_; + const ::testing::Matcher message_matcher_; +}; + +// Monomorphic implementation of matcher StatusIs() for a given type T. T can +// be Status, StatusOr<>, or a reference to either of them. +template +class MonoStatusIsMatcherImpl : public ::testing::MatcherInterface { + public: + explicit MonoStatusIsMatcherImpl(StatusIsMatcherCommonImpl common_impl) + : common_impl_(std::move(common_impl)) {} + + void DescribeTo(std::ostream* os) const override { + common_impl_.DescribeTo(os); + } + + void DescribeNegationTo(std::ostream* os) const override { + common_impl_.DescribeNegationTo(os); + } + + bool MatchAndExplain( + T actual_value, + ::testing::MatchResultListener* result_listener) const override { + return common_impl_.MatchAndExplain(GetStatus(actual_value), + result_listener); + } + + private: + StatusIsMatcherCommonImpl common_impl_; +}; + +// Implements StatusIs() as a polymorphic matcher. +class StatusIsMatcher { + public: + StatusIsMatcher(::testing::Matcher code_matcher, + ::testing::Matcher message_matcher) + : common_impl_( + ::testing::MatcherCast(code_matcher), + ::testing::MatcherCast(message_matcher)) {} + + // Converts this polymorphic matcher to a monomorphic matcher of the given + // type. T can be StatusOr<>, Status, or a reference to either of them. + template + operator ::testing::Matcher() const { // NOLINT + return ::testing::MakeMatcher(new MonoStatusIsMatcherImpl(common_impl_)); + } + + private: + const StatusIsMatcherCommonImpl common_impl_; +}; + +// Monomorphic implementation of matcher IsOk() for a given type T. +// T can be Status, StatusOr<>, or a reference to either of them. +template +class MonoIsOkMatcherImpl : public ::testing::MatcherInterface { + public: + void DescribeTo(std::ostream* os) const override { *os << "is OK"; } + void DescribeNegationTo(std::ostream* os) const override { + *os << "is not OK"; + } + bool MatchAndExplain(T actual_value, + ::testing::MatchResultListener*) const override { + return GetStatus(actual_value).ok(); + } +}; + +// Implements IsOk() as a polymorphic matcher. +class IsOkMatcher { + public: + template + operator ::testing::Matcher() const { // NOLINT + return ::testing::Matcher(new MonoIsOkMatcherImpl()); + } +}; +} // namespace internal_status + +// Returns a matcher that matches a StatusOr<> whose status is OK and whose +// value matches the inner matcher. +template +internal_status::IsOkAndHoldsMatcher::type> +IsOkAndHolds(InnerMatcher&& inner_matcher) { + return internal_status::IsOkAndHoldsMatcher< + typename std::decay::type>( + std::forward(inner_matcher)); +} + +// Returns a matcher that matches a Status or StatusOr<> whose status code +// matches code_matcher, and whose error message matches message_matcher. +template +internal_status::StatusIsMatcher StatusIs(CodeMatcher code_matcher, + MessageMatcher message_matcher) { + return internal_status::StatusIsMatcher(std::move(code_matcher), + std::move(message_matcher)); +} +// Remove this specialization when tensorflow::Status is absl::Status +template +internal_status::StatusIsMatcher StatusIs(tensorflow::error::Code code_matcher, + MessageMatcher message_matcher) { + return internal_status::StatusIsMatcher( + static_cast(code_matcher), std::move(message_matcher)); +} + +// Returns a matcher that matches a Status or StatusOr<> whose status code +// matches code_matcher. +template +internal_status::StatusIsMatcher StatusIs(CodeMatcher code_matcher) { + return StatusIs(std::move(code_matcher), ::testing::_); +} +// Remove this specialization when tensorflow::Status is absl::Status +template <> +inline internal_status::StatusIsMatcher StatusIs( + tensorflow::error::Code code_matcher) { + return StatusIs(static_cast(code_matcher), ::testing::_); +} + +// Returns a matcher that matches a Status or StatusOr<> which is OK. +inline internal_status::IsOkMatcher IsOk() { + return internal_status::IsOkMatcher(); +} + +} // namespace testing +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_STATUS_MATCHERS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/strcat.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/strcat.h new file mode 100644 index 0000000000000000000000000000000000000000..198465b4cc05154bf2d05dc81711303c299ef92d --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/strcat.h @@ -0,0 +1,244 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// #status: RECOMMENDED +// #category: operations on strings +// #summary: Merges strings or numbers with no delimiter. +// +#ifndef TENSORFLOW_TSL_PLATFORM_STRCAT_H_ +#define TENSORFLOW_TSL_PLATFORM_STRCAT_H_ + +#include + +#include "tsl/platform/macros.h" +#include "tsl/platform/numbers.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/types.h" + +// The AlphaNum type was designed to be used as the parameter type for StrCat(). +// Any routine accepting either a string or a number may accept it. +// The basic idea is that by accepting a "const AlphaNum &" as an argument +// to your function, your callers will automatically convert bools, integers, +// and floating point values to strings for you. +// +// NOTE: Use of AlphaNum outside of the "strings" package is unsupported except +// for the specific case of function parameters of type "AlphaNum" or "const +// AlphaNum &". In particular, instantiating AlphaNum directly as a stack +// variable is not supported. +// +// Conversion from 8-bit values is not accepted because if it were, then an +// attempt to pass ':' instead of ":" might result in a 58 ending up in your +// result. +// +// Bools convert to "0" or "1". +// +// Floating point values are converted to a string which, if passed to strtod(), +// would produce the exact same original double (except in case of NaN; all NaNs +// are considered the same value). We try to keep the string short but it's not +// guaranteed to be as short as possible. +// +// You can convert to Hexadecimal output rather than Decimal output using Hex. +// To do this, pass strings::Hex(my_int) as a parameter to StrCat. You may +// specify a minimum field width using a separate parameter, so the equivalent +// of Printf("%04x", my_int) is StrCat(Hex(my_int, strings::kZeroPad4)) +// +// This class has implicit constructors. +namespace tsl { +namespace strings { + +enum PadSpec { + kNoPad = 1, + kZeroPad2, + kZeroPad3, + kZeroPad4, + kZeroPad5, + kZeroPad6, + kZeroPad7, + kZeroPad8, + kZeroPad9, + kZeroPad10, + kZeroPad11, + kZeroPad12, + kZeroPad13, + kZeroPad14, + kZeroPad15, + kZeroPad16 +}; + +struct Hex { + uint64 value; + enum PadSpec spec; + template + explicit Hex(Int v, PadSpec s = kNoPad) : spec(s) { + // Prevent sign-extension by casting integers to + // their unsigned counterparts. + static_assert( + sizeof(v) == 1 || sizeof(v) == 2 || sizeof(v) == 4 || sizeof(v) == 8, + "Unknown integer type"); + value = sizeof(v) == 1 ? static_cast(v) + : sizeof(v) == 2 ? static_cast(v) + : sizeof(v) == 4 ? static_cast(v) + : static_cast(v); + } +}; + +class AlphaNum { + // NOLINTBEGIN(google-explicit-constructor) + public: + // No bool ctor -- bools convert to an integral type. + // A bool ctor would also convert incoming pointers (bletch). + AlphaNum(int i32) // NOLINT(runtime/explicit) + : piece_(digits_, FastInt32ToBufferLeft(i32, digits_)) {} + AlphaNum(unsigned int u32) // NOLINT(runtime/explicit) + : piece_(digits_, FastUInt32ToBufferLeft(u32, digits_)) {} + AlphaNum(long x) // NOLINT(runtime/explicit) + : piece_(digits_, FastInt64ToBufferLeft(x, digits_)) {} + AlphaNum(unsigned long x) // NOLINT(runtime/explicit) + : piece_(digits_, FastUInt64ToBufferLeft(x, digits_)) {} + AlphaNum(long long int i64) // NOLINT(runtime/explicit) + : piece_(digits_, FastInt64ToBufferLeft(i64, digits_)) {} + AlphaNum(unsigned long long int u64) // NOLINT(runtime/explicit) + : piece_(digits_, FastUInt64ToBufferLeft(u64, digits_)) {} + + AlphaNum(float f) // NOLINT(runtime/explicit) + : piece_(digits_, FloatToBuffer(f, digits_)) {} + AlphaNum(double f) // NOLINT(runtime/explicit) + : piece_(digits_, DoubleToBuffer(f, digits_)) {} + AlphaNum(bfloat16 bf) // NOLINT(runtime/explicit) + : piece_(digits_, FloatToBuffer(static_cast(bf), digits_)) {} + + AlphaNum(Hex hex); // NOLINT(runtime/explicit) + + AlphaNum(const char *c_str) : piece_(c_str) {} // NOLINT(runtime/explicit) + AlphaNum(const StringPiece &pc) : piece_(pc) {} // NOLINT(runtime/explicit) + AlphaNum(const std::string &str) // NOLINT(runtime/explicit) + : piece_(str) {} + AlphaNum(const tstring &str) // NOLINT(runtime/explicit) + : piece_(str) {} + template + AlphaNum(const std::basic_string, A> &str) + : piece_(str) {} // NOLINT(runtime/explicit) + + StringPiece::size_type size() const { return piece_.size(); } + const char *data() const { return piece_.data(); } + StringPiece Piece() const { return piece_; } + + private: + StringPiece piece_; + char digits_[kFastToBufferSize]; + + // Use ":" not ':' + AlphaNum(char c); // NOLINT(runtime/explicit) + + // NOLINTEND(google-explicit-constructor) + AlphaNum(const AlphaNum &) = delete; + void operator=(const AlphaNum &) = delete; +}; + +// ---------------------------------------------------------------------- +// StrCat() +// This merges the given strings or numbers, with no delimiter. This +// is designed to be the fastest possible way to construct a string out +// of a mix of raw C strings, StringPieces, strings, bool values, +// and numeric values. +// +// Don't use this for user-visible strings. The localization process +// works poorly on strings built up out of fragments. +// +// For clarity and performance, don't use StrCat when appending to a +// string. In particular, avoid using any of these (anti-)patterns: +// str.append(StrCat(...)) +// str += StrCat(...) +// str = StrCat(str, ...) +// where the last is the worse, with the potential to change a loop +// from a linear time operation with O(1) dynamic allocations into a +// quadratic time operation with O(n) dynamic allocations. StrAppend +// is a better choice than any of the above, subject to the restriction +// of StrAppend(&str, a, b, c, ...) that none of the a, b, c, ... may +// be a reference into str. +// ---------------------------------------------------------------------- + +// For performance reasons, we have specializations for <= 4 args. +std::string StrCat(const AlphaNum &a) TF_MUST_USE_RESULT; +std::string StrCat(const AlphaNum &a, const AlphaNum &b) TF_MUST_USE_RESULT; +std::string StrCat(const AlphaNum &a, const AlphaNum &b, + const AlphaNum &c) TF_MUST_USE_RESULT; +std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c, + const AlphaNum &d) TF_MUST_USE_RESULT; + +namespace internal { + +// Do not call directly - this is not part of the public API. +std::string CatPieces(std::initializer_list pieces); +void AppendPieces(std::string *dest, std::initializer_list pieces); + +} // namespace internal + +// Support 5 or more arguments +template +std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c, + const AlphaNum &d, const AlphaNum &e, + const AV &...args) TF_MUST_USE_RESULT; + +template +std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c, + const AlphaNum &d, const AlphaNum &e, const AV &...args) { + return internal::CatPieces({a.Piece(), b.Piece(), c.Piece(), d.Piece(), + e.Piece(), + static_cast(args).Piece()...}); +} + +// ---------------------------------------------------------------------- +// StrAppend() +// Same as above, but adds the output to the given string. +// WARNING: For speed, StrAppend does not try to check each of its input +// arguments to be sure that they are not a subset of the string being +// appended to. That is, while this will work: +// +// string s = "foo"; +// s += s; +// +// This will not (necessarily) work: +// +// string s = "foo"; +// StrAppend(&s, s); +// +// Note: while StrCat supports appending up to 26 arguments, StrAppend +// is currently limited to 9. That's rarely an issue except when +// automatically transforming StrCat to StrAppend, and can easily be +// worked around as consecutive calls to StrAppend are quite efficient. +// ---------------------------------------------------------------------- + +void StrAppend(std::string *dest, const AlphaNum &a); +void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b); +void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b, + const AlphaNum &c); +void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b, + const AlphaNum &c, const AlphaNum &d); + +// Support 5 or more arguments +template +inline void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b, + const AlphaNum &c, const AlphaNum &d, const AlphaNum &e, + const AV &...args) { + internal::AppendPieces(dest, + {a.Piece(), b.Piece(), c.Piece(), d.Piece(), e.Piece(), + static_cast(args).Piece()...}); +} + +} // namespace strings +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_STRCAT_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/test_benchmark.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/test_benchmark.h new file mode 100644 index 0000000000000000000000000000000000000000..d1ce3cdac3514a196358a5143e2385a2d949fd62 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/test_benchmark.h @@ -0,0 +1,48 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Simple benchmarking facility. +#ifndef TENSORFLOW_TSL_PLATFORM_TEST_BENCHMARK_H_ +#define TENSORFLOW_TSL_PLATFORM_TEST_BENCHMARK_H_ + +#include "benchmark/benchmark.h" // from @com_google_benchmark // IWYU pragma: export +#include "tsl/platform/platform.h" + +// FIXME(vyng): Remove this. +// Background: During the benchmark-migration projects, all benchmarks were made +// to use "testing::benchmark::" prefix because that is what the internal +// Google benchmark library use. +namespace testing { +namespace benchmark { +using ::benchmark::State; // NOLINT +} // namespace benchmark +} // namespace testing + +namespace tsl { +namespace testing { + +inline void RunBenchmarks() { benchmark::RunSpecifiedBenchmarks(); } +inline void InitializeBenchmarks(int* argc, char** argv) { + benchmark::Initialize(argc, argv); +} + +template +void DoNotOptimize(const T& var) { + ::benchmark::DoNotOptimize(var); +} +} // namespace testing +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_TEST_BENCHMARK_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/threadpool_options.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/threadpool_options.h new file mode 100644 index 0000000000000000000000000000000000000000..21c74fbaa5727ff4715cb87913359887b7b0735a --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/threadpool_options.h @@ -0,0 +1,35 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_THREADPOOL_OPTIONS_H_ +#define TENSORFLOW_TSL_PLATFORM_THREADPOOL_OPTIONS_H_ + +#include "tsl/platform/threadpool_interface.h" + +namespace tsl { +namespace thread { + +struct ThreadPoolOptions { + // If not null, use this threadpool to schedule inter-op operation + thread::ThreadPoolInterface* inter_op_threadpool = nullptr; + + // If not null, use this threadpool to schedule intra-op operation + thread::ThreadPoolInterface* intra_op_threadpool = nullptr; +}; + +} // namespace thread +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_THREADPOOL_OPTIONS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/tstring.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/tstring.h new file mode 100644 index 0000000000000000000000000000000000000000..8b8772e7d4207d63d06227c3de2ce98d83293191 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/platform/tstring.h @@ -0,0 +1,588 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PLATFORM_TSTRING_H_ +#define TENSORFLOW_TSL_PLATFORM_TSTRING_H_ + +#include + +#include +#include + +#include "tsl/platform/cord.h" +#include "tsl/platform/ctstring.h" +#include "tsl/platform/platform.h" +#include "tsl/platform/stringpiece.h" + +namespace tsl { + +// tensorflow::tstring is the scalar type for DT_STRING tensors. +// +// tstrings are meant to be used when interfacing with string tensors, and +// should not be considered as a general replacement for std::string in +// tensorflow. The primary purpose of tstring is to provide a unified and +// stable ABI for string tensors across TF Core/C-API/Lite/etc---mitigating +// unnecessary conversions across language boundaries, and allowing for compiler +// agnostic interoperability across dynamically loaded modules. +// +// In addition to ABI stability, tstrings features two string subtypes, VIEW and +// OFFSET. +// +// VIEW tstrings are views into unowned character buffers; they can be used to +// pass around existing character strings without incurring a per object heap +// allocation. Note that, like std::string_view, it is the user's +// responsibility to ensure that the underlying buffer of a VIEW tstring exceeds +// the lifetime of the associated tstring object. +// +// TODO(dero): Methods for creating OFFSET tensors are not currently +// implemented. +// +// OFFSET tstrings are platform independent offset defined strings which can be +// directly mmaped or copied into a tensor buffer without the need for +// deserialization or processing. For security reasons, it is imperative that +// OFFSET based string tensors are validated before use, or are from a trusted +// source. +// +// Underlying VIEW and OFFSET buffers are considered immutable, so l-value +// assignment, mutation, or non-const access to data() of tstrings will result +// in the conversion to an owned SMALL/LARGE type. +// +// The interface for tstring largely overlaps with std::string. Except where +// noted, expect equivalent semantics with synonymous std::string methods. +class tstring { + TF_TString tstr_; + + public: + enum Type { + // See cstring.h + SMALL = TF_TSTR_SMALL, + LARGE = TF_TSTR_LARGE, + OFFSET = TF_TSTR_OFFSET, + VIEW = TF_TSTR_VIEW, + }; + + // Assignment to a tstring object with a tstring::view type will create a VIEW + // type tstring. + class view { + const char* data_; + size_t size_; + + public: + explicit view(const char* data, size_t size) : data_(data), size_(size) {} + explicit view(const char* data) : data_(data), size_(::strlen(data)) {} + + const char* data() const { return data_; } + + size_t size() const { return size_; } + + view() = delete; + view(const view&) = delete; + view& operator=(const view&) = delete; + }; + + typedef const char* const_iterator; + + // Ctor + tstring(); + tstring(const std::string& str); // NOLINT TODO(b/147740521): Make explicit. + tstring(const char* str, size_t len); + tstring(const char* str); // NOLINT TODO(b/147740521): Make explicit. + tstring(size_t n, char c); + explicit tstring(const StringPiece str); +#ifdef PLATFORM_GOOGLE + explicit tstring(const absl::Cord& cord); +#endif // PLATFORM_GOOGLE + + // Copy + tstring(const tstring& str); + + // Move + tstring(tstring&& str) noexcept; + + // Dtor + ~tstring(); + + // Copy Assignment + tstring& operator=(const tstring& str); + tstring& operator=(const std::string& str); + tstring& operator=(const char* str); + tstring& operator=(char ch); + tstring& operator=(const StringPiece str); +#ifdef PLATFORM_GOOGLE + tstring& operator=(const absl::Cord& cord); +#endif // PLATFORM_GOOGLE + + // View Assignment + tstring& operator=(const view& tsv); + + // Move Assignment + tstring& operator=(tstring&& str); + + // Comparison + int compare(const char* str, size_t len) const; + bool operator<(const tstring& o) const; + bool operator>(const tstring& o) const; + bool operator==(const char* str) const; + bool operator==(const tstring& o) const; + bool operator!=(const char* str) const; + bool operator!=(const tstring& o) const; + + // Conversion Operators + // TODO(b/147740521): Make explicit. + operator std::string() const; // NOLINT + // TODO(b/147740521): Make explicit. + operator StringPiece() const; // NOLINT +#ifdef PLATFORM_GOOGLE + template ::value, + T>::type* = nullptr> + operator T() const; // NOLINT TODO(b/147740521): Remove. +#endif // PLATFORM_GOOGLE + + // Attributes + size_t size() const; + size_t length() const; + size_t capacity() const; + bool empty() const; + Type type() const; + + // Allocation + void resize(size_t new_size, char c = 0); + // Similar to resize, but will leave the newly grown region uninitialized. + void resize_uninitialized(size_t new_size); + void clear() noexcept; + void reserve(size_t n); + + // Iterators + const_iterator begin() const; + const_iterator end() const; + + // Const Element Access + const char* c_str() const; + const char* data() const; + const char& operator[](size_t i) const; + const char& back() const; + + // Mutable Element Access + // NOTE: For VIEW/OFFSET types, calling these methods will result in the + // conversion to a SMALL or heap allocated LARGE type. As a result, + // previously obtained pointers, references, or iterators to the underlying + // buffer will point to the original VIEW/OFFSET and not the new allocation. + char* mdata(); + char* data(); // DEPRECATED: Use mdata(). + char& operator[](size_t i); + + // Assignment + tstring& assign(const char* str, size_t len); + tstring& assign(const char* str); + + // View Assignment + tstring& assign_as_view(const tstring& str); + tstring& assign_as_view(const std::string& str); + tstring& assign_as_view(const StringPiece str); + tstring& assign_as_view(const char* str, size_t len); + tstring& assign_as_view(const char* str); + + // Modifiers + // NOTE: Invalid input will result in undefined behavior. + tstring& append(const tstring& str); + tstring& append(const char* str, size_t len); + tstring& append(const char* str); + tstring& append(size_t n, char c); + + tstring& erase(size_t pos, size_t len); + + tstring& insert(size_t pos, const tstring& str, size_t subpos, size_t sublen); + tstring& insert(size_t pos, size_t n, char c); + void swap(tstring& str); + void push_back(char ch); + + // Friends + friend bool operator==(const char* a, const tstring& b); + friend bool operator==(const std::string& a, const tstring& b); + friend tstring operator+(const tstring& a, const tstring& b); + friend std::ostream& operator<<(std::ostream& o, const tstring& str); + friend std::hash; +}; + +// Non-member function overloads + +bool operator==(const char* a, const tstring& b); +bool operator==(const std::string& a, const tstring& b); +tstring operator+(const tstring& a, const tstring& b); +std::ostream& operator<<(std::ostream& o, const tstring& str); + +// Implementations + +// Ctor + +inline tstring::tstring() { TF_TString_Init(&tstr_); } + +inline tstring::tstring(const char* str, size_t len) { + TF_TString_Init(&tstr_); + TF_TString_Copy(&tstr_, str, len); +} + +inline tstring::tstring(const char* str) : tstring(str, ::strlen(str)) {} + +inline tstring::tstring(size_t n, char c) { + TF_TString_Init(&tstr_); + TF_TString_Resize(&tstr_, n, c); +} + +inline tstring::tstring(const std::string& str) + : tstring(str.data(), str.size()) {} + +inline tstring::tstring(const StringPiece str) + : tstring(str.data(), str.size()) {} + +#ifdef PLATFORM_GOOGLE +inline tstring::tstring(const absl::Cord& cord) { + TF_TString_Init(&tstr_); + TF_TString_ResizeUninitialized(&tstr_, cord.size()); + + cord.CopyToArray(data()); +} +#endif // PLATFORM_GOOGLE + +// Copy + +inline tstring::tstring(const tstring& str) { + TF_TString_Init(&tstr_); + TF_TString_Assign(&tstr_, &str.tstr_); +} + +// Move + +inline tstring::tstring(tstring&& str) noexcept { + TF_TString_Init(&tstr_); + TF_TString_Move(&tstr_, &str.tstr_); +} + +// Dtor + +inline tstring::~tstring() { TF_TString_Dealloc(&tstr_); } + +// Copy Assignment + +inline tstring& tstring::operator=(const tstring& str) { + TF_TString_Assign(&tstr_, &str.tstr_); + + return *this; +} + +inline tstring& tstring::operator=(const std::string& str) { + TF_TString_Copy(&tstr_, str.data(), str.size()); + return *this; +} + +inline tstring& tstring::operator=(const char* str) { + TF_TString_Copy(&tstr_, str, ::strlen(str)); + + return *this; +} + +inline tstring& tstring::operator=(char c) { + resize_uninitialized(1); + (*this)[0] = c; + + return *this; +} + +inline tstring& tstring::operator=(const StringPiece str) { + TF_TString_Copy(&tstr_, str.data(), str.size()); + + return *this; +} + +#ifdef PLATFORM_GOOGLE +inline tstring& tstring::operator=(const absl::Cord& cord) { + TF_TString_ResizeUninitialized(&tstr_, cord.size()); + + cord.CopyToArray(data()); + + return *this; +} +#endif // PLATFORM_GOOGLE + +// View Assignment + +inline tstring& tstring::operator=(const tstring::view& tsv) { + assign_as_view(tsv.data(), tsv.size()); + + return *this; +} + +// Move Assignment + +inline tstring& tstring::operator=(tstring&& str) { + TF_TString_Move(&tstr_, &str.tstr_); + + return *this; +} + +// Comparison + +inline int tstring::compare(const char* str, size_t len) const { + int ret = ::memcmp(data(), str, std::min(len, size())); + + if (ret < 0) return -1; + if (ret > 0) return +1; + + if (size() < len) return -1; + if (size() > len) return +1; + + return 0; +} + +inline bool tstring::operator<(const tstring& o) const { + return compare(o.data(), o.size()) < 0; +} + +inline bool tstring::operator>(const tstring& o) const { + return compare(o.data(), o.size()) > 0; +} + +inline bool tstring::operator==(const char* str) const { + return ::strlen(str) == size() && ::memcmp(data(), str, size()) == 0; +} + +inline bool tstring::operator==(const tstring& o) const { + return o.size() == size() && ::memcmp(data(), o.data(), size()) == 0; +} + +inline bool tstring::operator!=(const char* str) const { + return !(*this == str); +} + +inline bool tstring::operator!=(const tstring& o) const { + return !(*this == o); +} + +// Conversion Operators + +inline tstring::operator std::string() const { + return std::string(data(), size()); +} + +inline tstring::operator StringPiece() const { + return StringPiece(data(), size()); +} + +#ifdef PLATFORM_GOOGLE +template ::value, T>::type*> +inline tstring::operator T() const { + return T(StringPiece(*this)); +} +#endif // PLATFORM_GOOGLE + +// Attributes + +inline size_t tstring::size() const { return TF_TString_GetSize(&tstr_); } + +inline size_t tstring::length() const { return size(); } + +inline size_t tstring::capacity() const { + return TF_TString_GetCapacity(&tstr_); +} + +inline bool tstring::empty() const { return size() == 0; } + +inline tstring::Type tstring::type() const { + return static_cast(TF_TString_GetType(&tstr_)); +} + +// Allocation + +inline void tstring::resize(size_t new_size, char c) { + TF_TString_Resize(&tstr_, new_size, c); +} + +inline void tstring::resize_uninitialized(size_t new_size) { + TF_TString_ResizeUninitialized(&tstr_, new_size); +} + +inline void tstring::clear() noexcept { + TF_TString_ResizeUninitialized(&tstr_, 0); +} + +inline void tstring::reserve(size_t n) { TF_TString_Reserve(&tstr_, n); } + +// Iterators + +inline tstring::const_iterator tstring::begin() const { return &(*this)[0]; } +inline tstring::const_iterator tstring::end() const { return &(*this)[size()]; } + +// Element Access + +inline const char* tstring::c_str() const { return data(); } + +inline const char* tstring::data() const { + return TF_TString_GetDataPointer(&tstr_); +} + +inline const char& tstring::operator[](size_t i) const { return data()[i]; } + +inline const char& tstring::back() const { return (*this)[size() - 1]; } + +inline char* tstring::mdata() { + return TF_TString_GetMutableDataPointer(&tstr_); +} + +inline char* tstring::data() { + // Deprecated + return mdata(); +} + +inline char& tstring::operator[](size_t i) { return mdata()[i]; } + +// Assignment + +inline tstring& tstring::assign(const char* str, size_t len) { + TF_TString_Copy(&tstr_, str, len); + + return *this; +} + +inline tstring& tstring::assign(const char* str) { + assign(str, ::strlen(str)); + + return *this; +} + +// View Assignment + +inline tstring& tstring::assign_as_view(const tstring& str) { + assign_as_view(str.data(), str.size()); + + return *this; +} + +inline tstring& tstring::assign_as_view(const std::string& str) { + assign_as_view(str.data(), str.size()); + + return *this; +} + +inline tstring& tstring::assign_as_view(const StringPiece str) { + assign_as_view(str.data(), str.size()); + + return *this; +} + +inline tstring& tstring::assign_as_view(const char* str, size_t len) { + TF_TString_AssignView(&tstr_, str, len); + + return *this; +} + +inline tstring& tstring::assign_as_view(const char* str) { + assign_as_view(str, ::strlen(str)); + + return *this; +} + +// Modifiers + +inline tstring& tstring::append(const tstring& str) { + TF_TString_Append(&tstr_, &str.tstr_); + + return *this; +} + +inline tstring& tstring::append(const char* str, size_t len) { + TF_TString_AppendN(&tstr_, str, len); + + return *this; +} + +inline tstring& tstring::append(const char* str) { + append(str, ::strlen(str)); + + return *this; +} + +inline tstring& tstring::append(size_t n, char c) { + // For append use cases, we want to ensure amortized growth. + const size_t new_size = size() + n; + TF_TString_ReserveAmortized(&tstr_, new_size); + resize(new_size, c); + + return *this; +} + +inline tstring& tstring::erase(size_t pos, size_t len) { + memmove(mdata() + pos, data() + pos + len, size() - len - pos); + + resize(size() - len); + + return *this; +} + +inline tstring& tstring::insert(size_t pos, const tstring& str, size_t subpos, + size_t sublen) { + size_t orig_size = size(); + TF_TString_ResizeUninitialized(&tstr_, orig_size + sublen); + + memmove(mdata() + pos + sublen, data() + pos, orig_size - pos); + memmove(mdata() + pos, str.data() + subpos, sublen); + + return *this; +} + +inline tstring& tstring::insert(size_t pos, size_t n, char c) { + size_t size_ = size(); + TF_TString_ResizeUninitialized(&tstr_, size_ + n); + + memmove(mdata() + pos + n, data() + pos, size_ - pos); + memset(mdata() + pos, c, n); + + return *this; +} + +inline void tstring::swap(tstring& str) { + // TODO(dero): Invalid for OFFSET (unimplemented). + std::swap(tstr_, str.tstr_); +} + +inline void tstring::push_back(char ch) { append(1, ch); } + +// Friends + +inline bool operator==(const char* a, const tstring& b) { + return ::strlen(a) == b.size() && ::memcmp(a, b.data(), b.size()) == 0; +} + +inline bool operator==(const std::string& a, const tstring& b) { + return a.size() == b.size() && ::memcmp(a.data(), b.data(), b.size()) == 0; +} + +inline tstring operator+(const tstring& a, const tstring& b) { + tstring r; + r.reserve(a.size() + b.size()); + r.append(a); + r.append(b); + + return r; +} + +inline std::ostream& operator<<(std::ostream& o, const tstring& str) { + return o.write(str.data(), str.size()); +} + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PLATFORM_TSTRING_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/ml_dtypes.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/ml_dtypes.h new file mode 100644 index 0000000000000000000000000000000000000000..f2b93ebee41a218e05a41dda76a74c3c5b5a4326 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/ml_dtypes.h @@ -0,0 +1,50 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PYTHON_LIB_CORE_ML_DTYPES_H_ +#define TENSORFLOW_TSL_PYTHON_LIB_CORE_ML_DTYPES_H_ + +// Registers all custom types from the python ml_dtypes package. +// https://github.com/jax-ml/ml_dtypes + +namespace tsl { +namespace ml_dtypes { + +struct NumpyDtypes { + int bfloat16; + int float8_e4m3fn; + int float8_e4m3b11fnuz; + int float8_e4m3fnuz; + int float8_e5m2; + int float8_e5m2fnuz; + int int4; + int uint4; +}; + +// RegisterTypes imports the ml_dtypes module. It should be called before using +// the functions below, and it fails (by returning false) if there was an error +// importing that module. If the build system guarantees that the module exists, +// the call can be omitted, since it is implied by the functions below. +bool RegisterTypes(); + +// Implicitly calls RegisterTypes on first use. +const NumpyDtypes& GetNumpyDtypes(); + +inline int GetBfloat16TypeNum() { return GetNumpyDtypes().bfloat16; } + +} // namespace ml_dtypes +} // namespace tsl + +#endif // TENSORFLOW_TSL_PYTHON_LIB_CORE_ML_DTYPES_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/numpy.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/numpy.h new file mode 100644 index 0000000000000000000000000000000000000000..8cbe3ab74e20d1f5a72d94b1e0bd2dde51864380 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/python/lib/core/numpy.h @@ -0,0 +1,50 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_PYTHON_LIB_CORE_NUMPY_H_ +#define TENSORFLOW_TSL_PYTHON_LIB_CORE_NUMPY_H_ + +#ifdef PyArray_Type +#error "Numpy cannot be included before numpy.h." +#endif + +// Disallow Numpy 1.7 deprecated symbols. +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + +// We import_array in the XLA init function only. +#define PY_ARRAY_UNIQUE_SYMBOL _xla_numpy_api +#ifndef XLA_IMPORT_NUMPY +#define NO_IMPORT_ARRAY +#endif + +// Place `` before to avoid build failure in macOS. +#include + +#include + +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" + +namespace tsl { + +// Import numpy. This wrapper function exists so that the +// PY_ARRAY_UNIQUE_SYMBOL can be safely defined in a .cc file to +// avoid weird linking issues. Should be called only from our +// module initialization function. +void ImportNumpy(); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_PYTHON_LIB_CORE_NUMPY_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/byte_swap_array.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/byte_swap_array.h new file mode 100644 index 0000000000000000000000000000000000000000..ad7e34efcd51f7cb6e2f16b4c97c0ef5f92946bc --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/byte_swap_array.h @@ -0,0 +1,104 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_BYTE_SWAP_ARRAY_H_ +#define TENSORFLOW_TSL_UTIL_BYTE_SWAP_ARRAY_H_ + +#include "tsl/platform/byte_order.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/status.h" + +// Define basic byte swapping operations. +// These operations must be macros to use compiler intrinsics. +// Note that the code here is written for portability, not speed. Byte swapping +// only happens when importing a checkpoint from one hardware architecture onto +// a different architecture. If these operations become part of a fast path, +// then the function ByteSwapArray() below should be rewritten to use +// architecture-appropriate SIMD instructions that swap multiple words at once. + +#if defined(__linux__) + +// Use the Gnu byte swap macros when available. See bswap(3) for more info. +#include +#define BYTE_SWAP_16(x) bswap_16(x) +#define BYTE_SWAP_32(x) bswap_32(x) +#define BYTE_SWAP_64(x) bswap_64(x) + +#elif defined(PLATFORM_WINDOWS) + +// On windows, byte-swapping is in winsock.h, and winsock2.h has a version of +// of htonl that can byte-swap 64-bit values. +#include +#define BYTE_SWAP_16(x) htons(x) +#define BYTE_SWAP_32(x) htonl(x) +// At the moment the 64-bit and 128-bit byte-swapping routines in Winsock2 are +// disabled in TensorFlow's standard Windows build environment, so we use +// htonl() instead of "#define BYTE_SWAP_64(x) htonll (x)". +#define BYTE_SWAP_64(x) \ + ((uint64_t(htonl((x)&0x00000000ffffffffUL)) << 32) | \ + (htonl(((x)&0xffffffff00000000UL) >> 32))) + +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + +// On non-Linux, non-Windows, but little-endian, environments, use htonl/s, +// which byte-swap when the host byte order is little-endian. POSIX doesn't +// define a 64-bit version of these library functions, so we roll our own. +#include +#define BYTE_SWAP_16(x) htons(x) +#define BYTE_SWAP_32(x) htonl(x) +#define BYTE_SWAP_64(x) \ + ((uint64_t(htonl((x)&0x00000000ffffffffUL)) << 32) | \ + (htonl(((x)&0xffffffff00000000UL) >> 32))) + +#else // not defined(__linux__) and not defined(PLATFORM_WINDOWS) + // and (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) + +// Fall back on a non-optimized implementation on other big-endian targets. +// This code swaps one byte at a time and is probably an order of magnitude +// slower. + +#define BYTE_SWAP_16(x) ((((x)&0x00ff) << 8) | (((x)&0xff00) >> 8)) + +#define BYTE_SWAP_32(x) \ + ((((x)&0x000000ffU) << 24) | (((x)&0x0000ff00U) << 8) | \ + (((x)&0x00ff0000U) >> 8) | (((x)&0xff000000U) >> 24)) + +#define BYTE_SWAP_64(x) \ + ((((x)&0x00000000000000ffUL) << 56) | (((x)&0x000000000000ff00UL) << 40) | \ + (((x)&0x0000000000ff0000UL) << 24) | (((x)&0x00000000ff000000UL) << 8) | \ + (((x)&0x000000ff00000000UL) >> 8) | (((x)&0x0000ff0000000000UL) >> 24) | \ + (((x)&0x00ff000000000000UL) >> 40) | (((x)&0xff00000000000000UL) >> 56)) + +#endif // defined(__linux__) + +namespace tsl { + +// Byte-swap an entire array of atomic C/C++ types in place. +// +// Note: When calling this function on arrays of std::complex<> types, +// multiply the number of elements by 2 and divide the bytes per element by 2. +// +// Args: +// array: Pointer to the beginning of the array +// bytes_per_elem: Number of bytes in each element of the array +// array_len: Number of elements in the array +// +// Returns: OkStatus() on success, -1 otherwise +// +Status ByteSwapArray(char *array, size_t bytes_per_elem, int array_len); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_BYTE_SWAP_ARRAY_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/command_line_flags.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/command_line_flags.h new file mode 100644 index 0000000000000000000000000000000000000000..2710de5753cd01450311e6f8873d9b6fdfb352a2 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/command_line_flags.h @@ -0,0 +1,148 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_COMMAND_LINE_FLAGS_H_ +#define TENSORFLOW_TSL_UTIL_COMMAND_LINE_FLAGS_H_ + +#include +#include +#include + +#include "tsl/platform/types.h" + +namespace tsl { + +// N.B. This library is for INTERNAL use only. +// +// This is a simple command-line argument parsing module to help us handle +// parameters for C++ binaries. The recommended way of using it is with local +// variables and an initializer list of Flag objects, for example: +// +// int some_int = 10; +// bool some_switch = false; +// string some_name = "something"; +// std::vector flag_list = { +// Flag("some_int", &some_int, "an integer that affects X"), +// Flag("some_switch", &some_switch, "a bool that affects Y"), +// Flag("some_name", &some_name, "a string that affects Z") +// }; +// // Get usage message before ParseFlags() to capture default values. +// string usage = Flag::Usage(argv[0], flag_list); +// bool parsed_values_ok = Flags::Parse(&argc, argv, flag_list); +// +// tsl::port::InitMain(usage.c_str(), &argc, &argv); +// if (argc != 1 || !parsed_values_ok) { +// ...output usage and error message... +// } +// +// The argc and argv values are adjusted by the Parse function so all that +// remains is the program name (at argv[0]) and any unknown arguments fill the +// rest of the array. This means you can check for flags that weren't understood +// by seeing if argv is greater than 1. +// The result indicates if there were any errors parsing the values that were +// passed to the command-line switches. For example, --some_int=foo would return +// false because the argument is expected to be an integer. +// +// NOTE: Unlike gflags-style libraries, this library is intended to be +// used in the `main()` function of your binary. It does not handle +// flag definitions that are scattered around the source code. + +// A description of a single command line flag, holding its name, type, usage +// text, and a pointer to the corresponding variable. +class Flag { + public: + Flag(const char* name, int32* dst, const string& usage_text, + bool* dst_updated = nullptr); + Flag(const char* name, int64_t* dst, const string& usage_text, + bool* dst_updated = nullptr); + Flag(const char* name, bool* dst, const string& usage_text, + bool* dst_updated = nullptr); + Flag(const char* name, string* dst, const string& usage_text, + bool* dst_updated = nullptr); + Flag(const char* name, float* dst, const string& usage_text, + bool* dst_updated = nullptr); + + // These constructors invoke a hook on a match instead of writing to a + // specific memory location. The hook may return false to signal a malformed + // or illegal value, which will then fail the command line parse. + // + // "default_value_for_display" is shown as the default value of this flag in + // Flags::Usage(). + Flag(const char* name, std::function int32_hook, + int32_t default_value_for_display, const string& usage_text); + Flag(const char* name, std::function int64_hook, + int64_t default_value_for_display, const string& usage_text); + Flag(const char* name, std::function float_hook, + float default_value_for_display, const string& usage_text); + Flag(const char* name, std::function bool_hook, + bool default_value_for_display, const string& usage_text); + Flag(const char* name, std::function string_hook, + string default_value_for_display, const string& usage_text); + + private: + friend class Flags; + + bool Parse(string arg, bool* value_parsing_ok) const; + + string name_; + enum { + TYPE_INT32, + TYPE_INT64, + TYPE_BOOL, + TYPE_STRING, + TYPE_FLOAT, + } type_; + + std::function int32_hook_; + int32 int32_default_for_display_; + + std::function int64_hook_; + int64_t int64_default_for_display_; + + std::function float_hook_; + float float_default_for_display_; + + std::function bool_hook_; + bool bool_default_for_display_; + + std::function string_hook_; + string string_default_for_display_; + + string usage_text_; +}; + +class Flags { + public: + // Parse the command line represented by argv[0, ..., (*argc)-1] to find flag + // instances matching flags in flaglist[]. Update the variables associated + // with matching flags, and remove the matching arguments from (*argc, argv). + // Return true iff all recognized flag values were parsed correctly, and the + // first remaining argument is not "--help". + static bool Parse(int* argc, char** argv, const std::vector& flag_list); + + // Similar as above, but accepts a mutable vector of strings in place of + // argc and argv. Doesn't ignore the first flag, and return the unknown flags + // back in flags vector. + static bool Parse(std::vector& flags, + const std::vector& flag_list); + // Return a usage message with command line cmdline, and the + // usage_text strings in flag_list[]. + static string Usage(const string& cmdline, + const std::vector& flag_list); +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_COMMAND_LINE_FLAGS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/determinism.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/determinism.h new file mode 100644 index 0000000000000000000000000000000000000000..fff5b195845a39a51d31a3426b21cb4e586c6f17 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/determinism.h @@ -0,0 +1,27 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_DETERMINISM_H_ +#define TENSORFLOW_TSL_UTIL_DETERMINISM_H_ + +namespace tsl { + +bool OpDeterminismRequired(); +bool OpOrderDeterminismRequired(); +void EnableOpDeterminism(bool enabled); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_DETERMINISM_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/device_name_utils.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/device_name_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..51dcca37ac05493e2ca6305f7229747fcce47771 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/device_name_utils.h @@ -0,0 +1,294 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_DEVICE_NAME_UTILS_H_ +#define TENSORFLOW_TSL_UTIL_DEVICE_NAME_UTILS_H_ + +#include + +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" + +namespace tsl { + +// In TensorFlow a device name is a string of the following form: +// /job:/replica:/task:/device:: +// +// is a short identifier conforming to the regexp +// [a-zA-Z][_a-zA-Z]* +// is a supported device type (e.g. 'cpu' or 'gpu') +// , , are small non-negative integers and are +// densely allocated (except in tests). +// +// For some purposes, we also allow device patterns, which can specify +// some or none of the specific fields above, with missing components, +// or ":*" indicating "any value allowed for that component. +// +// For example: +// "/job:param_server" - Consider any devices in the "param_server" job +// "/device:cpu:*" - Consider any cpu devices in any job/task/replica +// "/job:*/replica:*/task:*/device:cpu:*" - Consider any cpu devices in any +// job/task/replica +// "/job:w/replica:0/task:0/device:gpu:*" - Consider any gpu devices in +// replica 0, task 0, of job "w" +class DeviceNameUtils { + public: + // Returns a fully qualified device name given the parameters. + static std::string FullName(const std::string& job, int replica, int task, + const std::string& type, int id); + + // TODO(b/278776328): Convert this to a Protobuf, since emptiness of a field + // is a standardized pattern in Protobuf. + struct ParsedName { + void Clear() { + has_job = false; + has_replica = false; + has_task = false; + has_type = false; + has_id = false; + job.clear(); + replica = 0; + task = 0; + type.clear(); + id = 0; + } + + bool operator==(const ParsedName& other) const { + return (has_job ? (other.has_job && job == other.job) : !other.has_job) && + (has_replica ? (other.has_replica && replica == other.replica) + : !other.has_replica) && + (has_task ? (other.has_task && task == other.task) + : !other.has_task) && + (has_type ? (other.has_type && type == other.type) + : !other.has_type) && + (has_id ? (other.has_id && id == other.id) : !other.has_id); + } + + bool operator!=(const ParsedName& other) const { + return !operator==(other); + } + + bool operator<(const ParsedName& other) const { + if (has_job != other.has_job) return !has_job; + if (has_job) { + if (job < other.job) { + return true; + } + if (job > other.job) { + return false; + } + } + if (has_replica != other.has_replica) return !has_replica; + if (has_replica) { + if (replica < other.replica) { + return true; + } + if (replica > other.replica) { + return false; + } + } + if (has_task != other.has_task) return !has_task; + if (has_task) { + if (task < other.task) { + return true; + } + if (task > other.task) { + return false; + } + } + if (has_type != other.has_type) return !has_type; + if (has_type) { + if (type < other.type) { + return true; + } + if (type > other.type) { + return false; + } + } + if (has_id != other.has_id) return !has_id; + if (has_id) { + if (id < other.id) { + return true; + } + if (id > other.id) { + return false; + } + } + return false; + } + + template + friend H AbslHashValue(H h, const ParsedName& n) { + return H::combine(std::move(h), n.has_job, n.job, n.has_replica, + n.replica, n.has_task, n.task, n.has_type, n.type, + n.has_id, n.id); + } + + bool has_job = false; + std::string job; + bool has_replica = false; + int replica = 0; + bool has_task = false; + int task = 0; + bool has_type = false; + std::string type; + bool has_id = false; + int id = 0; + }; + + // Parses the device name, first as a full name, then, if it fails, as a + // global one. Returns `false` if both attempts fail. + static bool ParseFullOrLocalName(StringPiece fullname, ParsedName* parsed); + + // Parses "fullname" into "*parsed". Returns true iff succeeds. + // Legacy names like "/cpu:0" that don't contain "device", + // are parsed to mean their current counterparts "/device:CPU:0". More + // specifically, the lower case "cpu" and "gpu" is capitalized and "device" + // is added. "/tpu:0" is not treated the same way - it has use the current + // full syntax. + // Also, note that lower case "cpu" and "gpu" device types in current syntax + // are not capitalized. For example, "/device:CPU:0" is different from + // "/device:cpu:0" + static bool ParseFullName(StringPiece fullname, ParsedName* parsed); + + // Canonicalizes "fullname" into "*canonical_name". Uses a fully specified + // basename to fill in fields that are missing. Accepts both legacy, newer + // and local versions of the device spec. Returns the newer version of the + // device spec. If we were unable to interpret / parse "fullname" returns + // an error and *canonical_name is set to "". + static Status CanonicalizeDeviceName(StringPiece fullname, + StringPiece basename, + std::string* canonical_name); + + // Returns true if "name" specifies any non-trivial constraint on the device. + static bool HasSomeDetails(const ParsedName& name) { + return name.has_job || name.has_replica || name.has_task || name.has_type || + name.has_id; + } + + // Returns true if more_specific is a specification of + // less_specific, i.e. everywhere that less-specific has a + // non-wildcard component value, more_specific has the same value + // for that component. + static bool IsSpecification(const ParsedName& less_specific, + const ParsedName& more_specific); + + // Makes minimal changes to more_specific so that it becomes a + // specification of less_specific. + static void EnsureSpecification(ParsedName* more_specific, + const ParsedName& less_specific); + + // Like IsSpecification, but the second argument "name" must have a + // non-wildcard value for all of its components. + static bool IsCompleteSpecification(const ParsedName& pattern, + const ParsedName& name); + + // True iff there exists any possible device name that is a specification of + // both "a" and "b". + static bool AreCompatibleDevNames(const ParsedName& a, const ParsedName& b); + + // Merges the device specifications in "*target" and "other", and + // stores the result in "*target". Returns OK if "*target" and + // "other" are compatible, otherwise returns an error. + static Status MergeDevNames(ParsedName* target, const ParsedName& other) { + return MergeDevNames(target, other, false); + } + static Status MergeDevNames(ParsedName* target, const ParsedName& other, + bool allow_soft_placement); + // Same as MergeDevNames with allow_soft_placement=true, but instead of + // clearing conflicting fields, overrides them with `other`'s values. + static Status MergeOverrideDevNames(ParsedName* target, + const ParsedName& other); + + // Merges the device specifications in "*target" and "other", and + // stores the result in "*target" by setting all unset values in target with + // corresponding set ones in other. + static void MergeUnsetDevNames(ParsedName* target, const ParsedName& other); + + // Returns true iff devices identified by 'src' and 'dst' are in the + // same address space. + static bool IsSameAddressSpace(StringPiece src, StringPiece dst); + static bool IsSameAddressSpace(const ParsedName& src, const ParsedName& dst); + + // Returns true iff devices identified by 'a' and 'b' are in different + // address space. + static bool IsDifferentAddressSpace(const ParsedName& a, const ParsedName& b); + + // Returns the an address space specification containing only the + // job/replica/task of the given name. + static const ParsedName AddressSpace(const ParsedName& name); + + // Returns the local device given its "type" and "id". + static std::string LocalName(StringPiece type, int id); + + // Returns a short local device name (cpu:0, gpu:1, etc) based on + // the given fullname. + static std::string LocalName(StringPiece fullname); + + // If "name" is a valid local device name (cpu:0, gpu:1, etc.), + // fills in parsed.type and parsed.id accordingly. Returns true iff + // succeeds. + static bool ParseLocalName(StringPiece name, ParsedName* parsed); + + // Splits a fully-qualified device name into a task identifier and a + // relative device identifier. It first parses "name" using + // ParseFullName(), then assigns *task with everything except for + // the local device component, and assigns the relative device + // component into *device. This function will still return true if + // the task component is empty, but it requires the relative device + // component to be fully specified. + static bool SplitDeviceName(StringPiece name, std::string* task, + std::string* device); + + // Get the task name from ParsedName. Return false if the task component is + // not fully specified. + static bool GetTaskName(const ParsedName& pn, std::string* task); + + static std::string ParsedNameToString(const ParsedName& pn); + + // Returns canonical and legacy full names for the given parsed + // device name 'pn'. The returned string names are often useful to + // look up devices from a mapping. + static std::vector GetNamesForDeviceMappings(const ParsedName& pn); + + // Returns canonical and legacy local names for the given parsed device name + // 'pn'. The returned string names are often useful to look up devices from a + // mapping. + static std::vector GetLocalNamesForDeviceMappings( + const ParsedName& pn); + + // Returns name of the CPU:0 device on the same host as the device + // `device_name`. + static Status DeviceNameToCpuDeviceName(const std::string& device_name, + std::string* host_device_name); + + static bool CompareFullNames(const StringPiece& a, const StringPiece& b) { + ParsedName parsed_a; + ParsedName parsed_b; + bool a_status = ParseFullName(a, &parsed_a); + bool b_status = ParseFullName(b, &parsed_b); + // Orders unparsable names first. + if (a_status != b_status) return !a_status; + if (!a_status) return a < b; + return parsed_a < parsed_b; + } +}; + +std::ostream& operator<<(std::ostream& os, + const DeviceNameUtils::ParsedName& x); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_DEVICE_NAME_UTILS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/env_var.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/env_var.h new file mode 100644 index 0000000000000000000000000000000000000000..9c6925c57f643ba896b84a9ac68b1c93c07cb926 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/env_var.h @@ -0,0 +1,56 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_ENV_VAR_H_ +#define TENSORFLOW_TSL_UTIL_ENV_VAR_H_ + +#include "tsl/platform/status.h" +#include "tsl/platform/stringpiece.h" +#include "tsl/platform/types.h" + +namespace tsl { + +// Returns a boolean into "value" from the environmental variable +// "env_var_name". If it is unset, the default value is used. A string "0" or a +// case insensitive "false" is interpreted as false. A string "1" or a case +// insensitive "true" is interpreted as true. Otherwise, an error status is +// returned. +Status ReadBoolFromEnvVar(StringPiece env_var_name, bool default_val, + bool* value); + +// Returns an int64 into "value" from the environmental variable "env_var_name". +// If it is unset, the default value is used. +// If the string cannot be parsed into int64, an error status is returned. +Status ReadInt64FromEnvVar(StringPiece env_var_name, int64_t default_val, + int64_t* value); +// Returns a float into "value" from the environmental variable "env_var_name". +// If it is unset, the default value is used. +// If the string cannot be parsed into float, an error status is returned. +Status ReadFloatFromEnvVar(StringPiece env_var_name, float default_val, + float* value); + +// Returns a string into "value" from the environmental variable "env_var_name". +// If it is unset, the default value is used. +Status ReadStringFromEnvVar(StringPiece env_var_name, StringPiece default_val, + std::string* value); + +// Returns a comma separated string into "value" from the environmental variable +// "env_var_name". If it is unset, the default value is comma split and used. +Status ReadStringsFromEnvVar(StringPiece env_var_name, StringPiece default_val, + std::vector* value); + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_ENV_VAR_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/onednn_threadpool.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/onednn_threadpool.h new file mode 100644 index 0000000000000000000000000000000000000000..7d8a093ae89fa626a52ea31ceb1a01051eda7e57 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/onednn_threadpool.h @@ -0,0 +1,193 @@ + +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_ONEDNN_THREADPOOL_H_ +#define TENSORFLOW_TSL_UTIL_ONEDNN_THREADPOOL_H_ +#ifdef INTEL_MKL + +#include +#include +#include +#include +#include +#include + +#define EIGEN_USE_THREADS + +#include "dnnl.hpp" +#include "dnnl_threadpool.hpp" +#include "tsl/platform/blocking_counter.h" +#include "tsl/platform/cpu_info.h" +#include "tsl/platform/threadpool.h" + +namespace tsl { + +#ifndef ENABLE_ONEDNN_OPENMP +using dnnl::threadpool_interop::threadpool_iface; + +// Divide 'n' units of work equally among 'teams' threads. If 'n' is not +// divisible by 'teams' and has a remainder 'r', the first 'r' teams have one +// unit of work more than the rest. Returns the range of work that belongs to +// the team 'tid'. +// Parameters +// n Total number of jobs. +// team Number of workers. +// tid Current thread_id. +// n_start start of range operated by the thread. +// n_end end of the range operated by the thread. + +template +inline void balance211(T n, U team, U tid, T* n_start, T* n_end) { + if (team <= 1 || n == 0) { + *n_start = 0; + *n_end = n; + return; + } + T min_per_team = n / team; + T remainder = n - min_per_team * team; // i.e., n % teams. + *n_start = tid * min_per_team + std::min(tid, remainder); + *n_end = *n_start + min_per_team + (tid < remainder); +} + +inline void run_jobs(bool balance, int i, int n, int njobs, + const std::function& fn) { + if (balance) { + int start, end; + balance211(n, njobs, i, &start, &end); + for (int j = start; j < end; j++) fn(j, n); + } else { + fn(i, n); + } +} + +class OneDnnThreadPool : public threadpool_iface { + public: + OneDnnThreadPool() = default; + + OneDnnThreadPool(Eigen::ThreadPoolInterface* eigen_interface, + int num_threads = -1) + : eigen_interface_(eigen_interface) { + set_num_and_max_threads(num_threads); + } + OneDnnThreadPool(Eigen::ThreadPoolInterface* eigen_interface, + bool can_use_caller_thread, int num_threads = -1) + : eigen_interface_(eigen_interface), + can_use_caller_thread_(can_use_caller_thread) { + set_num_and_max_threads(num_threads); + } + virtual int get_num_threads() const override { return num_threads_; } + virtual bool get_in_parallel() const override { + return (eigen_interface_->CurrentThreadId() != -1) ? true : false; + } + virtual uint64_t get_flags() const override { return ASYNCHRONOUS; } + virtual void parallel_for(int n, + const std::function& fn) override { + // Should never happen (handled by DNNL) + if (n == 0) return; + + // Should never happen (handled by DNNL) + if (n == 1) { + fn(0, 1); + return; + } + + int nthr = get_num_threads(); + int njobs = std::min(n, nthr); + bool balance = (nthr < n); + + // If use_caller_thread, schedule njobs-1 jobs to thread pool and run last + // job directly. + const bool use_caller_thread = + can_use_caller_thread_ && nthr == port::NumSchedulableCPUs(); + const int njobs_to_schedule = use_caller_thread ? njobs - 1 : njobs; + + if (use_caller_thread) { + for (int i = 0; i < njobs_to_schedule; i++) { + eigen_interface_->ScheduleWithHint( + [balance, i, n, njobs, fn]() { + run_jobs(balance, i, n, njobs, fn); + }, + i, i + 1); + } + run_jobs(balance, njobs_to_schedule, n, njobs, fn); + } else { + tsl::BlockingCounter counter(njobs); + std::function handle_range = [=, &handle_range, &counter]( + int first, int last) { + while (last - first > 1) { + const auto mid = first + (last - first) / 2; + // Find something near the midpoint which is a multiple of block size. + eigen_interface_->ScheduleWithHint([=]() { handle_range(mid, last); }, + mid, mid + 1); + last = mid; + } + counter.DecrementCount(); + run_jobs(balance, first, n, njobs, fn); + }; + + // Eigen avoids a thread hop by running the root of the tree on the main + // thread. We have disabled this because it actually slows things down + // relative to base because base cheats and uses n threads while letting + // main continue doing other work + eigen_interface_->ScheduleWithHint([=]() { handle_range(0, njobs); }, 0, + 1); + + counter.Wait(); + } + } + + ~OneDnnThreadPool() {} + + static void set_onednn_max_threads(int num_threads) { +#if DNNL_VERSION_MAJOR >= 3 || \ + (DNNL_VERSION_MAJOR == 2 && DNNL_VERSION_MINOR >= 7) +#ifndef DNNL_AARCH64_USE_ACL + dnnl_threadpool_interop_set_max_concurrency(num_threads); +#endif // DNNL_AARCH64_USE_ACL +#endif // DNNL_VERSION_MAJOR >= 3 || + // (DNNL_VERSION_MAJOR == 2 && DNNL_VERSION_MINOR >= 7) + } + + private: + Eigen::ThreadPoolInterface* eigen_interface_ = nullptr; + int num_threads_ = 1; // Execute in caller thread. + bool can_use_caller_thread_ = false; // true if the user set the env variable + // to use caller thread also. + inline void set_num_and_max_threads(int num_threads) { + num_threads_ = + num_threads == -1 ? eigen_interface_->NumThreads() : num_threads; + set_onednn_max_threads(num_threads_); + } +}; + +#else + +// This class was just added to enable successful OMP-based build. +class OneDnnThreadPool { + public: + OneDnnThreadPool() = default; + OneDnnThreadPool(Eigen::ThreadPoolInterface* eigen_interface) {} + OneDnnThreadPool(Eigen::ThreadPoolInterface* eigen_interface, + bool can_use_caller_thread, int num_threads = -1) {} + static void set_onednn_max_threads(int num_threads) {} +}; + +#endif // !ENABLE_ONEDNN_OPENMP + +} // namespace tsl + +#endif // INTEL_MKL +#endif // TENSORFLOW_TSL_UTIL_ONEDNN_THREADPOOL_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/proto/proto_utils.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/proto/proto_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..9a1dee8eed5224370c76ae5ab34c374cfc829567 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/proto/proto_utils.h @@ -0,0 +1,42 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_PROTO_PROTO_UTILS_H_ +#define TENSORFLOW_TSL_UTIL_PROTO_PROTO_UTILS_H_ + +#include "google/protobuf/duration.pb.h" +#include "absl/time/time.h" + +namespace tsl { +namespace proto_utils { + +// Converts an absl::Duration to a google::protobuf::Duration. +inline google::protobuf::Duration ToDurationProto(absl::Duration duration) { + google::protobuf::Duration proto; + proto.set_seconds(absl::IDivDuration(duration, absl::Seconds(1), &duration)); + proto.set_nanos( + absl::IDivDuration(duration, absl::Nanoseconds(1), &duration)); + return proto; +} + +// Converts a google::protobuf::Duration to an absl::Duration. +inline absl::Duration FromDurationProto(google::protobuf::Duration proto) { + return absl::Seconds(proto.seconds()) + absl::Nanoseconds(proto.nanos()); +} + +} // namespace proto_utils +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_PROTO_PROTO_UTILS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stat_summarizer_options.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stat_summarizer_options.h new file mode 100644 index 0000000000000000000000000000000000000000..e07de6e8d5d9d14ea381f2b84b47950cb5c68038 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stat_summarizer_options.h @@ -0,0 +1,44 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_STAT_SUMMARIZER_OPTIONS_H_ +#define TENSORFLOW_TSL_UTIL_STAT_SUMMARIZER_OPTIONS_H_ +namespace tsl { +// Used to control the output of the statistics summarizer; +struct StatSummarizerOptions { + StatSummarizerOptions() + : show_run_order(true), + run_order_limit(0), + show_time(true), + time_limit(10), + show_memory(true), + memory_limit(10), + show_type(true), + show_summary(true), + format_as_csv(false) {} + + bool show_run_order; + int run_order_limit; + bool show_time; + int time_limit; + bool show_memory; + int memory_limit; + bool show_type; + bool show_summary; + bool format_as_csv; +}; +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_STAT_SUMMARIZER_OPTIONS_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stats_calculator.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stats_calculator.h new file mode 100644 index 0000000000000000000000000000000000000000..5c23f432971c23db140e1deec82d2d9c8928502a --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/stats_calculator.h @@ -0,0 +1,201 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_TSL_UTIL_STATS_CALCULATOR_H_ +#define TENSORFLOW_TSL_UTIL_STATS_CALCULATOR_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "tsl/util/stat_summarizer_options.h" + +namespace tsl { + +template +class Stat { + public: + void UpdateStat(ValueType v) { + if (count_ == 0) { + first_ = v; + } + + newest_ = v; + max_ = std::max(v, max_); + min_ = std::min(v, min_); + ++count_; + sum_ += v; + squared_sum_ += static_cast(v) * v; + } + + void Reset() { new (this) Stat(); } + + bool empty() const { return count_ == 0; } + + ValueType first() const { return first_; } + + ValueType newest() const { return newest_; } + + ValueType max() const { return max_; } + + ValueType min() const { return min_; } + + int64_t count() const { return count_; } + + ValueType sum() const { return sum_; } + + HighPrecisionValueType squared_sum() const { return squared_sum_; } + + bool all_same() const { return (count_ == 0 || min_ == max_); } + + HighPrecisionValueType avg() const { + return empty() ? std::numeric_limits::quiet_NaN() + : static_cast(sum_) / count_; + } + + // Returns sample variance. + ValueType sample_variance() const { + return all_same() + ? 0 + : (squared_sum_ - std::pow(sum_, 2.0) / count_) / (count_ - 1); + } + + // Returns population variance. + ValueType variance() const { + return all_same() ? 0 : (squared_sum_ / count_) - (avg() * avg()); + } + + // Returns population stddev. + ValueType std_deviation() const { + return all_same() ? 0 : std::sqrt(variance()); + } + + void OutputToStream(std::ostream* stream) const { + if (empty()) { + *stream << "count=0"; + } else if (all_same()) { + *stream << "count=" << count_ << " curr=" << newest_; + if (count_ > 1) *stream << "(all same)"; + } else { + *stream << "count=" << count_ << " first=" << first_ + << " curr=" << newest_ << " min=" << min_ << " max=" << max_ + << " avg=" << avg() << " std=" << std_deviation(); + } + } + + friend std::ostream& operator<<(std::ostream& stream, + const Stat& stat) { + stat.OutputToStream(&stream); + return stream; + } + + private: + ValueType first_ = 0; + ValueType newest_ = 0; + ValueType max_ = std::numeric_limits::min(); + ValueType min_ = std::numeric_limits::max(); + int64_t count_ = 0; + ValueType sum_ = 0; + HighPrecisionValueType squared_sum_ = 0; +}; + +// A StatsCalculator assists in performance analysis of Graph executions. +// +// It summarizes time spent executing (on GPU/CPU), memory used etc for +// graph execution. +// +// For example usage see StatsSummarizer. +class StatsCalculator { + public: + enum SortingMetric { + BY_NAME, + BY_RUN_ORDER, + BY_TIME, + BY_MEMORY, + BY_TYPE, + }; + + explicit StatsCalculator(const StatSummarizerOptions& options); + + // Returns a string detailing the accumulated runtime stats in a tab-separated + // format which can be pasted into a spreadsheet for further analysis. + std::string GetOutputString() const; + + std::string GetShortSummary() const; + + void ComputeStatsByType( + std::map* node_type_map_count, + std::map* node_type_map_time, + std::map* node_type_map_memory, + std::map* node_type_map_times_called, + int64_t* accumulated_us) const; + + std::string GetStatsByNodeType() const; + + std::string GetStatsByMetric(const std::string& title, + SortingMetric sorting_metric, + int num_stats) const; + + // Returns number of runs. + int num_runs() const { return static_cast(run_total_us_.count()); } + + // Returns stats of total microseconds spent by all nodes in each run. + const Stat& run_total_us() const { return run_total_us_; } + + void UpdateRunTotalUs(int64_t run_total_us) { + run_total_us_.UpdateStat(run_total_us); + } + + void UpdateMemoryUsed(int64_t memory) { memory_.UpdateStat(memory); } + + struct Detail { + std::string name; + std::string type; + int64_t run_order; + Stat elapsed_time; + Stat mem_used; + int64_t times_called; + }; + + const std::map& GetDetails() const { return details_; } + + void AddNodeStats(const std::string& name, const std::string& type, + int64_t run_order, int64_t rel_end_us, int64_t mem_used); + + private: + void OrderNodesByMetric(SortingMetric sorting_metric, + std::vector* details) const; + + std::string HeaderString(const std::string& title) const; + std::string ColumnString(const Detail& detail, + const int64_t cumulative_stat_on_node, + const Stat& stat) const; + + Stat run_total_us_; + Stat memory_; + + std::map details_; + StatSummarizerOptions options_; +}; + +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_STATS_CALCULATOR_H_ diff --git a/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/use_cudnn.h b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/use_cudnn.h new file mode 100644 index 0000000000000000000000000000000000000000..738e727e4c7808c3ad979eb42b7977ca2a1502e9 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/util/use_cudnn.h @@ -0,0 +1,43 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// The utility to check Cudnn dependency and set Cudnn-related flags. + +#ifndef TENSORFLOW_TSL_UTIL_USE_CUDNN_H_ +#define TENSORFLOW_TSL_UTIL_USE_CUDNN_H_ + +#include + +namespace tsl { + +bool CudnnUseAutotune(); +bool CudnnUseFrontend(); +bool CudnnUseRuntimeFusion(); +bool CudnnRnnUseAutotune(); +bool CudnnDisableConv1x1Optimization(); +bool DebugCudnnRnn(); +bool DebugCudnnRnnUseTensorOps(); +int64_t DebugCudnnRnnAlgo(); + +// Returns true if the CuDNN depthwise convolution can be used. See cudnn +// release note 7.6.3. +// (https://docs.nvidia.com/deeplearning/sdk/cudnn-release-notes/rel_763.html) +bool ShouldCudnnGroupedConvolutionBeUsed(const int32_t filter_rows, + const int32_t filter_cols, + const int32_t in_depth, + const int32_t out_depth); +} // namespace tsl + +#endif // TENSORFLOW_TSL_UTIL_USE_CUDNN_H_ diff --git a/videochat2/lib/python3.10/site-packages/torchvision/_C.so b/videochat2/lib/python3.10/site-packages/torchvision/_C.so new file mode 100644 index 0000000000000000000000000000000000000000..d767224e9154cc3284cbcd00a80f9034890a9446 --- /dev/null +++ b/videochat2/lib/python3.10/site-packages/torchvision/_C.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c36779df1224946e988d0b1ea7d8f95f92f26db497afef81d027cdfd6fced0b5 +size 7925832