cpc / hipcl

OpenCL/SPIR-V implementation of HIP
Other
104 stars 12 forks source link

Unable to use RTTI in host code #14

Closed elliottslaughter closed 3 years ago

elliottslaughter commented 4 years ago

I'm trying to use HIPCL to generate a kernel that I intend to call in Python using pybind11. pybind11 requires the use of -frtti, but I don't seem to be able to actually pass this flag to the compiler (or it gets ignored).

To be clear, I only need RTTI in host code. I don't need RTTI in device code.

An example of my command line:

clang++ -O3 -fPIC -frtti -shared -std=c++11 -I/home/eslaught/spinifel/setup/conda/envs/myenv/include/python3.8 -I/home/eslaught/spinifel/setup/conda/envs/myenv/lib/python3.8/site-packages/pybind11/include orientation_matching.cu -lhipcl -lOpenCL -o pyCudaKNearestNeighbors.cpython-38-x86_64-linux-gnu.so

And you can clearly see -frtti on the command line, but I still get an error:

In file included from orientation_matching.cu:8:
In file included from /home/eslaught/spinifel/setup/conda/envs/myenv/lib/python3.8/site-packages/pybind11/include/pybind11/pybind11.h:44:
In file included from /home/eslaught/spinifel/setup/conda/envs/myenv/lib/python3.8/site-packages/pybind11/include/pybind11/attr.h:13:
In file included from /home/eslaught/spinifel/setup/conda/envs/myenv/lib/python3.8/site-packages/pybind11/include/pybind11/cast.h:13:
/home/eslaught/spinifel/setup/conda/envs/myenv/lib/python3.8/site-packages/pybind11/include/pybind11/pytypes.h:371:70: error: use of typeid
      requires -frtti
bool isinstance(handle obj) { return detail::isinstance_generic(obj, typeid(T)); }
                                                                     ^

Is this expected? What can I do to help debug this?

I'm using HIPCL 0.9 and can provide other version/system info if that helps.

Thanks!

franz commented 3 years ago

This should be fixed in the custom Clang branch.

elliottslaughter commented 3 years ago

Thanks, I can confirm that I'm able to build now.