config.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (c) Facebook, Inc. and its affiliates.
  2. # All rights reserved.
  3. #
  4. # This source code is licensed under the BSD-style license found in the
  5. # LICENSE file in the root directory of this source tree.
  6. """
  7. Global flags for aot autograd
  8. """
  9. import os
  10. import sys
  11. import logging
  12. use_functionalize = True
  13. use_fake_tensor = True
  14. # can be useful for debugging if we are incorrectly creating meta fake tensors
  15. fake_tensor_allow_meta = os.environ.get("FAKE_ALLOW_META", True)
  16. # Enables optional asserts in hotpath code to check for errors. If
  17. # you are seeing weird accuracy problems, try turning this on.
  18. # For now, to more easily identify bugs, this is turned on by default.
  19. debug_assert = True
  20. debug_fake_cross_ref = os.environ.get("AOT_FAKE_CROSSREF", False)
  21. debug_partitioner = os.environ.get("AOT_PARTITIONER_DEBUG", False)
  22. # Prints out forward + backwards FX graphs
  23. debug_graphs = os.environ.get("AOT_FX_GRAPHS", False)
  24. # Prints out joint graph traced, before partitioning
  25. debug_joint = os.environ.get("AOT_FX_GRAPHS_JOINT", False)
  26. use_dynamic_shapes = os.getenv("AOT_DYNAMIC_SHAPES", False)
  27. static_weight_shapes = True
  28. # Applies CSE to the graph before partitioning
  29. cse = True
  30. # Restricts the amount of computation AOTAutograd can do.
  31. max_dist_from_bw = 3
  32. log_level = (
  33. logging.DEBUG if debug_partitioner or debug_graphs or debug_joint else logging.INFO
  34. )
  35. from .._dynamo.config_utils import install_config_module
  36. # adds patch, save_config, invalid config checks, etc
  37. install_config_module(sys.modules[__name__])