-
Notifications
You must be signed in to change notification settings - Fork 332
[AMD] fix bf16x2 dtype codegen #847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ using half_t = float16_t; | |
| using bfloat16_t = hip_bfloat16; | ||
|
|
||
| struct bfloat16x2 { | ||
| bfloat16_t data[2]; | ||
| bfloat16_t x, y; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change to |
||
| }; | ||
|
|
||
| struct bfloat16x4 { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this change from
nv_bfloat162tobfloat16x2is correct for HIP, there's an underlying issue with vector element loading for 2-element vectors.For a
bfloat16vector with 2 lanes,PrintTypegenerates a scalaruinttype for the vector variablevec. The current code then attempts to access a member (e.g.,.x) of this scalaruint(vec << "." << access[i / 2]), which is incorrect and will cause compilation errors in the generated code.The logic should handle 2-lane vectors (represented as a scalar
uint) differently from wider vectors (e.g.,uint2,uint4). For the 2-lane case, the address of the scalarvecshould be cast directly, without member access.A similar issue exists for
float16vectors on lines 480-481.