Skip to content

Adding traditional element-wise operations to stablehlo-complex-math-expander #2913

@ddilbazTT

Description

@ddilbazTT

Request description

I am currently working on adding complex data type and operation support to an MLIR-based Compiler. I want to add support for simple element-wise operations in complex data type in a similar manner to stablehlo-complex-math-expander. However, I want to understand what is the best way to go about adding support for operations like add, multiply, divide.

For example, I want to add expansion for multiplication such that:

t1 * t2 = complex(re(t1) * re(t2) - im(t1) * im(t2), re(t1) * im(t2) + re(t2) * im(t1))

Could you please inform me if I should add support for these operations in pearu/functional_algorithms or through a different way? It seems like stablehlo-complex-math-expander is targeting an approximation for operations with complex tensors to improve accuracy. However, the goal with adding support for operations like add, multiplication, divide is to keep arithmetic in real domain. Therefore, I wanted to ensure the best place to locate expansion for such ops.

@pearu @mrguenther @GleasonK I would appreciate if you could give me advice on how to go about this. I can open a PR on adding support for operations of my interest once I know where to add them to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions