Warning: ignoring #pragma unroll during compilation of custom extension

I am writing a custom extension that implements a modified grid_sample layer. I use the source code from Aten/native/cpu/GridSamplerKernel.cpp by making a few changes to it. Followed the steps in pytorch website and used the CppExtension to compile the layer. Since the source code in GridSamplerKernel.cpp involved #pragma unroll i also passed the “-O3” flag to the extra compile_args of CppExtension as follows


. But still, it shows that the pragma unroll is ignored during the compilation. Is there anything else to add for compiling the custom layers with pragma unroll?. To reproduce the warning run ./make.sh from the source code here https://drive.google.com/file/d/1hBmWyK3UvQMd3FRFD5_5tL50WvCtRegp/view?usp=sharing . NOTE: I am using ubuntu and have to set the flag AT_MKL_ENABLED() at include/ATen/Config.h to 0 before compiling. Otherwise it throws the error no <mkl.h> file during compilation.

-funroll-loops perhaps?

It still throwing the same warning after adding -funroll-looops to extra_compile_args

Actually, #pragma unroll form is for nvcc
GCC form is: #pragma GCC unroll N

Unfortunately it also didn’t work

clang has different syntax, but frankly that pragma should make almost no difference, and some unrolling is done anyway, based on optimization flags.