Skip to content
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

X86 backend crashed with assertion Do not know how to soft promote this operator's operand! for bf16 constants #63017

Closed
joker-eph opened this issue May 30, 2023 · 9 comments
Assignees

Comments

@joker-eph
Copy link
Collaborator

joker-eph commented May 30, 2023

SoftPromoteHalfOperand Op #1: t7: v32bf16 = insert_vector_elt t5, t3, Constant:i64<1>

Do not know how to soft promote this operator's operand!
UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2940!

Repro with

bin/llc -mtriple=x86_64-unknown-linux-gnu   -mcpu="znver4"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
declare <32 x bfloat> @llvm.masked.load.v32bf16.p0(ptr nocapture, i32 immarg, <32 x i1>, <32 x bfloat>)

define void @dump_vec() {
  %1 = call <32 x bfloat> @llvm.masked.load.v32bf16.p0(ptr poison, i32 2, <32 x i1> poison, <32 x bfloat> <bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80>)
  ret void
}
@llvmbot
Copy link
Collaborator

llvmbot commented May 30, 2023

@llvm/issue-subscribers-backend-x86

@phoebewang
Copy link
Contributor

Thanks for reporting it. I'll take a look.

@phoebewang phoebewang self-assigned this May 31, 2023
@phoebewang
Copy link
Contributor

Candidate patch: https://reviews.llvm.org/D151778

@joker-eph
Copy link
Collaborator Author

@phoebewang I have the same crash with a slight different case:

SoftPromoteHalfOperand Op #1: t11: v32bf16 = insert_vector_elt t9, t7, Constant:i64<1>

Do not know how to soft promote this operator's operand!
UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:3015!

Let me know if you need more info?

@RKSimon
Copy link
Collaborator

RKSimon commented Jul 21, 2023

@phoebewang A similar crash occurs when the D152928 wip patch is applied and we run ninja check-llvm-codegen-x86

@phoebewang
Copy link
Contributor

@phoebewang I have the same crash with a slight different case:

SoftPromoteHalfOperand Op #1: t11: v32bf16 = insert_vector_elt t9, t7, Constant:i64<1>

Do not know how to soft promote this operator's operand!
UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:3015!

Let me know if you need more info?

No idea if I forgot to verify it with this case or it's new regression caused by latter patches. Anyway, it can be fixed by https://reviews.llvm.org/D155952
If you still see the same crash, please provide the new reproducer. Thanks!

@phoebewang
Copy link
Contributor

@phoebewang A similar crash occurs when the D152928 wip patch is applied and we run ninja check-llvm-codegen-x86

Thanks @RKSimon , but I failed to apply D152928 in my local. Would you mind to have a try with D155952 ?

@phoebewang
Copy link
Contributor

@phoebewang A similar crash occurs when the D152928 wip patch is applied and we run ninja check-llvm-codegen-x86

Thanks @RKSimon , but I failed to apply D152928 in my local. Would you mind to have a try with D155952 ?

I can build it locally now, will try it myself.

@phoebewang
Copy link
Contributor

@phoebewang A similar crash occurs when the D152928 wip patch is applied and we run ninja check-llvm-codegen-x86

Thanks @RKSimon , but I failed to apply D152928 in my local. Would you mind to have a try with D155952 ?

I can build it locally now, will try it myself.

D155961 will solve it ✌️

phoebewang added a commit that referenced this issue Jul 21, 2023
phoebewang added a commit that referenced this issue Jul 22, 2023
phoebewang added a commit that referenced this issue Jul 22, 2023
Fixes root cause of #63017.
The reason is similar to BUILD_VECTOR. We have legal vector type but
still soft promote for scalar type. So we need to customize these scalar
to vector nodes.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D155961
phoebewang added a commit that referenced this issue Jul 23, 2023
Found this problem when investigating #63017

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D156050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants