Skip to content

Add logging knob to control console output#44

Merged
erwei-xilinx merged 5 commits intomainfrom
feature/logging-knob-issue-40
Apr 11, 2026
Merged

Add logging knob to control console output#44
erwei-xilinx merged 5 commits intomainfrom
feature/logging-knob-issue-40

Conversation

@erwei-xilinx
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces 11 print() calls in driver.py with Python's logging module, controlled by a new AMD_TRITON_NPU_DEBUG environment variable
  • By default (unset or 0), only warnings are shown — no compilation messages clutter stdout during normal runs
  • Set AMD_TRITON_NPU_DEBUG=1 to restore verbose output (cache hits, tiling script paths, compile-only mode details)
  • Autotuning prints remain gated by knobs.autotuning.print and are unaffected

Closes #40

Test plan

  • Run an example kernel without AMD_TRITON_NPU_DEBUG — verify no compilation prints on stdout
  • Run with AMD_TRITON_NPU_DEBUG=1 — verify same output as before this change
  • Run with AMD_TRITON_NPU_COMPILE_ONLY=1 + AMD_TRITON_NPU_DEBUG=1 — verify compile-only messages appear
  • Run same kernel twice with AMD_TRITON_NPU_DEBUG=1 — verify cache hit message appears
  • Verify autotuning prints still controlled by knobs.autotuning.print

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 9, 2026 22:28
Addresses #40 — compilation messages (cache hits, tiling script paths,
compile-only output) now use Python's logging module instead of print().
By default the logger is set to WARNING (silent on success). Set
AMD_TRITON_NPU_DEBUG=1 to restore verbose output at DEBUG level.
Autotuning prints remain gated by knobs.autotuning.print.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces several print() statements in the NPU backend driver with Python logging, introducing an AMD_TRITON_NPU_DEBUG environment variable intended to control whether compilation/cache-related messages appear on the console.

Changes:

  • Added a module logger and an AMD_TRITON_NPU_DEBUG-controlled logging setup.
  • Converted selected compilation/cache/tiling-script console prints to logger.info(...).
  • Converted device-detection error prints to logger.warning(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

erwei-xilinx and others added 3 commits April 9, 2026 15:34
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ects

- Set logger default to WARNING so info/debug messages stay suppressed
  even when the embedding app configures root logger to INFO
- Replace logging.basicConfig() with a module-local StreamHandler using
  a message-only formatter to avoid global side effects
- Set logger.propagate = False to isolate from app logging config
- Change all logger.info() to logger.debug() since these are verbose
  debug messages, not standard informational output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… failures

- Default log level → CRITICAL per reviewer request (suppress all non-critical)
- xrt-smi CalledProcessError → logger.error (was warning)
- Unexpected Exception → logger.exception (includes traceback)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
erwei-xilinx added a commit that referenced this pull request Apr 11, 2026
- Treat None as "unset" in air_project_path setter (reverts to
  env var / default instead of crashing with Path(None))
- Use __dict__.copy() in config_context() so new fields are
  automatically saved/restored
- Mention both config property and env var in error messages
  for output_format and transform_tiling_script
- Incorporate PR #44 logging changes (rebase on top of
  feature/logging-knob-issue-40)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
erwei-xilinx added a commit that referenced this pull request Apr 11, 2026
- Treat None as "unset" in air_project_path setter (reverts to
  env var / default instead of crashing with Path(None))
- Use __dict__.copy() in config_context() so new fields are
  automatically saved/restored
- Mention both config property and env var in error messages
  for output_format and transform_tiling_script
- Incorporate PR #44 logging changes (rebase on top of
  feature/logging-knob-issue-40)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erwei-xilinx erwei-xilinx merged commit b1057bd into main Apr 11, 2026
8 of 9 checks passed
@erwei-xilinx erwei-xilinx deleted the feature/logging-knob-issue-40 branch April 11, 2026 05:32
erwei-xilinx added a commit that referenced this pull request Apr 11, 2026
- Treat None as "unset" in air_project_path setter (reverts to
  env var / default instead of crashing with Path(None))
- Use __dict__.copy() in config_context() so new fields are
  automatically saved/restored
- Mention both config property and env var in error messages
  for output_format and transform_tiling_script
- Incorporate PR #44 logging changes (rebase on top of
  feature/logging-knob-issue-40)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Knob to disable printing to console

3 participants