Skip to content

Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (#1389)#1389

Closed
Raymo111 wants to merge 1 commit into
pytorch:mainfrom
Raymo111:export-D98533235
Closed

Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (#1389)#1389
Raymo111 wants to merge 1 commit into
pytorch:mainfrom
Raymo111:export-D98533235

Conversation

@Raymo111
Copy link
Copy Markdown
Contributor

@Raymo111 Raymo111 commented May 5, 2026

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Reviewed By: scotts

Differential Revision: D98533235

Copilot AI review requested due to automatic review settings May 5, 2026 21:37
@meta-cla meta-cla Bot added the cla signed label May 5, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 5, 2026

@Raymo111 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D98533235.

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 updates libkineto's stage/USDT logging macros so they no longer expand through LOG(...), avoiding build failures when glog transitively redefines LOG in translation units that include both headers.

Changes:

  • Replaced UST_LOGGER_MARK_COMPLETED with a direct libkineto::Logger(...).stream() expansion.
  • Replaced USDT_LOGGER_EMIT_MESSAGE similarly to avoid LOG macro substitution at the call site.
  • Kept the higher-level USDT_EMIT_START_TRACE / USDT_EMIT_STOP_TRACE helpers unchanged.

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

Comment thread libkineto/src/Logger.h Outdated
Comment on lines +257 to +265
// glog/logging.h.
#define UST_LOGGER_MARK_COMPLETED(stage) \
libkineto::VoidLogger() & \
libkineto::Logger(libkineto::LoggerOutputType::STAGE, __LINE__, __FILE__).stream() \
<< "Completed Stage: " << stage

#define USDT_LOGGER_EMIT_MESSAGE(usdt_type) \
libkineto::VoidLogger() & \
libkineto::Logger(libkineto::LoggerOutputType::USDT, __LINE__, __FILE__).stream() << usdt_type
Comment thread libkineto/src/Logger.h Outdated
Comment on lines +263 to +265
#define USDT_LOGGER_EMIT_MESSAGE(usdt_type) \
libkineto::VoidLogger() & \
libkineto::Logger(libkineto::LoggerOutputType::USDT, __LINE__, __FILE__).stream() << usdt_type
@meta-codesync meta-codesync Bot changed the title Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (#1389) May 6, 2026
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 6, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235




Signed-off-by: Raymond Li <raymo@meta.com>
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from 2b680c0 to aabfddd Compare May 6, 2026 20:34
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 6, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235




Signed-off-by: Raymond Li <raymo@meta.com>
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from aabfddd to 2e73ebd Compare May 6, 2026 22:04
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 11, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from 2e73ebd to aca90bc Compare May 11, 2026 20:26
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 11, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from aca90bc to a77f61e Compare May 11, 2026 20:57
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 11, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from a77f61e to 8f19706 Compare May 11, 2026 21:02
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 12, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235




Signed-off-by: Raymond Li <raymo@meta.com>
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from 8f19706 to 1934a92 Compare May 12, 2026 00:09
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 12, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235




Signed-off-by: Raymond Li <raymo@meta.com>
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from 1934a92 to 01ca837 Compare May 12, 2026 20:09
Raymo111 added a commit to Raymo111/kineto that referenced this pull request May 13, 2026
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Differential Revision: D98533235




Signed-off-by: Raymond Li <raymo@meta.com>
@Raymo111 Raymo111 force-pushed the export-D98533235 branch from 01ca837 to a52c3d5 Compare May 13, 2026 20:26
…ytorch#1389)

Summary:

The UST_LOGGER_MARK_COMPLETED, USDT_LOGGER_EMIT_MESSAGE, and USDT_EMIT_START_TRACE
macros in Logger.h expanded to LOG(libkineto::LoggerOutputType::STAGE), which relies
on kineto's custom LOG macro. However, glog's LOG macro (included transitively via
ust_logger_collector -> fb_device_utils -> glog) redefines LOG to
COMPACT_GOOGLE_LOG_##severity, producing the nonsensical identifier
COMPACT_GOOGLE_LOG_libkineto at the call site.

These macros now expand directly to the underlying
libkineto::VoidLogger() & libkineto::Logger(...).stream() expression, making them
immune to glog redefining LOG at the call site.

Reviewed By: scotts

Differential Revision: D98533235
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 15, 2026

This pull request has been merged in 60967ce.

pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request May 22, 2026
Includes the following commits:

- ci: declare workflow-level `contents: read` on 5 workflows (pytorch/kineto#1404) 5902263
- Remove deprecated `REQUEST_TIMESTAMP` config key (pytorch/kineto#1409) 55883de
- Fix intermittent Mac CI failure from conda channel reset (pytorch/kineto#1407) ee27b5c
- Add nlohmann/json as a top-level third_party submodule (pytorch/kineto#1406) c044281
- Remove SIGUSR2 on-demand profiling path (pytorch/kineto#1408) 471ed38
- Fix ROCm HtoD memcpy stream attribution (pytorch/kineto#1398) 799b5f4
- Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (pytorch/kineto#1389) 60967ce
- Remove `DefaultTimeConverterIsIdentity` test (pytorch/kineto#1401) 81d31cd
- Re-enable most PyTorch tests (pytorch/kineto#1403) 212f9a5
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1402) 6481fac
- Resolve CUPTI cbid names via cuptiGetCallbackName (pytorch/kineto#1400) e07e121
- XPUPTI: Fix ts=0 trace events on Windows (pytorch/kineto#1381) 4c8d01c
- Remove LIBKINETO_NO* compatibility shim (pytorch/kineto#1399) ea8bc18
- Upgrade Kineto to C++20 (pytorch/kineto#1397) 77e2b46
- Update the rocm api filtering (pytorch/kineto#1392) e0ac578
Pull Request resolved: #184784
Approved by: https://github.com/NicolasHug, https://github.com/malfet
pytorchmergebot pushed a commit to khushi-411/pytorch that referenced this pull request May 24, 2026
Includes the following commits:

- ci: declare workflow-level `contents: read` on 5 workflows (pytorch/kineto#1404) 5902263
- Remove deprecated `REQUEST_TIMESTAMP` config key (pytorch/kineto#1409) 55883de
- Fix intermittent Mac CI failure from conda channel reset (pytorch/kineto#1407) ee27b5c
- Add nlohmann/json as a top-level third_party submodule (pytorch/kineto#1406) c044281
- Remove SIGUSR2 on-demand profiling path (pytorch/kineto#1408) 471ed38
- Fix ROCm HtoD memcpy stream attribution (pytorch/kineto#1398) 799b5f4
- Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (pytorch/kineto#1389) 60967ce
- Remove `DefaultTimeConverterIsIdentity` test (pytorch/kineto#1401) 81d31cd
- Re-enable most PyTorch tests (pytorch/kineto#1403) 212f9a5
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1402) 6481fac
- Resolve CUPTI cbid names via cuptiGetCallbackName (pytorch/kineto#1400) e07e121
- XPUPTI: Fix ts=0 trace events on Windows (pytorch/kineto#1381) 4c8d01c
- Remove LIBKINETO_NO* compatibility shim (pytorch/kineto#1399) ea8bc18
- Upgrade Kineto to C++20 (pytorch/kineto#1397) 77e2b46
- Update the rocm api filtering (pytorch/kineto#1392) e0ac578
Pull Request resolved: pytorch#184784
Approved by: https://github.com/NicolasHug, https://github.com/malfet
pytorchmergebot pushed a commit to gaurav-redhat/pytorch that referenced this pull request May 26, 2026
Includes the following commits:

- ci: declare workflow-level `contents: read` on 5 workflows (pytorch/kineto#1404) 5902263
- Remove deprecated `REQUEST_TIMESTAMP` config key (pytorch/kineto#1409) 55883de
- Fix intermittent Mac CI failure from conda channel reset (pytorch/kineto#1407) ee27b5c
- Add nlohmann/json as a top-level third_party submodule (pytorch/kineto#1406) c044281
- Remove SIGUSR2 on-demand profiling path (pytorch/kineto#1408) 471ed38
- Fix ROCm HtoD memcpy stream attribution (pytorch/kineto#1398) 799b5f4
- Fix UST_LOGGER_MARK_COMPLETED build failure in manifold_trace_logger (pytorch/kineto#1389) 60967ce
- Remove `DefaultTimeConverterIsIdentity` test (pytorch/kineto#1401) 81d31cd
- Re-enable most PyTorch tests (pytorch/kineto#1403) 212f9a5
- Daily `arc lint --take CLANGFORMAT` (pytorch/kineto#1402) 6481fac
- Resolve CUPTI cbid names via cuptiGetCallbackName (pytorch/kineto#1400) e07e121
- XPUPTI: Fix ts=0 trace events on Windows (pytorch/kineto#1381) 4c8d01c
- Remove LIBKINETO_NO* compatibility shim (pytorch/kineto#1399) ea8bc18
- Upgrade Kineto to C++20 (pytorch/kineto#1397) 77e2b46
- Update the rocm api filtering (pytorch/kineto#1392) e0ac578
Pull Request resolved: pytorch#184784
Approved by: https://github.com/NicolasHug, https://github.com/malfet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants