llvm / llvm/llvm-project

[MLIR] XeVM `gpu-lower-to-xevm-pipeline` leaves scalar `math.isinf` unconverted

Open
#213,583 2 comments 0 reactions 0 assignees View on GitHub
mlir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

On LLVM main, the XeVM lowering pipeline leaves a scalar `math.isinf` operation inside an otherwise LLVM-lowered `gpu.module`. Kernel serialization then fails because the Math dialect operation cannot be translated to LLVM IR.

### Input Program
`input.mlir`
```llvm
module attributes {gpu.container_module} {
gpu.module @kernels {
gpu.func @classify_inf(%input : memref<1xf32>,
%output : memref<1xi32>) kernel {
%c0 = arith.constant 0 : index
%zero = arith.constant 0 : i32
%one = arith.constant 1 : i32
%value = memref.load %input[%c0] : memref<1xf32>
%is_inf = math.isinf %value : f32
%result = arith.select %is_inf, %one, %zero : i32
memref.store %result, %output[%c0] : memref<1xi32>
gpu.return
}
}
}
```

### Reproduction Command
```bash
mlir-opt input.mlir '-gpu-lower-to-xevm-pipeline=xegpu-op-level=lane zebin-triple=spirv64-unknown-unknown zebin-chip=bmg opt-level=2 binary-format=fatbin'
```

The command fails with:
```bash
input.mlir:9:17: error: cannot be converted to LLVM IR: missing
LLVMTranslationDialectInterface registration for dialect for op: math.isinf
%is_inf = math.isinf %value : f32
^
input.mlir:9:17: note: see current operation:
%3 = "math.isinf"(%2) ... : (f32) -> i1
input.mlir:2:3: error: Failed creating the llvm::Module.
input.mlir:2:3: error: An error happened while serializing the module.
```

Version: 13e5ce40eff159ed9b2db3660b41c47ca640ce51.

Contributor guide

Open the contributing guide

Research direction

Start with the input.mlir reproducer and run the documented mlir-opt gpu-lower-to-xevm-pipeline command to confirm the failure. Trace the XeVM lowering pipeline handling of the scalar math.isinf operation; done means the operation is converted or otherwise handled so kernel serialization succeeds without the missing LLVMTranslationDialectInterface error.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.