Skip to content

Bump llvm - transform.apply_registered_pass options params #1055

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

Merged
merged 8 commits into from
Jun 12, 2025

Conversation

@rolfmorel
Copy link
Contributor Author

rolfmorel commented Jun 11, 2025

CI now fails with

error: failed to legalize operation 'cf.br' that was explicitly marked illegal
ERROR: Failed to lower IR to LLVM dialect

for the following for four tests:

Failed Tests (4):
  TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-gemm.mlir
  TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-mlp.mlir
  TPP_OPT :: BF16/Integration/avx512bf16/vector-contract-to-amx-gemm.mlir
  TPP_OPT :: BF16/Integration/avx512bf16/vector-contract-to-amx-mlp.mlir

However, on the compile server all the tests pass.

@shahidact , @arun-thmn , @adam-smnk , @rengolin - any clue what the issue might be?

@rolfmorel rolfmorel requested review from shahidact, adam-smnk, rengolin and arun-thmn and removed request for shahidact June 11, 2025 21:22
@arun-thmn
Copy link
Contributor

arun-thmn commented Jun 12, 2025

@rolfmorel
The below two tests should be removed as these tests targets amx and in wrong avx512bf16dp folder.
TPP_OPT :: BF16/Integration/avx512bf16/vector-contract-to-amx-gemm.mlir
TPP_OPT :: BF16/Integration/avx512bf16/vector-contract-to-amx-mlp.mlir

The other two tests skipped (not passed) on no amx (compile node) because it's target is AMX machine. On the login node spr it get invoked and on compile node no amx it get skipped.
TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-gemm.mlir
TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-mlp.mlir

@rolfmorel
Copy link
Contributor Author

rolfmorel commented Jun 12, 2025

Okay. Removed the duplicated tests. The following two tests still fail on EMR (on the compile node and login node they are skipped) with the message error: failed to legalize operation 'cf.br' that was explicitly marked illegal -- ERROR: Failed to lower IR to LLVM dialect.

TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-gemm.mlir
TPP_OPT :: BF16/Integration/amx/vector-contract-to-amx-mlp.mlir

Looking at the IR the failure to convert/legalize the cf.br is related to !amx.tile<..> types not having been converted to !llvm.x86_amx:

    %145 = builtin.unrealized_conversion_cast %144 : !llvm.x86_amx to !amx.tile<16x16xf32>
    %146 = llvm.mul %101, %93 : i64
    %147 = llvm.add %146, %95 : i64
    %148 = llvm.getelementptr %115[%147] : (!llvm.ptr, i64) -> !llvm.ptr, f32
    %149 = llvm.call_intrinsic "llvm.x86.tileloadd64.internal"(%91, %90, %148, %89) : (i16, i16, !llvm.ptr, i64) -> !llvm.x86_amx
    %150 = builtin.unrealized_conversion_cast %149 : !llvm.x86_amx to !amx.tile<16x16xf32>
    %151 = llvm.mul %101, %93 : i64
    %152 = llvm.add %151, %101 : i64
    %153 = llvm.getelementptr %115[%152] : (!llvm.ptr, i64) -> !llvm.ptr, f32
    %154 = llvm.call_intrinsic "llvm.x86.tileloadd64.internal"(%91, %90, %153, %89) : (i16, i16, !llvm.ptr, i64) -> !llvm.x86_amx
    %155 = builtin.unrealized_conversion_cast %154 : !llvm.x86_amx to !amx.tile<16x16xf32>
    cf.br ^bb9(%96, %140, %145, %150, %155 : index, !amx.tile<16x16xf32>, !amx.tile<16x16xf32>, !amx.tile<16x16xf32>, !amx.tile<16x16xf32>)
  ^bb9(%156: index, %157: !amx.tile<16x16xf32>, %158: !amx.tile<16x16xf32>, %159: !amx.tile<16x16xf32>, %160: !amx.tile<16x16xf32>):  // 2 preds: ^bb8, ^bb10
    %161 = builtin.unrealized_conversion_cast %156 : index to i64
    %162 = llvm.icmp "slt" %161, %99 : i64
    llvm.cond_br %162, ^bb10, ^bb11
  ^bb10:  // pred: ^bb9
    %163 = builtin.unrealized_conversion_cast %160 : !amx.tile<16x16xf32> to !llvm.x86_amx
    %164 = builtin.unrealized_conversion_cast %159 : !amx.tile<16x16xf32> to !llvm.x86_amx
    %165 = builtin.unrealized_conversion_cast %158 : !amx.tile<16x16xf32> to !llvm.x86_amx
    %166 = builtin.unrealized_conversion_cast %157 : !amx.tile<16x16xf32> to !llvm.x86_amx

@adam-smnk, any ideas?

@adam-smnk
Copy link
Contributor

It looks like type conversion for within non-amx ops is missing after I axed AMXDialectLLVMIRTranslationInterface.
I'll see if I can somehow add the type conversion without bringing the whole thing back.

@adam-smnk
Copy link
Contributor

This should be fixed after llvm/llvm-project#143871

@rengolin
Copy link
Contributor

This should be fixed after llvm/llvm-project#143871

Indeed. Best to re-bump now than change the tests and bump again later.

@rolfmorel rolfmorel merged commit 0ac44d7 into libxsmm:main Jun 12, 2025
13 checks passed
@rolfmorel
Copy link
Contributor Author

Thanks for the quick fix upstream, @adam-smnk !

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.

5 participants