Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to complex expr in compile_call_expr #351

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

glou-nes
Copy link
Contributor

@glou-nes glou-nes commented Dec 9, 2024

fix #333.
Help reducing the discrepancy between @code_typed (and friends) and @code_hlo.
Introduce a function call for complex expression in Compiler.compile_call_expr. Avoid invalid MLIR generation for expression like @jit f(f(a)). A new anonymous function is created only for these complex case.

using Reactant
x = Reactant.to_rarray(ones(3))
y = Reactant.ConcreteRNumber(5)
foo(a; b) = a * b
@jit (x.^2).^2
@jit foo(x;b = y)

src/Compiler.jl Outdated Show resolved Hide resolved
src/Compiler.jl Outdated Show resolved Hide resolved
src/Compiler.jl Outdated Show resolved Hide resolved
@avik-pal
Copy link
Collaborator

avik-pal commented Dec 10, 2024

After this change will @jit foo(Reactant.to_rarray(rand(2))) still work? Or is the expectation that this needs to be written as:

x = Reactant.to_rarray(rand(2))
@jit foo(x)

@glou-nes
Copy link
Contributor Author

@avik-pal, I restored the normal behavior and it seems that the CI is right.

@glou-nes
Copy link
Contributor Author

glou-nes commented Dec 13, 2024

Kw is supported too now.
Main:

@jit Ops.pad(x, v; low=[1])

quote
    begin
        var"##f#492373" = Ops.pad
        var"##args#492374" = (x, v; low = [1])
        var"##compiled#492375" = (Reactant.Compiler.compile)(var"##f#492373", var"##args#492374"; sync = false, optimize = true)
    end
    var"##compiled#492375"(var"##args#492374"...)
end

@wsmoses
Copy link
Member

wsmoses commented Dec 20, 2024

@avik-pal are the failures here related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broadcasting Operations: invalid MLIR generated
4 participants