Point cache env vars to the Modal volume and enable Triton autotune logging. XDG_CACHE_HOME: used by flashinfer, torch.compile, etc. TRITON_CACHE_DIR: used by Triton for compiled kernels and autotune results. Triton ignores XDG_CACHE_HOME and reads TRITON_CACHE_DIR (or TRITON_HOME) inst
()
| 120 | |
| 121 | |
| 122 | def set_volume_caches(): |
| 123 | """Point cache env vars to the Modal volume and enable Triton autotune logging. |
| 124 | |
| 125 | XDG_CACHE_HOME: used by flashinfer, torch.compile, etc. |
| 126 | TRITON_CACHE_DIR: used by Triton for compiled kernels and autotune results. |
| 127 | Triton ignores XDG_CACHE_HOME and reads TRITON_CACHE_DIR (or TRITON_HOME) instead. |
| 128 | TRITON_PRINT_AUTOTUNING: surfaces autotune progress so silent waits |
| 129 | (cold cache, hangs) are debuggable from the run log. |
| 130 | """ |
| 131 | os.environ["XDG_CACHE_HOME"] = f"{volume_path}/cache" |
| 132 | os.environ["TRITON_CACHE_DIR"] = f"{volume_path}/cache/triton" |
| 133 | os.environ["TRITON_PRINT_AUTOTUNING"] = "1" |
| 134 | |
| 135 | |
| 136 | def add_library_code(image: modal.Image) -> modal.Image: |
no outgoing calls