Skip to content

math.clampf doesn't have a direct lowering to LLVM #164880

@rrrrice

Description

@rrrrice

example mlir

module {
  func.func @clampf_example(%arg0: f32, %arg1: f32, %arg2: f32) -> f32 {
    %0 = math.clampf %arg0 to [%arg1, %arg2] : f32
    return %0 : f32
  }
}

got error for running llvm JIT

backend = LLVMJITBackend()
compiled = backend.compile(
    module_finished,
    kernel_name="clampf_example",
    pipeline=Pipeline().add_pass("convert-math-to-llvm").lower_to_llvm(),
)
invoker = backend.load(compiled)


=== Compiling ===
error: cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: math.clampf
Traceback (most recent call last):
  File "/Users/fanxie/mlir-python-extras/clampf.py", line 37, in <module>
    invoker = backend.load(compiled)
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fanxie/mlir-python-extras/mlir/extras/runtime/refbackend.py", line 312, in load
    return LLVMJITBackendInvoker(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fanxie/mlir-python-extras/mlir/extras/runtime/refbackend.py", line 152, in __init__
    self.ee = ExecutionEngine(
              ^^^^^^^^^^^^^^^^
RuntimeError: Failure while creating the ExecutionEngine.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions