Skip to content

Configurable Environment Variables

This document summarizes all core configurable environment variables in cache-dit, which control key functionalities such as logging behavior, parallel computing strategies, model adaptation, compilation optimization, and patch tool logic.

  • CACHE_DIT_LOG_LEVEL, default "info", Controls the logging level of cache-dit.
  • CACHE_DIT_LOG_DIR, default None, Specifies the directory for cache-dit log files (if not set, logs are output to console by default).
  • CACHE_DIT_UNEVEN_HEADS_COMM_NO_PAD, default False (0), Enables unpadded communication for uneven attention heads (avoids padding overhead) when set to 1.
  • CACHE_DIT_FLUX_ENABLE_DUMMY_BLOCKS, default True (1), For developer use only – controls whether dummy blocks are enabled for FLUX models (enabled by default). Users should NOT use this variable directly.
  • CACHE_DIT_NUCLEUS_MOE_GROUPED_MM_OFFSETS_FIX, default False (0), Opt-in workaround for torch.compile with NucleusMoE-Image. Upstream SwiGLUExperts._run_experts_grouped_mm builds the grouped-GEMM offsets with torch.cumsum(..., dtype=torch.int32), but inductor drops the dtype argument, so the compiled graph passes int64 offsets and aten._grouped_mm raises. Set to 1 (before importing cache-dit, or call cache_dit.patch_nucleus_moe_grouped_mm_offsets()) to install cache-dit's int32-safe copy of that method.
  • CACHE_DIT_EPILOGUE_PROLOGUE_FUSION, default True (1), Enables epilogue and prologue fusion in cache-dit's torch.compile optimizations. Set to 0 to disable; an explicit epilogue_prologue_fusion keyword passed to set_compile_configs takes precedence.
  • CACHE_DIT_ENABLE_COMPILE_COMPUTE_COMM_OVERLAP, default True (1), Enables compute-communication (all-reduce) overlap during cache-dit compilation. Enabled by default for better performance; set to 0 to disable.
  • CACHE_DIT_FORCE_DISABLE_CUSTOM_COMPILE_CONFIG, default False (0), Forces disabling cache-dit's custom torch.compile configurations when set to 1 (by default, custom configs are used for better performance).
  • CACHE_DIT_PATCH_FUNCTOR_DISABLE_DIFFUSERS_CHECK, default False (0), Disables the check for whether the model originates from the diffusers library in patch functors when set to 1.
  • CACHE_DIT_FORCE_ONLY_RANK0_LOGGING, default True (1), Forces only rank 0 to output logs (recommended for distributed training to avoid cluttered logs). Set to 0 to allow logging from all ranks.
  • CACHE_DIT_ENABLE_LOGGERS_SUPPRESS, default False (0), Force enable loggers suppress in cache-dit by setting the environment variable to 1. By default, cache-dit DON'T suppresses some noisy loggers. Users can set this variable to 1 to suppress these loggers globally, which is recommended for better log readability.
  • CACHE_DIT_DISABLE_EXCLUDE_FOR_QUANTIZE_AFTER_TP, default False (0), For developer use only – controls whether to disable the temporary workaround of excluding some layers from quantization after applying tensor parallelism. Users should NOT use this variable directly.
  • CACHE_DIT_FUSED_OPS, default unset, The single switch for cache-dit's fused model operators (FLUX.2-Klein, FLUX.3-Klein, Qwen-Image 2.1, Boogu-Image). Unset: off until a cache-dit entry point installs the fused transformer — _Flux2KleinPipeline.from_pretrained, _QwenImage21Pipeline.from_pretrained, the flux3_fused model registration, or a direct upgrade_transformer() — which turns the operators on by default, so a pipeline that only goes through stock diffusers needs no configuration. Boogu-Image has no separate install step: constructing BooguImageTransformer2DModel (what its own pipeline does) is its activation point. 1: on wherever a fused transformer is installed. 0: off, every operator runs the literal eager expression, and the attention seams that hold a kernel (FLUX.2 and Qwen-Image 2.1) are not installed; FLUX.3 still swaps in its fused attention processor, whose operator takes the eager branch, and Boogu-Image keeps its block forwards and evaluates the pre-fusion chain. Set it before the first fused pipeline is built in the process — the switch is a module global that only the install writes. This is an optional optimization, not a faster torch.compile: measured on torch 2.15 (RTX PRO 5000, 1024x1024, 16 steps) the fused arm is at parity with a compiled baseline (FLUX.3-Klein: 236.4 ms/forward with and without the operators), and Qwen-Image 2.1 measured -1% on that arm (369.2 against 372.9 ms/step, torch 2.11); the gain only exists against the eager baseline, where FLUX.3-Klein improves -16.7%, because inductor already fuses the same chains at the DRAM ceiling. This is now the only fused-ops variable: the per-model CACHE_DIT_{FLUX2_KLEIN,FLUX3_KLEIN,QWEN_IMAGE21,BOOGU}_FUSED_OPS switches and their _OPS (operator allow-list), _ROPE_CACHE and _JOIN companions are all gone — per-operator selection is a code constant (ACTIVE_OPS) that an A/B run narrows by assignment.

Key Notes

  1. Boolean-type variables are parsed from integer values: 1 = True (enabled), 0 = False (disabled).

  2. Variables marked "internal use only" or "developer use only" should not be modified by end users.

  3. Ulysses variants such as ulysses_anything, ulysses_head_chunk, ulysses_head_chunk_groups, quant_communicate_kwargs, and ulysses_async are configured through ParallelismConfig and internal _ContextParallelConfig, not environment variables.

  4. CACHE_DIT_FUSED_OPS is the exception to note 1: it is tri-state (unset / 1 / 0) and reads the falsey strings 0, false, off, no; any other value counts as enabled.