Commit e5e36dbf authored by Lei Wang's avatar Lei Wang Committed by LeiWang1999
Browse files

[Enhancement] Optimize debug info for auto tuning (#560)



* [Enhancement] Update AutoTuner and JIT compilation arguments

* Added functionality to return compile arguments in the JIT implementation, enhancing the autotuner's caching capabilities.
* Modified `CompileArgs` and `AutotuneResult` classes to support optional `out_idx` parameter, improving flexibility in compile argument handling.
* Refactored the `_AutoTunerImplementation` to utilize the new compile arguments, ensuring better integration and performance during tuning processes.

* Update tilelang/autotuner/param.py
Co-authored-by: default avatargemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* remove redundant comments

* Refactor kernel source retrieval and logging levels

* Updated `AutotuneResult` to use `kernel.get_kernel_source()` instead of `kernel.adapter.get_kernel_source()`.
* Changed logging level in `KernelCache` from `ERROR` to `DEBUG` for improved verbosity during kernel caching operations.
* Removed unnecessary verbose logging in JIT compilation process to streamline output.

* Merge branch 'main' of https://github.com/tile-ai/tilelang

 into bugfix_autotune_0604

* lint fix

---------
Co-authored-by: default avatargemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent 225aca61
......@@ -179,7 +179,7 @@ class AutotuneResult:
try:
wrapped_kernel_path = os.path.join(cache_path, WRAPPED_KERNEL_PATH)
with open(wrapped_kernel_path, "w") as f:
f.write(kernel.adapter.get_kernel_source())
f.write(kernel.get_kernel_source())
except Exception as e:
logger.error(f"Error saving wrapped kernel source code to disk: {e}")
......
......@@ -61,7 +61,7 @@ class KernelCache:
os.makedirs(instance.cache_dir, exist_ok=True)
instance.logger = logging.getLogger(__name__)
instance.logger.setLevel(logging.ERROR)
instance.logger.setLevel(logging.DEBUG)
instance._memory_cache = {} # Initialize memory cache
cls._instance = instance
return cls._instance
......@@ -160,10 +160,16 @@ class KernelCache:
" consider using `@tilelang.jit` instead of direct kernel caching.")
return self._memory_cache[key]
if verbose:
self.logger.debug(f"Checking disk cache for kernel {func.attrs['global_symbol']}")
# Then check disk cache
kernel = self._load_kernel_from_disk(key, target, target_host, out_idx,
execution_backend, pass_configs, func)
if kernel is not None:
if verbose:
self.logger.debug(
f"Found kernel in disk cache for {func.attrs['global_symbol']}")
# Populate memory cache with disk result
self._memory_cache[key] = kernel
return kernel
......
......@@ -193,9 +193,6 @@ class _JitImplementation:
else:
raise ValueError(f"Invalid function type: {type(program_result_source)}")
if self.verbose:
logger.info(f"Verbose: Compiling for program \n {program_result.script()}")
kernel_result = compile(
program_result,
out_idx=self.out_idx,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment