[all-commits] [llvm/llvm-project] c12cb0: [mlir][python] fix value-builder generation for sn...

Maksim Levental via All-commits all-commits at lists.llvm.org
Fri Apr 11 05:56:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c12cb0ccbb408c5e65801a6aa5a8e53b8b36c646
      https://github.com/llvm/llvm-project/commit/c12cb0ccbb408c5e65801a6aa5a8e53b8b36c646
  Author: Maksim Levental <maksim.levental at gmail.com>
  Date:   2025-04-11 (Fri, 11 Apr 2025)

  Changed paths:
    M mlir/test/mlir-tblgen/op-python-bindings.td
    M mlir/test/python/dialects/rocdl.py
    M mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

  Log Message:
  -----------
  [mlir][python] fix value-builder generation for snake_case ops (#135302)

Ops that are already snake case (like [`ROCDL_wmma_*`
ops](https://github.com/makslevental/llvm-project/blob/66b0b0466bbd995146aadaf2cd18de5476c19941/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td#L411))
produce python "value-builders" that collide with the class names:

```python
class wmma_bf16_16x16x16_bf16(_ods_ir.OpView):
  OPERATION_NAME = "rocdl.wmma.bf16.16x16x16.bf16"
  ...

def wmma_bf16_16x16x16_bf16(res, args, *, loc=None, ip=None) -> _ods_ir.Value:
  return wmma_bf16_16x16x16_bf16(res=res, args=args, loc=loc, ip=ip).result
```

and thus cannot be emitted (because of recursive self-calls).

This PR fixes that by affixing `_` to the value builder names. 

I would've preferred to just rename the ops but that would be a breaking
change :shrug:.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list