Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfcs: proposal for a verbose logging mechanism #1827

Open
wants to merge 1 commit into
base: rfcs
Choose a base branch
from

Conversation

avmanerikar
Copy link
Contributor

Link to rendered document.

@avmanerikar avmanerikar added the RFC A design document label Mar 12, 2024
Copy link
Contributor

@mgouicem mgouicem left a comment

Choose a reason for hiding this comment

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

I think a few things are to be clarified here:

  • spdlog exposes its own environment variables: how would those interact with ONEDNN_VERBOSE setting?
    For example if a user does not set ONEDNN_VERBOSE, but sets SPDLOG_LEVEL=TRACE, would oneDNN print ? Or if a user sets both, do they combine/override each other?
  • if we expose new environment variables, matching APIs will need to be exposed to programatically control that
  • in few of the links you provide, spdlog v1 is used, but it seems there are newer releases. Is the recommendation to go with v1 or a specific version?
  • Which kind of logger would we use in oneDNN? IIUC, spdlog provides multiple loggers with different properties? In particular, flushing at every message can be necessary for debugging purpose, is there control for that?

rfcs/20240311-verbose-logging-support/README.md Outdated Show resolved Hide resolved
rfcs/20240311-verbose-logging-support/README.md Outdated Show resolved Hide resolved

### 2. Runtime Logging Controls
A basic requirement for implementing logging support will be to define the environmental control variables which the user can specify to manage oneDNN data logging.
For the simple case where the logging mechanism involves directly dumping the verbose outputs into a logfile, this can be accomplished with two control variables, one for enabling the data logging (`ENABLE_ONEDNN_LOGGING`) and the other for specifying the logfile path (`ONEDNN_LOGFILE=/path/to/file`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you clarify why is ENABLE_ONEDNN_LOGGING needed?

IIUC, we are switching to spdlog internally for all prints. Based on that, I would expect that only ONEDNN_VERBOSE_FILE is needed, with stdout its default value.

Also, environment variable typically need a matching API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! The specification of a logfile path should be enough to enable logging in oneDNN. Updating RFC accordingly.

| 2 | SPDLOG_LEVEL_INFO | `check`,`profile_create`, `profile_exec`, `profile` |
| 3 | SPDLOG_LEVEL_WARNING | --- |
| 4 | SPDLOG_LEVEL_ERROR | `error` |
| 5 | SPDLOG_LEVEL_CRITICAL | - |
Copy link
Contributor

Choose a reason for hiding this comment

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

in which direction does the mapping go here?

  • Is it that oneDNN verbose error messages will be logged with spdlog using SPDLOG_LEVEL_ERROR
  • or is it that if a user sets an SPDLOG env variable, we will activate those ONEDNN_VERBOSE flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The direction of logging will be from oneDNN to spdlog since no SPDLOG environmental variables are to be used.

@avmanerikar avmanerikar force-pushed the amanerik/rfcs/verbose-logging-support branch from 7528ec8 to 223e571 Compare March 20, 2024 18:40
@avmanerikar
Copy link
Contributor Author

I think a few things are to be clarified here:

  • spdlog exposes its own environment variables: how would those interact with ONEDNN_VERBOSE setting?
    For example if a user does not set ONEDNN_VERBOSE, but sets SPDLOG_LEVEL=TRACE, would oneDNN print ? Or if a user sets both, do they combine/override each other?
  • if we expose new environment variables, matching APIs will need to be exposed to programatically control that
  • in few of the links you provide, spdlog v1 is used, but it seems there are newer releases. Is the recommendation to go with v1 or a specific version?
  • Which kind of logger would we use in oneDNN? IIUC, spdlog provides multiple loggers with different properties? In particular, flushing at every message can be necessary for debugging purpose, is there control for that?
  • The expectation is to not use any of the SPDLOG environmental variables to control logging in oneDNN. With a header-based approach, one can build spdlog without the support for logging using argv /environment var. That way, logging is only controlled programmatically and by using the ONEDNN_VERBOSE settings.
  • The latest stable release for spdlog is v1.13 and that is the recommended version to use for logging support. While there is a master branch for spdlog, it is old and deprecated - v1.x is the actual master branch to be used. (See Question: What are the differences in version v.1, master and release gabime/spdlog#1346).
  • The proposal is to use a rotating logger for oneDNN as defined here for spdlog. The rotating logger type is useful for keeping the maximum file size in check as the data is logged from several sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC A design document
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants