[Bug] torch.compile() failing: UnicodeDecodeError on byte 0x90 (TorchInductor)

Hi everyone,

I’m trying to use torch.compile() on a native Windows setup, but I keep hitting the same error: InductorError: RuntimeError: Failed to import C:\Users\baudo\AppData\Local\Temp\torchinductor_baudo\zp\czpnhi4ihlhzh4rabojmer3yoht7hvfdjtewx2ifnpvobprkknv7.py
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2: character maps to <undefined>

The code I’m using is the following:

import torch

device="cpu" # or "xpu" for XPU

def foo(x, y):

    a = torch.sin(x)

    b = torch.cos(x)

    return a + b

opt_foo1 = torch.compile(foo)

print(opt_foo1(torch.randn(10, 10).to(device), torch.randn(10, 10).to(device)))

I have done everything said here: How to use torch.compile on Windows CPU/XPU — PyTorch Tutorials 2.12.0+cu130 documentation

I’m using python 3.13.5, windows 11, MSVC 14.44.17.14, pytorch 2.11.0+cu130 and triton-windows 3.7.0. I have tried for 5 hours, asked every LLM existing, I can’t find the solution.

Thanks in advance!