You can’t without modifying the main PyTorch code, change the backend.
What you could do if you use the JIT is to create a custom optimization pass that would replace all calls to matmul with calls to your matmul function.
Best regards
Thomas