PyTorch inductor fix: realize conv bias input before freezing layout
Flatten bias views caused errors in torch.compile with inductor—now fixed.
PyTorch’s inductor backend received a targeted fix in PR #181363 that prevents a crash when convolution bias is a non-contiguous view (e.g., from a `flatten()` call). The change calls `ExternKernel.realize_input()` on the bias before layout freezing, ensuring the tensor materializes correctly. The pull request includes a minimal reproducer: converting a tensor to bool and back to float, then flattening it, then passing it as bias to `F.conv2d` under `torch.compile(..., backend='inductor')`.
This is a low-level optimization fix—no new features, but it removes a silent failure in a common pattern (reshaped bias tensors). The regression test is added to `test/inductor/test_cpu_repro.py`. The fix was approved by jansel and merges into the `trunk` branch. For professionals using PyTorch compiled mode, this ensures that custom bias shapes won’t break graph compilation.
- Fix addresses issue #181351 where `flatten()`‑produced bias views crashed inductor.
- Uses `ExternKernel.realize_input()` before freezing layout to materialize bias correctly.
- Regression test added: `test_cpu_repro.py::conv_bias_flattened_view`.
Why It Matters
Eliminates a crash in PyTorch compiled mode for common conv bias reshaping, improving reliability for production pipelines.