feat: Add --disable-traceml flag for true zero-overhead no-op mode#51
Merged
abhinavsriva merged 5 commits intotraceopt-ai:mainfrom Mar 15, 2026
Merged
feat: Add --disable-traceml flag for true zero-overhead no-op mode#51abhinavsriva merged 5 commits intotraceopt-ai:mainfrom
abhinavsriva merged 5 commits intotraceopt-ai:mainfrom
Conversation
Signed-off-by: ppraneth <pranethparuchuri@gmail.com>
abhinavsriva
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #50
This PR introduces a true no-op mode via the
--disable-tracemlCLI flag (andTRACEML_DISABLEDenvironment variable).Previously, users had to manually remove
import tracemland instrumentation wrappers (like@trace_stepor Lightning/HF callbacks) from their code to run clean benchmarks or execute natively. With this PR, users can leave all TraceML instrumentation exactly as-is. Passing the flag safely short-circuits all TraceML logic, providing exactly native PyTorch performance.Changes Implemented
cli.py): Bypasses the background aggregator subprocess and directly launches the user script viatorchrun.executor.py): Intercepts the disable flag to skipTraceMLRuntimeinitialization, falling back to a safeNoOpRuntimeto prevent background threads/TCP clients from spawning.decorators.py,timing.py): Public context managers (@trace_step,timed_region) and monkey-patches (patch_dataloader) safely yield or return immediately.hf_decorators.py,lightning.py): Hugging Face and PyTorch Lightning callbacks return instantly, completely skipping PyTorch hook attachments and gradient accumulation logic.step_memory.py,flush_buffers.py): CUDA max-memory trackers and global buffer flush methods safely short-circuit to ensure zero network/disk I/O.Native Execution (TraceML Disabled):
time traceml run --disable-traceml src/examples/simple_cnn.pyTraced Execution (TraceML Enabled):
time traceml run src/examples/simple_cnn.pyBenchmark Results