I am using PrivateUse1, and I have met following issue many times
RuntimeError: Only a single TORCH_LIBRARY can be used to register the namespace triton;
please put all of your definitions in a single TORCH_LIBRARY block.
If you were trying to specify implementations,
consider using TORCH_LIBRARY_IMPL (which can be duplicated).
If you really intended to define operators for a single namespace in a distributed way,
you can use TORCH_LIBRARY_FRAGMENT to explicitly indicate this.
Previous registration of TORCH_LIBRARY was registered at
/workspace/pytorch/torch/__init__.py:2813;
latest registration was registered at
/workspace/pytorch/torch/__init__.py:2813
Sometimes I could solve it by adding LD_LIBRARY_PATH (linking issue), sometimes I could solve it by fixing the code (TORCH_LIBRARY misuse), but sometimes I just could not solve it. And above solutions are all based on black tests with a reference code which is error-free.
The point is, seems this could be caused by many different causes but they all raise this error. Is there a good way to debug this error?