Skip to content

[Break XPU] The change of default value torch._dynamo.config.specialize_float cause XPU Inductor UT failures. #141466

@etaf

Description

@etaf

🐛 Describe the bug

We found ciflow/xpu failed in main branch:
xpu / linux-jammy-xpu-2025_0-py3.9 / test (default, 3, 4, linux.idc.xpu) (gh)
inductor/test_compiled_optimizers.py::CompiledOptimizerTests::test_adadelta_maximize_xpu
xpu / linux-jammy-xpu-2025_0-py3.9 / test (default, 4, 4, linux.idc.xpu) (gh)
inductor/test_compiled_optimizers.py::CompiledOptimizerTests::test_adadelta_weight_decay_xpu

Root cause:
Recently the PR #138922 changed the default value torch._dynamo.config.specialize_float from True to False. And caused the dynamo traced graph for XPU changed. Then caused the generated kernel count mismatch with expected count.

The changed part is the check in creating a constant float variable or a symfloat.
The code is:

if (
torch._dynamo.config.specialize_float
or is_constant_source(self.get_source())
or math.isnan(value)
or math.isinf(value)
# We don't support cudagraphs for now. Without this cudagraphs
# break because they expect all cuda inputs but our tensorified
# float will be a f64[] cpu tensor. Fixes the following test
# when specialize_float=False
# python test/inductor/test_compiled_optimizers.py CompiledOptimizerTests.test_rmsprop_weight_decay_maximize_capturable_cuda # noqa: B950
or torch._inductor.config.triton.cudagraphs
or justknobs_check("pytorch/compiler:unspecialize_float_killswitch", False)
):
self.install_guards(GuardBuilder.CONSTANT_MATCH)
return ConstantVariable.create(value=value, source=self.source)

CUDA does not has such change because the check condition includes or torch._inductor.config.triton.cudagraphs, which make it always crate constant float variable instead of symbol.

I'll update the expected kernel count in test case for XPU to resolve this XPU CI break.

Versions

PyTorch version: 2.6.0a0+git6a096a0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.29.4
Libc version: glibc-2.35

Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-5.15.47+prerelease23.5.18-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

cc @gujinghui @EikanWang @fengyuan14 @guangyey

Metadata

Metadata

Assignees

Labels

module: xpuIntel XPU related issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions