Heyitsmeguys
MModular
•Created by Heyitsmeguys on 5/23/2024 in #questions
What is the basis for Mojo's `async`?
As per the title, I'm wondering what the underlying mechanism for
async
libraries will be. In the community meeting, it was mentioned that async
and coroutines would be areas of focus in Mojo's design for the next few months, so I think this is the right time to discuss their design.
In C++, the underlying mechanism on which async
libraries were built was initially chosen to be coroutines, but there's work going on right now to introduce a better alternative:
In a suite of generic async algorithms that are expected to be callable from hot code paths, the extra allocations and indirections are a deal-breaker. It is for these reasons that we consider coroutines a poor choice for a basis of all standard async.Source Can Mojo avoid these disadvantages or is there work to be done here?
36 replies
MModular
•Created by Heyitsmeguys on 2/2/2024 in #questions
Use cases of references wrt value types?
In the community live stream, it was mentioned that references allow one to extend the lifetimes of values and prevent unnecessary copies.
I can see their usefulness wrt reference, non-copyable and/or non-movable types, but because Mojo has mutable value semantics, references seem unnecessary for value types. One can just move a value in order to extend its lifetime.
About the "preventing unnecessary copies" part, I thought the compiler would optimize those away anyways? There's a lot of work done in Hylo and Swift to make value semantics as efficient as possible, and I thought Mojo would follow them, seeing how it leans heavily into value semantics. From the manual:
In Mojo, we want to provide full value semantics by default
1 replies
MModular
•Created by Heyitsmeguys on 10/5/2023 in #questions
How does Mojo balance fast compiles and providing zero-cost abstractions to the user?
In the Mojo docs, it's mentioned that the Mojo compiler is "simple and fast by definition" and not "magic". Fast compilation speed is also a design goal.
My understanding is that in languages like Rust, the compile-time checks which are used for optimizations and the optimizations themselves contribute a lot to compilation speed (or rather the lack of compilation speed).
How does Mojo aim to provide high level zero-cost abstractions and performance comparable to C++ and Rust? What are the limits to its optimizations? How much of a burden is there on the programmer to keep the code fast as abstraction levels increase?
1 replies
MModular
•Created by Heyitsmeguys on 10/4/2023 in #questions
When will the keynote by Modular be delivered?
I heard in an interview (I think it was the Lex Fridman one but I'm not sure) that the Modular team would deliver the keynote at the next LLVM developer conference. When is that?
4 replies
MModular
•Created by Heyitsmeguys on 9/28/2023 in #questions
How does Mojo's compile-time interpreter work?
I've been pretty curious about the Mojo compiler's internal workings for quite a while: how it decides which parameters to pick for autotuning, how it allows programmers to seamlessly program GPUs and stuff (I'm assuming without explicitly needing to mention which accelerator the code should run on). For now I want to know what exactly Mojo's compile time interpreter is.
What is the need for it? What use cases does it solve? And how does it work?
1 replies