Skip to content

Lower linalg.generic before MLIR-to-LLVM translation for math ops #16

@xlinsist

Description

@xlinsist

Deliverables

  • Submit a PR on preventing unlowered linalg.generic from reaching mlir-translate --mlir-to-llvmir in Triton RISC-V math op lowering.
  • Include focused pytest evidence showing that python/examples/test_core.py::test_math_op[float32-log-x] no longer fails with a missing linalg dialect diagnostic.

Background

The current repository has a math lowering failure where final MLIR translation receives a linalg.generic op:

error: Dialect `linalg' not found for custom op 'linalg.generic'

Representative failure:

/tmp/.../ll.mlir:53:5: error: Dialect `linalg' not found for custom op 'linalg.generic'

This indicates the final translation boundary is receiving IR that has not been fully lowered to dialects accepted by the selected mlir-translate path.

Task Description

  • Reproduce from the triton-riscv repository root:
cd python/examples
pytest -q 'test_core.py::test_math_op[float32-log-x]'
  • Capture the final ll.mlir or equivalent IR and identify the pass sequence that leaves linalg.generic in the translation input.
  • Fix the pass pipeline so this math op is lowered before mlir-translate, or use a translation context that intentionally supports the dialect if that is the correct architecture.
  • Run the focused pytest case above and at least one adjacent math op such as exp, sqrt, or sin.
  • In the PR description, include the before/after IR boundary, the pass ordering change if any, and the pytest commands run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions