Skip to content

viable/strict/1788758887

@mengpenghui mengpenghui tagged this 07 Sep 01:57
## Issue

Fixes #194594

## Summary

Update `cast_dtype_args_to_fp64` to disable `half_to_float` after softmax and log-softmax inputs are promoted to FP64. Cover the default and out overloads with positional and keyword arguments using a device-independent CPU regression test.

## Testing

- `python -m py_compile test/dynamo/test_debug_utils.py torch/_dynamo/debug_utils.py`
- `lintrunner --take PYFMT,FLAKE8,RUFF,TYPEIGNORE,TYPENOSKIP,NOQA,TESTOWNERS,TEST_HAS_MAIN,CODESPELL,NEWLINE,SPACES,TABS test/dynamo/test_debug_utils.py torch/_dynamo/debug_utils.py`
- The targeted runtime test was not run locally because this checkout does not have a built PyTorch `_C` extension; it is covered by the upstream test suite.

## Checklist

- [x] Passes targeted lint
- [x] Added/updated tests
- [x] Updated documentation (not applicable)
- [x] Included benchmark results (not applicable; no performance impact)

## BC-breaking?

No. This only changes the generated FP64 debugging/reference graph.

## AI assistance disclosure

> Codex helped adapt my downstream fix to the upstream tree, draft the CPU-only regression coverage, and prepare this PR description.

I previously investigated this failure downstream and reviewed the same core transformation across `_softmax`/`_log_softmax`, default/out overloads, and positional/keyword forms. The upstream patch intentionally contains no accelerator-specific behavior. This PR is a draft so the exact upstream diff can receive a final human review before being marked ready.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/194595
Approved by: https://github.com/jansel

Co-authored-by: mengph <mengpenghui@cambricon.com>
Assets 2
Loading