tqchen commented on code in PR #14406:
URL: https://github.com/apache/tvm/pull/14406#discussion_r1148628964
##########
include/tvm/runtime/module.h:
##########
@@ -41,6 +41,37 @@
namespace tvm {
namespace runtime {
+/*!
+ * \brief Property of runtime module
+ * We classify the property of runtime module into the following categories.
+ * - kBinarySerializable: we can serialize the module to the stream of bytes.
CUDA/OpenCL/JSON
+ * runtime are representative examples.
+ * - kRunnable: we can run the module directly. LLVM/CUDA/JSON runtime,
executors (e.g,
+ * virtual machine) runtimes are runnable. Non-runnable modules, such as
CSourceModule, requires a
+ * few extra steps (e.g,. compilation, link) to make it runnable.
+ * - kBinaryExportable: when the module is kBinarySerializable and kRunnable,
we consider this
+ * module as binary exportable. A binary exportable module can be integrated
into final runtime
+ * artifact by being serialized as data into the artifact, then deserialzied
at runtime. This class
+ * of modules must implement SaveToBinary, and have a matching deserializer
registered as
+ * 'runtime.module.loadbinary_<type_key>'.
+ * - kDSOExportable: we can export the module as DSO. A DSO exportable module
(e.g., a
+ * CSourceModuleNode of type_key 'c') can be incorporated into the final
runtime artifact (ie shared
+ * library) by compilation and/or linking using the external compiler (llvm,
nvcc, etc). DSO
+ * exportable modules must implement SaveToFile.
+ *
+ * Please note that kDSOExportable is a mutual exclusive property with
kBinaryExportable.
+ */
+namespace property {
+/*! \brief Binary serializable runtime module */
+constexpr const uint8_t kBinarySerializable = 0b001;
Review Comment:
let us use int t keep things simple, make it an enum class
##########
include/tvm/runtime/module.h:
##########
@@ -41,6 +41,37 @@
namespace tvm {
namespace runtime {
+/*!
+ * \brief Property of runtime module
+ * We classify the property of runtime module into the following categories.
+ * - kBinarySerializable: we can serialize the module to the stream of bytes.
CUDA/OpenCL/JSON
+ * runtime are representative examples.
+ * - kRunnable: we can run the module directly. LLVM/CUDA/JSON runtime,
executors (e.g,
+ * virtual machine) runtimes are runnable. Non-runnable modules, such as
CSourceModule, requires a
+ * few extra steps (e.g,. compilation, link) to make it runnable.
+ * - kBinaryExportable: when the module is kBinarySerializable and kRunnable,
we consider this
+ * module as binary exportable. A binary exportable module can be integrated
into final runtime
+ * artifact by being serialized as data into the artifact, then deserialzied
at runtime. This class
+ * of modules must implement SaveToBinary, and have a matching deserializer
registered as
+ * 'runtime.module.loadbinary_<type_key>'.
+ * - kDSOExportable: we can export the module as DSO. A DSO exportable module
(e.g., a
+ * CSourceModuleNode of type_key 'c') can be incorporated into the final
runtime artifact (ie shared
+ * library) by compilation and/or linking using the external compiler (llvm,
nvcc, etc). DSO
+ * exportable modules must implement SaveToFile.
+ *
+ * Please note that kDSOExportable is a mutual exclusive property with
kBinaryExportable.
+ */
+namespace property {
+/*! \brief Binary serializable runtime module */
+constexpr const uint8_t kBinarySerializable = 0b001;
+/*! \brief Runnable runtime module */
+constexpr const uint8_t kRunnable = 0b010;
+/*! \brief DSO exportable runtime module */
+constexpr const uint8_t kDSOExportable = 0b100;
+/*! \brief Binary exportable runtime module */
+constexpr const uint8_t kBinaryExportable = kBinarySerializable | kRunnable;
Review Comment:
skip this one
--
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]