Skip to content

Conversation

sshonTT
Copy link
Contributor

@sshonTT sshonTT commented Oct 1, 2025

Remove the explicit opmath-driven cast chain (bf16→f32→bf16, etc.) from mul. The op now executes in the dtype chosen by standard dtype promotion, without inserting unconditional upcast/downcast steps. But leave its functionality for future usage.

@sshonTT
Copy link
Contributor Author

sshonTT commented Oct 1, 2025

Fixes issue #9662

@sshonTT
Copy link
Contributor Author

sshonTT commented Oct 2, 2025

@ysiraichi Hi, could you take a look when you have a chance?

@ysiraichi
Copy link
Collaborator

Could you add a test to verify whether that does what we expect?

@sshonTT
Copy link
Contributor Author

sshonTT commented Oct 2, 2025

Could you add a test to verify whether that does what we expect?

I could add a test for the mul op, but as you know, this patch affects the intermediate type casting, so it’s tricky to capture the cast → op → cast-back sequence. Do you have any ideas on how to validate this?

@ysiraichi
Copy link
Collaborator

You can use expecttest!
See test_ops_error_message.py for reference.

Remove the explicit opmath-driven cast chain (bf16→f32→bf16, etc.) from `mul`. The op now executes in the dtype chosen by standard dtype promotion, without inserting unconditional upcast/downcast steps. But leave its functionality for future usage.
@sshonTT sshonTT force-pushed the sshon/mul-op-mathop-remove branch from f22abe8 to 55c07ed Compare October 2, 2025 14:20
@sshonTT
Copy link
Contributor Author

sshonTT commented Oct 2, 2025

@ysiraichi ,I was going to try the expecttest module you suggested, but I found that test_operations_hlo.py already provides a more effective way to check the behavior I wanted. So I added the test there instead.

Copy link
Collaborator

@ysiraichi ysiraichi left a comment

Choose a reason for hiding this comment

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

Thank you for the PR.

@ysiraichi ysiraichi merged commit 2a9138a into pytorch:master Oct 3, 2025
24 checks passed
@sshonTT sshonTT deleted the sshon/mul-op-mathop-remove branch October 3, 2025 18:22
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