# Profiling Backend does not compile

**URL:** <https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842>\
**Category:** Troubleshooting\
**Created:** [January 5, 2022, 8:20am UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842 "2022-01-05T08:20:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [January 5, 2022, 8:20am UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/1 "2022-01-05T08:20:52Z")

</div>

Hello,

I wanted to implement a profiling component like PAPI, but for the [power measurement infrastructure](https://tu-dresden.de/zih/forschung/ressourcen/dateien/projekte/hdeem/HDEEM-Library-Reference-Guide.pdf?lang=de) of a cluster:

I mostly followed the approach that was used by the PAPI component:

A CMake module has been added. The header and source are stored in the runtime contrib folder. The Python class was added to the **init**.py and I am using TVM\_REGISTER\_GLOBAL, TVM\_DEFINE\_MUTABLE\_OBJECT\_REF\_METHODS and TVM\_DECLARE\_FINAL\_OBJECT\_INFO just like in papi.cc.

However, when I try to compile it, I get the error: `error: ‘tvm::runtime::profiling::HDEEMMetricCollector::HDEEMMetricCollector()’ cannot be overloaded with ‘tvm::runtime::profiling::HDEEMMetricCollector::HDEEMMetricCollector()’`

I am not really sure how the FFI works internally, but it seems to be related to it, as the error occurs in:

```
class HDEEMMetricCollector : public MetricCollector {
 public:
  explicit HDEEMMetricCollector() {
    data_ = make_object<HDEEMMetricCollectorNode>();
  }
  TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(HDEEMMetricCollector, MetricCollector,
                                        HDEEMMetricCollectorNode);
};
```

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [January 5, 2022, 11:25pm UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/2 "2022-01-05T23:25:58Z")

</div>

Hi Max, it will be a little hard to diagnose your error without more information, but it maybe you have an issue where you are including a file twice in cmake. If you can provide a small example or a link to a branch containing this code, we will be able to debug. Also please provide the full compilation error.

---

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [January 6, 2022, 10:34am UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/3 "2022-01-06T10:34:37Z")

</div>

Hi Tristan,

yes of course. I pushed the minimal version to [MaxS1996/tvm\_power: TVM with added power consumption measurement abilities for the profiler (github.com)](https://github.com/MaxS1996/tvm_power).

I hope that helps 🙂

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [January 6, 2022, 10:56pm UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/4 "2022-01-06T22:56:55Z")

</div>

Unfortunately, I cannot figure out where to find HDEEM. Can you provide the full output of compilation (including the error you are getting).

---

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [January 7, 2022, 6:39am UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/5 "2022-01-07T06:39:34Z")

</div>

Oh, I am sorry. It looks like HDEEM is only available on this cluster, as it relies on additional hardware to be present for the power measurements. I had hoped that it could compile without the hdeem library, but maybe that won’t work.

I compiled TVM with LLVM 9 (auto-detect), Profiler enabled, no CUDA or anything and just the HDEEM Profiler.

The error during the execution of make is:

```
Built target tvm_objs
In file included from /home/s0144002/tvm_hdeem/include/tvm/runtime/memory.h:26,
                 from /home/s0144002/tvm_hdeem/include/tvm/runtime/container/./base.h:29,
                 from /home/s0144002/tvm_hdeem/include/tvm/runtime/container/array.h:32,
                 from /home/s0144002/tvm_hdeem/include/tvm/runtime/contrib/hdeem.h:23,
                 from /home/s0144002/tvm_hdeem/src/runtime/contrib/hdeem/hdeem.cc:19:
/home/s0144002/tvm_hdeem/src/runtime/contrib/hdeem/hdeem.cc:78:41: error: ‘tvm::runtime::profiling::HDEEMMetricCollector::HDEEMMetricCollector()’ cannot be overloaded with ‘tvm::runtime::profiling::HDEEMMetricCollector::HDEEMMetricCollector()’
   78 | TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(HDEEMMetricCollector, MetricCollector,
      | ^ ~~~~~~~~~~~~~~~~~~~
/home/s0144002/tvm_hdeem/include/tvm/runtime/object.h:738:3: note: in definition of macro ‘TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS’
  738 | TypeName() = default; \
      | ^ ~~~~~~~
/home/s0144002/tvm_hdeem/src/runtime/contrib/hdeem/hdeem.cc:75:12: note: previous declaration ‘tvm::runtime::profiling::HDEEMMetricCollector::HDEEMMetricCollector()’
   75 | explicit HDEEMMetricCollector() {
      | ^ ~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/tvm_runtime_objs.dir/src/runtime/contrib/hdeem/hdeem.cc.o] Error 1
make[1]: *** [CMakeFiles/tvm_runtime_objs.dir/all] Error 2
make: *** [all] Error 2

```

Thank you very much for your help.

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [January 7, 2022, 4:18pm UTC](https://discuss.tvm.apache.org/t/profiling-backend-does-not-compile/11842/6 "2022-01-07T16:18:15Z")

</div>

So the problem is that `TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS` already defines a default constructor for you. This default constructor with be “nullable”—that is it will construct the object with `data_ = nullptr`. If you want to prevent that (by using the constructor you’ve already written), use `TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS` instead.
