Make Event Tracing for Windows optional#7274
Open
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Open
Make Event Tracing for Windows optional#7274AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Conversation
… target with ETW disabled
Contributor
You can test this locally with the following command:git-clang-format --diff 206b77577d15fc5798eb7ad52290388539b7146d 62b74063e55ea1f53aa46396556d7d7214daa77c -- include/dxc/WinEtwAdapter.h include/dxc/WinAdapter.h projects/dxilconv/tools/dxilconv/dxilconv.cpp tools/clang/tools/dxcompiler/DXCompiler.cpp tools/clang/tools/dxcompiler/dxcapi.cpp tools/clang/tools/dxcompiler/dxcompilerobj.cpp tools/clang/tools/dxcvalidator/dxcvalidator.cpp tools/clang/tools/dxildll/dxildll.cpp tools/clang/tools/dxrfallbackcompiler/DXCompiler.cpp tools/clang/tools/dxrfallbackcompiler/dxcapi.cppView the diff from clang-format here.diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h
index 6c7fa254..45d23c6c 100644
--- a/include/dxc/WinAdapter.h
+++ b/include/dxc/WinAdapter.h
@@ -197,7 +197,8 @@
#define OutputDebugStringA(msg) fputs(msg, stderr)
#define OutputDebugFormatA(...) fprintf(stderr, __VA_ARGS__)
-// I have no idea if I don't break something like INSTALL targets, requires CI tests
+// I have no idea if I don't break something like INSTALL targets, requires CI
+// tests
#include "WinEtwAdapter.h"
#define UInt32Add UIntAdd
|
Contributor
Author
|
@microsoft-github-policy-service agree company="Devsh Graphics Programming Sp. z O.O." |
llvm-beanz
reviewed
Apr 3, 2025
| #include "dxc/config.h" | ||
| #include "dxc/dxcisense.h" | ||
| #include "dxc/dxctools.h" | ||
| #ifdef DXC_ENABLE_ETW |
Collaborator
There was a problem hiding this comment.
Cascading this across the codebase is undesirable. By design, the WinAdapter header can (and usually is) included whether or not you're on Windows. On Windows it just includes system headers.
It is probably a better approach to just update the WinAdapter to include the ETW adapters if ETW is not available (even on Windows). That avoids the need for a new header and simplifies this change significantly.
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.
The Microsoft Message Compiler dependency in the build system makes it impossible to build the project on Windows Nano Server, due to COM not being available in that distribution.
This PR resolves the issue by patching the build system to make ETW optional. It disables the tracing when DXC_ENABLE_ETW is turned off, using the same logic already applied when building for non-Windows platforms. When disabled, the code falls back to empty stubs.
This PR is a work in progress - currently, only the
dxcompilertarget has been built with MSVC 14.42.34433 and WinSDK 22621. A few links in case:dxcompilerbuild log (Nano Server LTSC2022 container)The ETW manifest (
dxcetw.man) is the only input for mc.exe. Its output includes a header and some .bin files (e.g., MSG00001.bin, dxcetwTEMP.bin after some copies in the custom command) but only the header (dxcetw.h) seems to be functionally required for building and please correct me if I'm wrong. The .bin files are generated and marked in CMake as GENERATED butso, would it make sense to commit the generated header directly into version control instead? It seems to be fully deterministic