gemini-2.5-pro| input-price: 1.25 output-price: 10 max-context-length: 200_000 (cost: $0.05) Β· Anfrage: 2025-09-29T20:53:32.241594
Generated by rs-summarizer Version unbekannt
Abstract:
This tutorial provides a comprehensive overview of tools and techniques for debugging JAX programs, led by a JAX engineering manager. The session covers fundamental debugging methods, distinguishing between standard Python tools that operate at trace-time and specialized JAX APIs (jax.debug.print, jax.debug.breakpoint) designed for runtime inspection within JIT-compiled functions. The speaker emphasizes the performance implications of these debug tools, which can prevent XLA optimizations by materializing intermediate values. The tutorial details various JAX configurations for identifying issues such as frequent recompilations (JAX_LOG_COMPILES), NaN/Inf generation (jax_debug_nans), unintended data transfers (jax_transfer_guard), and memory leaks (jax.live_arrays). It also provides guidance on interpreting and reporting hard crashes like segmentation faults and check failures, which are typically bugs within the JAX/XLA framework itself. Finally, the session addresses the complexities of debugging in distributed, multi-host environments, offering strategies for identifying out-of-sync processes or host failures.
Navigating JAX Debugging: Tools and Techniques
print() and breakpoints only execute once during the initial "tracing" of a JIT-compiled function. To inspect values at runtime on every execution, you must use specialized APIs like jax.debug.print() and jax.debug.breakpoint().jax.debug APIs can negatively affect performance. They force XLA to materialize intermediate values, which can prevent compiler optimizations like operator fusion and increase memory pressure. These tools are best for functional debugging, not performance analysis.JAX_LOG_COMPILES will log every time a function is recompiled, and JAX_EXPLAIN_CACHE_MISSES provides detailed reasons why a cached function wasn't used.JAX_DEBUG_NANS or JAX_DEBUG_INFS flags will cause JAX to run the code in an eager, unoptimized mode to pinpoint the exact operation that created the invalid value.JAX_DISABLE_JIT=True. This effectively makes JAX run in an eager mode, as if the @jit decorators were commented out.jax.live_arrays() function returns a list of all JAX arrays currently allocated on the accelerator. This is useful for identifying memory leaks, especially in interactive environments like notebooks where references to arrays can be unintentionally kept alive.checkify: The jax.experimental.checkify transform allows you to add explicit, runtime error checks inside your JIT-compiled code (e.g., asserting that a value is positive). It modifies the function to return an additional output indicating if an error occurred.SIGSEGV) or a "Check failed" error, it is almost always a bug in the JAX or XLA C++ backend, not your code. These should be reported as issues to the JAX team.jax.custom_vjp. You can define a custom backward pass for a function that simply prints the incoming gradients before passing them along.