chiwwang commented on a change in pull request #8220:
URL: https://github.com/apache/tvm/pull/8220#discussion_r659459224
##########
File path: docs/dev/pass_infra.rst
##########
@@ -389,6 +396,136 @@ To allow other C++ modules to apply this pass, we declare
a free function in
TVM_DLL Pass FoldConstant();
+.. _pass_instrument_cpp_backend:
+
+Pass Instrument
+^^^^^^^^^^^^^^^
+
+Currently we introduce four instrument points in the life-cycle of
``PassContext``.
+
+.. code:: c++
+
+ TVM_DLL void InstrumentEnterPassContext();
+ TVM_DLL void InstrumentExitPassContext();
+ TVM_DLL bool InstrumentBeforePass(const IRModule& mod, const PassInfo&
info) const;
+ TVM_DLL void InstrumentAfterPass(const IRModule& mod, const PassInfo&
info) const;
+
+``InstrumentEnterPassContext`` is called immediately when entering the scope
+of the ``PassContext`` instance.
+
+``InstrumentExitPassContext`` is called when leaving the scope of
``PassContext``,
+or exceptions occur during the execution of passes.
+This method is also called when instruments is being overriden by
``override_instruments`` in :py:class:`tvm.transform.PassContext`.
+See :ref:`pass_instrument_overriden`.
+
+``InstrumentBeforePass`` is called before execution.
+``InstrumentAfterPass`` is called after executioon if the pass should be run.
The behavior is like:
Review comment:
Done. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]