What does TVM_DLL mean

I was going through DNNL code for BYOC understanding , and noticed few DNNL runtime specific functions defined in “tvm/src/runtime/contrib/dnnl/dnnl_kernel.h” file with TVM_DLL keyword,
and was wondering what exactly it specify and its necessity.
it looks something like this:

extern "C" TVM_DLL void dnnl_conv2d(float* data, float* weights, float* out, int p_N_, int p_C_,
                                    int p_H_, int p_W_, int p_O_, int p_G_, int p_Ph0_, int p_Pw0_,
                                    int p_Ph1_, int p_Pw1_, int p_Kh_, int p_Kw_, int p_Sh_,
                                    int p_Sw_);

could anyone please explain use of TVM_DLL

It’s a macro that specifies how this function was exposed as a symbol in the exported dynamic link library: https://github.com/apache/tvm/blob/b77d659c9afcfe3b80ea9b10a748cb15f4fe6539/include/tvm/runtime/c_runtime_api.h#L63-L73

thanks @yzh119 ,for the explanation , however i would also like to understand the circumstances where we have to use this macro?
The origin of this question is from the observation that if i declare a function in runtime without this macro , even then TVM runs this function
it might look something like this in some custom BYOC codegen implementation

declaration :
extern "C" void some_function(...);

definition :  
extern "C" void some_function(){
    body
}

TVM is able to compile and execute this function , and as this doesnt contain TVM_DLL macro , i am little confused on the circumstances when this macro becomes a necessity.
thanks

This is mainly to force compiler to generate these symbols, sometimes compiler will hide the symbols that are not used by other functions, because we are performing dynamic lookup sometimes, we will need to export those symbols so they don’t get optimized away

3 Likes

thanks @tqchen , for more clarity on this topic. from what i understand its better to use this macro for all user defined function (in custom BYOC runtime implementation) to avoid DLL symbol lookup issues. Please correct me if i am wrong .