Skip to content

[fx] Align c10 ScalarType codes for complex dtypes - #4638

Open
AyoubMDL wants to merge 1 commit into
llvm:mainfrom
AyoubMDL:align-complex-dtype-enum
Open

AyoubMDL wants to merge 1 commit into
llvm:mainfrom
AyoubMDL:align-complex-dtype-enum

Conversation

@AyoubMDL

@AyoubMDL AyoubMDL commented Jul 7, 2026 •

Copy link
Copy Markdown

TORCH_DTYPE_TO_INT in the FX importer was off-by-one for the complex dtypes versus the c10 ScalarType enum in TorchUpstream.h (AT_FORALL_SCALAR_TYPES_WITH_COMPLEX_AND_QINTS): ComplexHalf=8,
ComplexFloat=9, ComplexDouble=10.
When I export a model with torch.complex128 dtype, I get an Key error. When a model has a complex64 dtype, I can get the .mlir but It cannot be optimized as the constant representing complex64 is not the same as in TorchUpstream.h.

@zjgarvey @stellaraccident

@AyoubMDL
AyoubMDL marked this pull request as ready for review July 8, 2026 15:35
@zjgarvey
zjgarvey self-requested a review August 25, 2026 16:58
@zjgarvey zjgarvey closed this Aug 25, 2026
@zjgarvey zjgarvey reopened this Aug 25, 2026

@zjgarvey zjgarvey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry it took a while to get around to this. Will land if CI is green.

@AyoubMDL
AyoubMDL force-pushed the align-complex-dtype-enum branch from c786d47 to 1b2caf9 Compare September 2, 2026 08:00
@AyoubMDL

AyoubMDL commented Sep 2, 2026

Copy link
Copy Markdown
Author

@zjgarvey I needed to rebase on main as there were two tests that xpassed which are already fixed in #4735

@zjgarvey zjgarvey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My existing approval is still on the current head (1b2caf9). The complex dtype mapping and regressions remain consistent with ComplexHalf=8, ComplexFloat=9, ComplexDouble=10. Please rebase on main and rerun CI so this can land; GitHub currently reports conflicts. No additional code change requested from this lightweight re-review.

@AyoubMDL
AyoubMDL force-pushed the align-complex-dtype-enum branch from 1b2caf9 to 2ec4b77 Compare November 23, 2026 15:55
@AyoubMDL

Copy link
Copy Markdown
Author

My existing approval is still on the current head (1b2caf9). The complex dtype mapping and regressions remain consistent with ComplexHalf=8, ComplexFloat=9, ComplexDouble=10. Please rebase on main and rerun CI so this can land; GitHub currently reports conflicts. No additional code change requested from this lightweight re-review.

Done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants