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

[BUG]: Slow Max Graphs Compilation #241

Open
taalhaataahir0102 opened this issue Oct 16, 2024 · 1 comment
Open

[BUG]: Slow Max Graphs Compilation #241

taalhaataahir0102 opened this issue Oct 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@taalhaataahir0102
Copy link

Bug description

MAX graphs takes along time to compile, around 300-500 ms even for smaller graphs as well.
The compilation becomes a bit faster on next consecutive code execution due to caching but still the time compilation time for graphs remains above 250 ms.
Note: enable_model_ir_cache is already true in modular.cfg file.

Steps to reproduce

Code example:

fn main() raises:
    var session = engine.InferenceSession()
    start = now()
    var graph1 = Graph(in_types=List[Type](TensorType(DType.float32, "a","m")))
    var transposed = ops.transpose(graph1[0],-1,-2)
    graph1.output(transposed)
    graph1.verify()
    var transpose = session.load(graph1)
    end1 = now()
    print("total compile time for graph1: ",(end1 - start)/1000000000)

    var graph2 = Graph(in_types=List[Type](TensorType(DType.float32, "m", "n"), TensorType(DType.float32, "n","x")))
    var out3 = graph2[0] @ graph2[1]
    graph2.output(out3)
    graph2.verify()
    var multiplication = session.load(graph2)
    end2 = now()
    print("total compile time for graph2: ",(end2 - end1)/1000000000)

The output is following:

total compile time for graph1:  0.31278938899999997
total compile time for graph2:  0.451578655

System information

OS: Ubuntu 22.04.3 LTS
Mojo version: mojo 24.5.0 (e8aacb95)
max 24.5.0 (e8aacb95)
Modular version 24.5.0
@taalhaataahir0102 taalhaataahir0102 added the bug Something isn't working label Oct 16, 2024
@taalhaataahir0102 taalhaataahir0102 changed the title [BUG]: [BUG]: Slow Max Graphs Compilation Oct 16, 2024
@ehsanmok
Copy link
Member

For the record, here is the discussion in our community discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants