Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/include/mlir/Debug/ExecutionContext.h
Show All 22 Lines | |||||
struct ActionActiveStack { | struct ActionActiveStack { | ||||
public: | public: | ||||
ActionActiveStack(const ActionActiveStack *parent, const Action &action, | ActionActiveStack(const ActionActiveStack *parent, const Action &action, | ||||
int depth) | int depth) | ||||
: parent(parent), action(action), depth(depth) {} | : parent(parent), action(action), depth(depth) {} | ||||
const ActionActiveStack *getParent() const { return parent; } | const ActionActiveStack *getParent() const { return parent; } | ||||
const Action &getAction() const { return action; } | const Action &getAction() const { return action; } | ||||
int getDepth() const { return depth; } | int getDepth() const { return depth; } | ||||
void print(raw_ostream &os, bool withContext) const; | |||||
void dump() const { | |||||
print(llvm::errs(), /*withContext=*/true); | |||||
llvm::errs() << "\n"; | |||||
} | |||||
Breakpoint *getBreakpoint() const { return breakpoint; } | |||||
void setBreakpoint(Breakpoint *breakpoint) { this->breakpoint = breakpoint; } | |||||
private: | private: | ||||
Breakpoint *breakpoint = nullptr; | |||||
const ActionActiveStack *parent; | const ActionActiveStack *parent; | ||||
const Action &action; | const Action &action; | ||||
int depth; | int depth; | ||||
}; | }; | ||||
/// The ExecutionContext is the main orchestration of the infrastructure, it | /// The ExecutionContext is the main orchestration of the infrastructure, it | ||||
/// acts as a handler in the MLIRContext for executing an Action. When an action | /// acts as a handler in the MLIRContext for executing an Action. When an action | ||||
/// is dispatched, it'll query its set of Breakpoints managers for a breakpoint | /// is dispatched, it'll query its set of Breakpoints managers for a breakpoint | ||||
Show All 23 Lines | public: | ||||
using CallbackTy = function_ref<Control(const ActionActiveStack *)>; | using CallbackTy = function_ref<Control(const ActionActiveStack *)>; | ||||
/// Create an ExecutionContext with a callback that is used to control the | /// Create an ExecutionContext with a callback that is used to control the | ||||
/// execution. | /// execution. | ||||
ExecutionContext(CallbackTy callback) { setCallback(callback); } | ExecutionContext(CallbackTy callback) { setCallback(callback); } | ||||
ExecutionContext() = default; | ExecutionContext() = default; | ||||
/// Set the callback that is used to control the execution. | /// Set the callback that is used to control the execution. | ||||
void setCallback(CallbackTy callback); | void setCallback(CallbackTy callback) { | ||||
onBreakpointControlExecutionCallback = callback; | |||||
} | |||||
/// This abstract class defines the interface used to observe an Action | /// This abstract class defines the interface used to observe an Action | ||||
/// execution. It allows to be notified before and after the callback is | /// execution. It allows to be notified before and after the callback is | ||||
/// processed, but can't affect the execution. | /// processed, but can't affect the execution. | ||||
struct Observer { | struct Observer { | ||||
virtual ~Observer() = default; | virtual ~Observer() = default; | ||||
/// This method is called before the Action is executed | /// This method is called before the Action is executed | ||||
/// If a breakpoint was hit, it is passed as an argument to the callback. | /// If a breakpoint was hit, it is passed as an argument to the callback. | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |