You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "tlopex (via GitHub)" <gi...@apache.org> on 2026/06/09 23:50:36 UTC

[PR] [Refactor] Remove meta-schedule as_string mechanism in favor of default repr [tvm]

tlopex opened a new pull request, #19709:
URL: https://github.com/apache/tvm/pull/19709

   Python-side meta-schedule classes (`PyCostModel`, `PyFeatureExtractor`, `PyMeasureCallback`, `PyScheduleRule`, `PyMutator`, `PyPostproc`) carried an `f_as_string` callback whose only purpose was to produce a repr-style string (`s_tir.meta_schedule.<SubclassName>(0x...)`) for `str(...)`.
   
   This mechanism stopped working after #19461 migrated `ReprPrinter` to the tvm-ffi `__ffi_repr__` mechanism and intentionally removed the per-type `set_dispatch<Py*Node>` hooks that called back into `f_as_string`, which broke three `*_as_string` tests:
   - `test_meta_schedule_cost_model.py::test_meta_schedule_cost_model_as_string`
   - `test_meta_schedule_feature_extractor.py::test_meta_schedule_feature_extractor_as_string`
   - `test_meta_schedule_measure_callback.py::test_meta_schedule_measure_callback_as_string`
   
   Rather than restoring the old behavior, this PR removes the mechanism entirely: the string it produced is just a repr, and tvm-ffi reflection already provides an auto-generated default repr for every object. Keeping a dedicated Python → FFI → C++ callback chain alive only to reproduce that is not worth the complexity.


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Refactor] Remove meta-schedule as_string mechanism in favor of default repr [tvm]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19709:
URL: https://github.com/apache/tvm/pull/19709#discussion_r3384555313


##########
include/tvm/s_tir/meta_schedule/cost_model.h:
##########
@@ -142,19 +134,17 @@ class PyCostModelNode : public CostModelNode {
 class CostModel : public ffi::ObjectRef {
  public:
   /*!
-   * \brief Create a feature extractor with customized methods on the python-side.
+   * \brief Create a cost model with customized methods on the python-side.
    * \param f_load The packed function of `Load`.
    * \param f_save The packed function of `Save`.
    * \param f_update The packed function of `Update`.
    * \param f_predict The packed function of `Predict`.
-   * \param f_as_string The packed function of `AsString`.
-   * \return The feature extractor created.
+   * \return The cost model created.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   There is a copy-paste typo in the docstring for `CostModel::PyCostModel`. It refers to a "feature extractor" instead of a "cost model". Please update it to refer to "cost model". Note that the first line of this docstring (which is outside the diff hunk) also contains "Create a feature extractor..." and should be updated to "Create a cost model..." as well.
   
   ```c
      * \return The cost model created.
   ```



-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Refactor][Meta-schedule] Remove meta-schedule as_string mechanism in favor of default representation [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex merged PR #19709:
URL: https://github.com/apache/tvm/pull/19709


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org