Integrate the tracing::ExecutionContext() into mlir-opt with a new
--log-action-to=<file> option to demonstrate the feature.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Debug/Counter.h | ||
---|---|---|
50 | ||
mlir/lib/Debug/Observers/ActionLogging.cpp | ||
21 | The use of static atomic here is kind of sketchy, why is this necessary? | |
22 | llvm::get_threadid() | |
mlir/lib/Pass/PassDetail.h | ||
20 | Can you shift this to the bottom of the struct, with the other fields? | |
24–26 | I wonder if this would be cleaner using llvm::formatv | |
mlir/lib/Tools/mlir-opt/MlirOptMain.cpp | ||
42 | Are these two not already included? | |
259 |
Address comments
mlir/lib/Debug/Observers/ActionLogging.cpp | ||
---|---|---|
21 | It was necessary because of thread_local int64_t tid = thread_counter++; is a threaded initialization I believe. | |
22 | Replaced with llvm::get_threadid, but note that it makes the output less deterministic, I kind of liked having threads numbered from 0 to X | |
mlir/lib/Tools/mlir-opt/MlirOptMain.cpp | ||
42 | VSCode auto-added includes... |
mlir/include/mlir/Debug/Counter.h | ||
---|---|---|
51 | OOC why not just isActivated ? (the class is already DebugCounter and above the form is addCounter()) | |
mlir/include/mlir/Debug/Observers/ActionLogging.h | ||
1 | Outdated header? | |
mlir/lib/Debug/Observers/ActionLogging.cpp | ||
1 | Same | |
mlir/lib/Debug/Observers/CMakeLists.txt | ||
1 | So this library will contain multiple kind of observers? | |
mlir/lib/Pass/PassDetail.h | ||
23 | Does this have to be inline in header? | |
23 | Mmm, this is quoting using and " , could we just use throughout? | |
mlir/lib/Tools/mlir-opt/MlirOptMain.cpp | ||
147 | Error form should be sentence fragments (https://llvm.org/docs/CodingStandards.html#error-and-warning-messages) | |
167 | Are these correct destruction order to avoid dangling references ? |
LGTM with Jacques comments addressed
mlir/lib/Debug/Observers/ActionLogging.cpp | ||
---|---|---|
22 | You can also use llvm::get_thread_name, which can have a more user friendly name for a thread (e.g. the llvm worker threads usually have llvm-worker-<index>. | |
mlir/lib/Pass/Pass.cpp | ||
466 | passFailed won't be initialized here if the action doesn't run, this should be set to false. |
mlir/lib/Debug/Observers/ActionLogging.cpp | ||
---|---|---|
22 | Ah good point! That was added recently to the LLVM thread pool I believe, I'll do that :) |