junrushao1994 commented on a change in pull request #8817:
URL: https://github.com/apache/tvm/pull/8817#discussion_r694385534
##########
File path: src/tir/schedule/primitive.h
##########
@@ -19,12 +19,26 @@
#ifndef TVM_TIR_SCHEDULE_PRIMITIVE_H_
#define TVM_TIR_SCHEDULE_PRIMITIVE_H_
+#include <tvm/support/random_engine.h>
#include <tvm/tir/schedule/state.h>
namespace tvm {
namespace tir {
/******** Schedule: Sampling ********/
+/*!
+ * \brief Sample once category from candidates according to the probability
weights.
+ * \param self The schedule to update
+ * \param rand_state The pointer to schedule's random state
+ * \param candidates The candidates
+ * \param probs The probability distribution of the candidates
+ * \param decision The sampling decision, if any
+ * \return The random variable sampled from candidates
+ */
+TVM_DLL int64_t
SampleCategorical(support::LinearCongruentialEngine::TRandState* rand_state,
+ const Array<Integer>& candidates, const
Array<FloatImm>& probs,
+ Optional<Integer>* decision);
Review comment:
All the sampling primitives in meta schedule modifies the `decision`
passed in to reflect which decision is being made inside the method. This
includes:
- SamplePerfectTile
- SampleCategorical
- SampleComputeLocation
Without knowing what the decisions are, we are unable to exactly reproduce a
trace which comes with randomness.
--
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]