
    9j              	       "   U d 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 ddlm	Z	m
Z
 ddlmZmZmZ ddlmZ ddlmZmZmZ dZedz  ed<   ej0                  j3                  d	d
      dk(  ZdZej0                  j3                  dd      Zeed<   ej0                  j3                  dd      Zeed<   ej0                  j3                  dd      Zeed<   dZdZ dZ!dZ"dZ#dZ$dZ%dZ& eddd      Z'e(ed<   dZ) ed      Z*e+ed<    ed      Z,e+ed <    ed!dd"      Z-e(ed#<    ed$      Z.e(ed%<   dZ/dZ0dZ1ej0                  j3                  d&d      dk(  Z2dZ3ej0                  j3                  d'd      dk(  Z4d(Z5ed)   ed*<   dZ6dZ7dZ8dZ9dZ:dZ;dZ<ej0                  j3                  d+d
      dk(  Z= e>       Z?e>e@e      ed,<    e>       ZAe>e@e      ed-<    e(ej0                  j3                  d.d            ZBej0                  j3                  d/d
      dk(  ZCdZDej0                  j3                  d0d
      dk(  ZEej0                  j3                  d1d      ZFej0                  j3                  d2d      ZGe(ez  ed3<   i ZHeIeef   ed4<   	 h d5ZJej0                  j3                  d6d      ZK e+ej0                  j3                  d7d8            ZLej0                  j3                  d9      dk(  ZMd:ZNej0                  j3                  d;      dk(  ZOdZPej0                  j3                  d<      dk(  ZQej0                  j3                  d=d
      dk(  ZRdZSdZTdZUdZVe(ed>   z  ed?<   ej0                  j3                  d@d
      dk(  ZWe(edA<   dZXdZYdZZdZ[dZ\dZ]dZ^dZ_dZ`dZadZbdZcdZddZedZfdZgdZhdZidZj e        ZkdZldZm e
 e
 e
 e	en                        ZodZpdZqdBZrdCZsdDZtdZudZvdZwdZxdZydZz eddEddFG      Z{dZ|e(edH<   dZ}dZ~dZdZdZdZdZdZdZdZdZdZdZdIefdJZ e       Zh dKZdZdZdZdZdZdZe(edL<   dZ e>       Ze>eegdf      edM<    e>       Ze>edNef      edO<    edP      Ze>edNef      edQ<   dZg dRZg dSZej0                  j3                  dTd      dk(  Zej0                  j3                  dUd
      dk(  ZdZej0                  j3                  dVd
      dk(  Zej0                  j3                  dWd
      dk(  ZdZdZdZdZdZi ZeIeef   edX<   	 ej0                  j3                  dYd
      dk(  Zej0                  j3                  dZd
      dk(  Z ed[d\d]      Ze(ed^<    ed_      Ze(dz  ed`<   ej0                  j3                  dad
      dk(  Zej0                  j3                  dbd      Zedz  edc<    e ejV                  dd      dk7  dedfg      ZdZdZdZdZdZedz  edh<   dZe(edi<   dZe(edj<   dZe(dz  edk<   erddll dmedIefdnZ eejn                  e          y)oar  
Configuration module for TorchDynamo compiler and optimization settings.

This module contains various configuration flags and settings that control TorchDynamo's
behavior, including:

- Runtime behavior flags (e.g., guard settings, specialization options)
- Debugging and development options
- Performance tuning parameters
- Feature toggles for experimental features
    N)Callable)abspathdirname)AnyLiteralTYPE_CHECKING)	is_fbcode)Configget_tristate_envinstall_config_modulelog_file_nameTORCHDYNAMO_VERBOSE01FTORCH_COMPILE_OVERRIDE_BACKENDS debug_backend_override'TORCH_COMPILE_OVERRIDE_INDUCTOR_CONFIGSdebug_inductor_config_override%TORCH_COMPILE_OVERRIDE_DYNAMO_CONFIGSdebug_dynamo_config_override   Tinfo      zdoes not do anything)default
deprecateddeprecation_message*skip_code_recursive_on_recompile_limit_hitz$torch._dynamo.config.recompile_limit)aliascache_size_limitz0torch._dynamo.config.accumulated_recompile_limitaccumulated_cache_size_limitz?torch._dynamo.config.skip_code_recursive_on_recompile_limit_hit)r    r   r   &skip_code_recursive_on_cache_limit_hitz0torch._dynamo.config.fail_on_recompile_limit_hitfail_on_cache_limit_hit#TORCH_COMPILE_USE_LAZY_GRAPH_MODULE%TORCH_DYNAMO_AUTOMATIC_DYNAMIC_SHAPESdynamic)r'   unbacked automatic_dynamic_shapes_mark_asTORCHDYNAMO_PREPARE_FREEZINGtraceable_tensor_subclassesnontraceable_tensor_subclassesTORCHDYNAMO_SUPPRESS_ERRORSTORCH_COMPILE_REPLAY_RECORDTORCH_COMPILE_DISABLETORCH_COMPILE_CPROFILETORCH_COMPILE_DYNAMO_PROFILERdynamo_profiler!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)ddp_optimizerpython_reducer'python_reducer_without_compiled_forwardno_optimizationoptimize_ddp(TORCH_DYNAMO_DO_NOT_EMIT_RUNTIME_ASSERTSdo_not_emit_runtime_assertsfloat64
complex128int64z*pytorch/compiler:inline_inbuilt_nn_modulesz>does not do anything, inline_inbuilt_nn_modules is always True)r   justknobr   r   nested_graph_breaksreturnc                     d} | t         j                  v r1t         j                  j                  t         j                  |    d      S t	               rEt         j                  j                  t        j                         t        j                         d      S t         j                  j                  t        j                         d      S )NTORCH_COMPILE_DEBUG_DIRtorch_compile_debug)
osenvironpathjoinr	   tempfile
gettempdirgetpassgetusergetcwd)DEBUG_DIR_VAR_NAMEs    T/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/torch/_dynamo/config.pydefault_debug_dir_rootr[   w  s    2RZZ'ww||BJJ'9:<QRR	ww||!7??#46K
 	
 ww||BIIK)>??    >   repro_afterrepro_levelconstant_functionsr3    capture_profiler_record_functionreorderable_logging_functions.ignore_logging_functionsz-torch._dynamo.config.ignore_logging_functionsignore_logger_methods)layoutis_negis_conj	is_pinned)stridestorage_offsetis_contiguous TORCH_FAKE_TENSOR_DISPATCH_CACHE+TORCH_FAKE_TENSOR_DISPATCH_CACHE_CROSSCHECKTORCH_CACHING_PRECOMPILETORCH_STRICT_PRECOMPILE!compiled_autograd_kwargs_overrideTORCH_COMPILER_COLLECTIVES"TORCHDYNAMO_ENABLE_P2P_COMPILATIONz7pytorch/remote_cache:enable_local_automatic_dynamic_pgo(TORCH_DYNAMO_AUTOMATIC_DYNAMIC_LOCAL_PGO)rJ   env_name_forcer   automatic_dynamic_local_pgo)TORCH_DYNAMO_AUTOMATIC_DYNAMIC_REMOTE_PGOautomatic_dynamic_remote_pgoUNSAFE_SKIP_FSDP_MODULE_GUARDSPT2_COMPILE_ID_PREFIXpt2_compile_id_prefixPy_GIL_DISABLEDz,pytorch/compiler:enable_run_gc_after_compile!TORCH_DYNAMO_RUN_GC_AFTER_COMPILE)r   rJ   env_name_default_custom_ops_profile'enable_invoke_subgraph_regional_compileinline_invoke_subgraph#invalidate_compile_context_weakrefs)*changesc                       y )N )r   s    rZ   _make_closure_patcherr     s    r\   )__doc__rV   rP   sys	sysconfigrT   collections.abcr   os.pathr   r   typingr   r   r   torch._environmentr	   torch.utils._config_moduler
   r   r   r   str__annotations__rQ   getverboseverify_correctnessr   r   r   leaf_function_validate_outputs%leaf_function_check_escaped_gradientsminimum_call_countdead_code_eliminationreplay_side_effectsside_effect_replay_policyrecompile_limitaccumulated_recompile_limitr   boolfail_on_recompile_limit_hitr!   intr"   r#   r$   specialize_intspecialize_floatdynamic_shapesuse_lazy_graph_moduleassume_static_by_defaultautomatic_dynamic_shapesr)   !automatic_dynamic_exclusion_guardlog_graph_in_out_metadataforce_parameter_static_shapes&force_nn_module_property_static_shapesallow_ignore_mark_dynamicguard_nn_modules guard_nn_modules_using_dict_tagsprepare_freezingsetr+   typer,   suppress_errorsreplay_record_enabled rewrite_assert_with_torch_assertdisablecprofiler2   r3   dict*allowed_functions_module_string_ignorelistr]   r^   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_guards3force_unspec_int_unbacked_size_like_on_torchrec_kjtallow_unspec_int_on_nn_modulerD   rF   skip_torchrecdont_skip_tracingoptimize_ddp_lazy_compile#use_lamba_guard_for_object_aliasingskip_fsdp_guardsskip_fsdp_hooksskip_nnmodule_hook_guards,skip_no_tensor_aliasing_guards_on_parameters*skip_tensor_guards_with_matching_dict_tags%skip_guards_on_constant_func_defaults)assume_dunder_attributes_remain_unchanged"use_recursive_dict_tags_for_guards0max_saved_pointers_for_recursive_dict_tags_checkraise_on_ctx_manager_usageraise_on_unsafe_aot_autograderror_on_nested_jit_traceerror_on_nested_fx_traceforce_compile_during_fx_trace	allow_rnncapture_sparse_computeerror_on_recompilereport_guard_failures__file__base_dirtrace_numpytrace_autograd_opsnumpy_default_floatnumpy_default_complexnumpy_default_intuse_numpy_random_streamenable_cpp_guard_manager enable_cpp_symbolic_shape_guardsenable_trace_contextlibenable_trace_unittest"enable_faithful_generator_behaviorinline_inbuilt_nn_modulesrK   3error_on_dynamo_callback_in_fullgraph_compiled_codeinstall_free_tensorsinstall_free_tensors_for_export!enable_cpp_framelocals_guard_evaluse_graph_deduplicationtrack_nodes_for_deduplicationgraph_deduplication_lintissue_3_13_0_warningallow_empty_graphsdebug_force_nested_calls&debug_force_graph_break_on_leaf_returndebug_disable_compile_counter%record_compile_time_instruction_countr[   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_transformsr`   log_compilation_metricsra   rb   rc   +inject_BUILD_SET_unimplemented_TESTING_ONLY)_autograd_backward_strict_mode_banned_ops5_autograd_backward_strict_mode_conditional_banned_opsfake_tensor_cache_enabled$fake_tensor_cache_crosscheck_enabled"fake_tensor_disable_inference_modecaching_precompilestrict_precompilecompiled_autogradenable_dynamo_decompositionsgraph_break_on_nn_param_ctor#inline_torch_dispatch_torch_compile-skip_fwd_side_effects_in_bwd_under_checkpointro   enable_compiler_collectivesenable_p2p_compilationrt   rv   _unsafe_skip_fsdp_module_guardsry   get_config_varrun_gc_after_compile'constant_fold_autograd_profiler_enabledwrap_top_framerecord_runtime_overheadenable_aot_compiler}   r~   r   r   torch.utils._config_typingr   modules__name__r   r\   rZ   <module>r     s  
  	 
   $ $ . . ( V V !sTz   **...
4
;   !jjnn-NPRS  S ')jjnn-r'   %'JJNN+R% c  "'  ). %       #   " 39T7M4 *D  $ %KL # L$*
<% c  06
K.0 &  !'
<!   
    JJNN8#>#E     JJNN:C@CG 
 DM  '*?"@ L( %* ! "  !% 
 *. & "    $(  
 ::>>"@#F#M  /2e Sc^ 3 25 DI 6 rzz~~&CUKL
 

'DcJcQ  $(   **..0#
6#
= ::>>2E: !jjnn-LeT T 57 !4S> 6&. * jjnn6= "**..!:A>? ZZ^^$DEL 
  jjnn%FG3N    
 (LMQTT  JJNNA3G3N !
 /4 + 7< 3 !& 4 	 		  JJNN=sCsJ T 
    "  '+ #   
 !  04 , .2 * ). %& -1 ) &+ " 47 0 "   %  !    
 !&  	 '[ 
     7778#4567      $         $)       &* " #9X	  " T ! 7< 3
   #'  %) !    !&  ! 
     !  */ &
 !&  ). %
@ 
@ ()  ). % ,1 (  %  !    */  $ .   =@E s8SE4K#89 A 58E #hsCx01 9 28
92 s8CH-.  /4 +- )9 5 JJNN5s;sB  JJNN@#F#M % &* " ZZ^^$>DK JJNN#<cBcI     $   $  '+ # 16 - 57 !4S> 6: !jjnn-I3OSVV  JJNN7=D 2 %+F=% T  -=/- dTk  JJNN3S9S@  
 %'JJNN3JD$Q sTz Q $I$$%671<;8	  +0 '      #' S4Z & 16 ' 5  %  $ 48 #TD[ 7,999 ckk(+ ,r\   