@@ -44,23 +44,29 @@ namespace runtime {
4444/* !
4545 * \brief Property of runtime module
4646 * We classify the property of runtime module into the following categories.
47- * - kBinarySerializable: we can serialize the module to the stream of bytes. CUDA/OpenCL/JSON
48- * runtime are representative examples. A binary exportable module can be integrated into final
49- * runtime artifact by being serialized as data into the artifact, then deserialzied at runtime.
50- * This class of modules must implement SaveToBinary, and have a matching deserializer registered as
51- * 'runtime.module.loadbinary_<type_key>'.
52- * - kRunnable: we can run the module directly. LLVM/CUDA/JSON runtime, executors (e.g,
53- * virtual machine) runtimes are runnable. Non-runnable modules, such as CSourceModule, requires a
54- * few extra steps (e.g,. compilation, link) to make it runnable.
55- * - kDSOExportable: we can export the module as DSO. A DSO exportable module (e.g., a
56- * CSourceModuleNode of type_key 'c') can be incorporated into the final runtime artifact (ie shared
57- * library) by compilation and/or linking using the external compiler (llvm, nvcc, etc). DSO
58- * exportable modules must implement SaveToFile.
5947 */
60-
6148enum ModulePropertyMask : int {
49+ /* ! \brief kBinarySerializable
50+ * we can serialize the module to the stream of bytes. CUDA/OpenCL/JSON
51+ * runtime are representative examples. A binary exportable module can be integrated into final
52+ * runtime artifact by being serialized as data into the artifact, then deserialized at runtime.
53+ * This class of modules must implement SaveToBinary, and have a matching deserializer registered
54+ * as 'runtime.module.loadbinary_<type_key>'.
55+ */
6256 kBinarySerializable = 0b001 ,
57+ /* ! \brief kRunnable
58+ * we can run the module directly. LLVM/CUDA/JSON runtime, executors (e.g,
59+ * virtual machine) runtimes are runnable. Non-runnable modules, such as CSourceModule, requires a
60+ * few extra steps (e.g,. compilation, link) to make it runnable.
61+ */
6362 kRunnable = 0b010 ,
63+ /* ! \brief kDSOExportable
64+ * we can export the module as DSO. A DSO exportable module (e.g., a
65+ * CSourceModuleNode of type_key 'c') can be incorporated into the final runtime artifact (ie
66+ * shared library) by compilation and/or linking using the external compiler (llvm, nvcc, etc).
67+ * DSO exportable modules must implement SaveToFile. In general, DSO exportable modules are not
68+ * runnable unless there is a special support like JIT for `LLVMModule`.
69+ */
6470 kDSOExportable = 0b100
6571};
6672
@@ -220,10 +226,12 @@ class TVM_DLL ModuleNode : public Object {
220226 * By default, none of the property is set. Derived class can override this function and set its
221227 * own property.
222228 */
223- virtual int GetProperty () const { return 0b000 ; }
229+ virtual int GetPropertyMask () const { return 0b000 ; }
224230
225231 /* ! \brief Returns true if this module is 'DSO exportable'. */
226- bool IsDSOExportable () const { return GetProperty () & ModulePropertyMask::kDSOExportable ; };
232+ bool IsDSOExportable () const {
233+ return (GetPropertyMask () & ModulePropertyMask::kDSOExportable ) != 0 ;
234+ }
227235
228236 /* !
229237 * \brief Returns true if this module has a definition for a function of \p name. If
0 commit comments