Skip to content

Commit 98ad6ef

Browse files
author
jax authors
committed
Add debug logging for autotune profile sharing.
PiperOrigin-RevId: 614915339
1 parent 2804cc7 commit 98ad6ef

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

jax/_src/compiler.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ def _compile_and_write_autotune_config(
357357
)
358358

359359
if os.path.exists(autotune_tmp_file):
360+
logger.debug(
361+
"Compiling module: %s. Use existing autotune config file: %s",
362+
module_name,
363+
autotune_tmp_file,
364+
)
360365
debug_options.xla_gpu_load_autotune_results_from = autotune_tmp_file
361366
return _compile_and_write_cache(
362367
backend,
@@ -369,6 +374,7 @@ def _compile_and_write_autotune_config(
369374

370375
if distributed.global_state.process_id == 0:
371376
debug_options.xla_gpu_dump_autotune_results_to = autotune_tmp_file
377+
logger.debug("Compiling and dumping autotune for module: %s", module_name)
372378
executable = _compile_and_write_cache(
373379
backend,
374380
computation,
@@ -377,20 +383,47 @@ def _compile_and_write_autotune_config(
377383
module_name,
378384
cache_key,
379385
)
386+
387+
logger.debug(
388+
"Writing autotune config for module %s to %s",
389+
module_name,
390+
autotune_tmp_file,
391+
)
380392
with open(autotune_tmp_file, "rb") as f:
381393
autotune_config = f.read()
382394

383395
autotune_config = compilation_cache.compress_executable(autotune_config)
384396
global_client.key_value_set_bytes(cache_key, autotune_config)
397+
logger.debug(
398+
"Autotune config for module %s with size %d shared by cache_key %s",
399+
module_name,
400+
len(autotune_config),
401+
cache_key,
402+
)
385403
else:
404+
logger.debug(
405+
"Compiling module %s, waiting for config to be shared by cache_key %s",
406+
module_name,
407+
cache_key,
408+
)
386409
autotune_config = global_client.blocking_key_value_get_bytes(
387410
cache_key, share_timeout
388411
)
389412

413+
logger.debug(
414+
"Received autotune config for module %s of size %d",
415+
module_name,
416+
len(autotune_config),
417+
)
390418
autotune_config = compilation_cache.decompress_executable(autotune_config)
391419
with open(autotune_tmp_file, "wb") as f:
392420
f.write(autotune_config)
393421

422+
logger.debug(
423+
"Compiling module %s, using autotune config from %s",
424+
module_name,
425+
autotune_tmp_file,
426+
)
394427
debug_options.xla_gpu_load_autotune_results_from = autotune_tmp_file
395428
executable = _compile_and_write_cache(
396429
backend,

0 commit comments

Comments
 (0)