Compile PyTorch code to LLVM IR with Torch 2.0

I have been trying to find ways to compile native PyTorch code to LLVM IR. I have turned on environment variables like TORCH_LOGS=“output_code” to dump Triton kernels and LLVM IR out of PyTorch with cuda enabled code.

But I want to do similarly for PyTorch code with target as CPU to be compiled to LLVM IR. Executing such PyTorch programs dumps C++ kernels but doesn’t generate LLVM IR like it used to on enabling CUDA. Compiling C++ kernels using clang requires ATen header files and many other internal header files.

Is there any direct way to generate LLVM IR from Torch code against CPU as target? If not should I install LibTorch and then compile generated C++ kernels to LLVM IR?