Skip to content

Conversation

@bopeng1234
Copy link

@bopeng1234 bopeng1234 commented Oct 31, 2025

Description

Disable bfloat16 model conversion when the graph's node size <=1.

Motivation and Context

CVS-172796

bfloat16_fix::Transform made changes to the bfloat16 output model, changed the output type to float16.

When single node test, cast_op_test.cc, it only has one node "Cast", the output is changed to float16 by the transformation, but testcase still use it as bfloat16 tensor, which will cause a mismatch;

May need to disable the transformation when unit test runs. OR. Add a cast node before BF16 output node.

@bopeng1234 bopeng1234 marked this pull request as draft October 31, 2025 09:36
@bopeng1234 bopeng1234 marked this pull request as ready for review November 3, 2025 07:31
@bopeng1234 bopeng1234 changed the title [CVS-172796] disable bfloat16 conversion when single cast node to bfloat16 [CVS-172796] fix bfloat16 conversion when single cast node to bfloat16 Nov 3, 2025
Copy link

@mklimenk mklimenk left a comment

Choose a reason for hiding this comment

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

Limited the condition of bfloat16 conversion to trigger only on GPU and NPU, since CPU has some sort of reference implementation.
Looks good to me, thanks.

@MayureshV1
Copy link

@bopeng1234 . This simply ignores BF16-> FP16 for CPU. Why is this conversion needed for GPU and NPU?

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.

3 participants