o
    ߗi]                     @   s  U d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
mZmZmZmZmZmZmZ d dlZd dlmZ d dlmZmZ dZee ed< ejddd	kZd
ZdZdZ dZ!dZ"dZ#d
Z$d
Z%d
Z&dZ'ejdd	d	kZ(dZ)dZ*dZ+dZ,dZ-d
Z.dZ/dZ0e1 Z2eee
  ed< e3ejdd
Z4ejddd	kZ5dZ6ejdd
Z7ejdd
Z8i Z9ee
e
f ed< h dZ:ejddZ;e<ejddZ=ejdd	kZ>dZ?ejdd	kZ@dZAejdd	kZBejddd	kZCd
ZDd
ZEd
ZFdZGee3ef ed < ejd!dd	kZHe3ed"< g d#ZId$d% ZJdZKd
ZLdZMdZNdZOdZPdZQd
ZRdZSdZTd
ZUe r6d
ndZVd
ZWdZXeeeeeYZZdZ[d&Z\d'Z]d(Z^d
Z_dZ`e  Zad
Zbd
ZcdZdd
Zed)d* Zfef Zgh d+Zhd
Zid
Zjd
ZkdZldZmdZne1 Zoeee
gdf  ed,< e1 Zpeed-e
f  ed.< d
Zqg d/Zrersd0d1 etejuD  ejd2d	d	kZvejd3dd	kZwd
Zxi Zyeee
f ed4< ejd5dd	kZzejd6dd	kZ{e3ed7< ed8Z|ee3 ed9< dZ}ee
 ed:< erd d;l~T d<d= Zeeje  dS )>    N)abspathdirname)AnyCallableDictOptionalSetTypeTYPE_CHECKINGUnion)	is_fbcode)get_tristate_envinstall_config_modulelog_file_nameTORCHDYNAMO_VERBOSE01F   T      #TORCH_COMPILE_USE_LAZY_GRAPH_MODULEdynamictraceable_tensor_subclassesTORCHDYNAMO_SUPPRESS_ERRORSTORCH_COMPILE_REPLAY_RECORDTORCH_COMPILE_DISABLETORCH_COMPILE_CPROFILE!skipfiles_inline_module_allowlist>   torch._refstorch._primstorch._decomptorch.testingtorch.distributionsTORCHDYNAMO_REPRO_AFTERTORCHDYNAMO_REPRO_LEVEL   TORCHDYNAMO_REPRO_FORWARD_ONLYgMbP?TORCHDYNAMO_REPRO_IGNORE_NON_FP"TORCHDYNAMO_CAPTURE_SCALAR_OUTPUTS,TORCHDYNAMO_CAPTURE_DYNAMIC_OUTPUT_SHAPE_OPSoptimize_ddp(TORCH_DYNAMO_DO_NOT_EMIT_RUNTIME_ASSERTSdo_not_emit_runtime_asserts)ddp_optimizerpython_reducer'python_reducer_without_compiled_forwardno_optimizationc                  C   sj   t jt } t| jtr| jrd}nd}nt| jtr| j}n	tdtt|| j	v s3J d||S )Nr-   r0   z!Invalid type, type(optimize_ddp)=zInvalid mode mode=)
sysmodules__name__
isinstancer*   boolstr
ValueErrortype_ddp_optimization_mode)mmode r<   R/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/torch/_dynamo/config.py_get_optimize_ddp_mode)  s   
r>   float64
complex128int64c                  C   sR   d} | t jv rt jt j|  dS t r t jt t dS t jt 	 dS )NTORCH_COMPILE_DEBUG_DIRtorch_compile_debug)
osenvironpathjoinr   tempfile
gettempdirgetpassgetusergetcwd)DEBUG_DIR_VAR_NAMEr<   r<   r=   default_debug_dir_root  s   
rN   >   repro_afterrepro_levelconstant_functionsr   reorderable_logging_functions.ignore_logger_methods)striderequires_gradstorage_offsetlayoutdatac                 C   s    g | ]\}}t d |r|qS )z^is_.*)rematch).0name_r<   r<   r=   
<listcomp>  s     r^    TORCH_FAKE_TENSOR_DISPATCH_CACHE+TORCH_FAKE_TENSOR_DISPATCH_CACHE_CROSSCHECK!compiled_autograd_kwargs_overrideTORCH_COMPILER_COLLECTIVES(TORCH_DYNAMO_AUTOMATIC_DYNAMIC_LOCAL_PGOautomatic_dynamic_local_pgo)TORCH_DYNAMO_AUTOMATIC_DYNAMIC_REMOTE_PGOautomatic_dynamic_remote_pgo_custom_ops_profile)*c                  K   s   d S )Nr<   )changesr<   r<   r=   _make_closure_patcher#  s   rj   )rJ   inspectrD   rY   r1   rH   os.pathr   r   typingr   r   r   r   r   r	   r
   r   torchtorch._environmentr   torch.utils._config_moduler   r   r   r6   __annotations__rE   getverboseverify_correctnessminimum_call_countdead_code_eliminationcache_size_limitaccumulated_cache_size_limit&skip_code_recursive_on_cache_limit_hitfail_on_cache_limit_hitspecialize_intspecialize_floatdynamic_shapesuse_lazy_graph_moduleassume_static_by_defaultautomatic_dynamic_shapes automatic_dynamic_shapes_mark_asforce_parameter_static_shapes&force_nn_module_property_static_shapesallow_ignore_mark_dynamicguard_nn_modules guard_nn_modules_using_dict_tagssetr   r5   suppress_errorsreplay_record_enabled rewrite_assert_with_torch_assertdisablecprofiler   *allowed_functions_module_string_ignorelistrO   intrP   repro_forward_onlyrepro_tolerancerepro_ignore_non_fpsame_two_models_use_fp64capture_scalar_outputs capture_dynamic_output_shape_ops+prefer_deferred_runtime_asserts_over_guards'allow_complex_guards_as_runtime_asserts3force_unspec_int_unbacked_size_like_on_torchrec_kjtr*   r,   r9   r>   skip_torchrecoptimize_ddp_lazy_compileskip_fsdp_guardsskip_fsdp_hooksskip_nnmodule_hook_guards,skip_no_tensor_aliasing_guards_on_parametersraise_on_ctx_manager_usageraise_on_unsafe_aot_autograderror_on_nested_jit_traceerror_on_nested_fx_trace	allow_rnncapture_sparse_computeerror_on_recompilereport_guard_failures__file__base_dirtrace_numpynumpy_default_floatnumpy_default_complexnumpy_default_intuse_numpy_random_streamenable_cpp_guard_managerinline_inbuilt_nn_modulesuse_graph_deduplicationtrack_nodes_for_deduplicationissue_3_13_0_warning%record_compile_time_instruction_countrN   debug_dir_root_save_config_ignore%cudagraph_backend_keep_input_mutation(cudagraph_backend_support_input_mutationonly_allow_pt2_compliant_opscapture_autograd_functioncapture_func_transformslog_compilation_metricsrR   rS   +inject_BUILD_SET_unimplemented_TESTING_ONLY)_autograd_backward_strict_mode_banned_opsextend
getmembersTensorfake_tensor_cache_enabled$fake_tensor_cache_crosscheck_enabledcompiled_autogradra   enable_compiler_collectivesrd   rf   rg   torch.utils._config_typingrj   r2   r3   r<   r<   r<   r=   <module>   s   
(


