Modular

M

Modular

This server is the home of the MAX and Mojo community. Join us to chat about all things Modular!

Join

questions

community-showcase

Does anyone think Mojo could be great for Game Development?

It's faster than Python and C++ (on certain occasions). Did anyone think of ways it could become used for Game Dev?...

What does the asterisk in this mojo code mean? fn __init__(inout self, *, capacity: Int):

I'm curious about the source code for List (https://github.com/modularml/mojo/blob/main/stdlib/src/collections/list.mojo#L105C5-L105C47), which has this line
fn __init__(inout self, *, capacity: Int):
...
fn __init__(inout self, *, capacity: Int):
...
...

When do you plan to open-source "algorithms" module?

At this moment, "algorithms" module is not available yet in the open-sourced code (source). Do you have an approximate plan when it will be open-sourced? For example, being able to extend sort to work with strings would be an amazing thing. Thank you.

Returning a reference from a factory

I know that reference and lifetimes are still being worked on, but I was wondering if it will be possible to return a reference from a factory function, e.g.: ```mojo fn some_factory() -> Reference[String]: var build_string = "Hello" # initially lifetime is bounded to the local variable in the function scope...

MLIR Learning Resources

Very interested in diving into the weeds of ML compilers such as Modular and Triton. The overarching motivation -- other than the fact that ML compilers are super-interesting 🙂 -- is that in a world of increased demand for ML training / inference but limited GPU (NVIDIA) supply, the ability to write code that is performant and device-agnostic is evermore important. Are you aware of any resources for learning MLIR incrementally, ideally building from basics to something like a "toy" Modular / Triton compiler, and more ambitiously, the ability to contribute new optimization passes to such compilers? I've walked through the official MLIR "toy" language tutorial and am looking for a hackable set of guides to bridge the gap between basics and real world use. I realize it's not strictly necessary to understand MLIR -- as the purpose of Modular is to abstract away these details -- but I think it helps to understand how things work under the hood....

List os Dict

I'm learn mojo, and I wnat use for llm, but my payload need be
[{"role": "role", "content": "content"}, {"role": "role", "content": "content"}]
[{"role": "role", "content": "content"}, {"role": "role", "content": "content"}]
...
No description

Using custom bitwidth MLIR integers.

Hi If we were to create custom types that wrap around custom bitwidth integers using MLIR types and operations, does it improve performance? Theoretically, it should not right? Because if the register is 64 bits wide, it would be a waste to use only 4 bits to store a ui4 wasting the entire 60 bits. Unless, the compiler is smart enough to look at the function signature and then group many e.g...

Tensor Open Source

Hi in the documentation tensors are listed under the standard library category but I can’t find it’s contents in the mojo GitHub repo. Is this not something that is going to be open sourced in the near future?

Are there any frontend libraries that currently support Mojo?

I'm wondering, is there anything like Qt or TKinter for Mojo at the moment?

How to Create a Multi-Type List in Mojo?

Hi all! I'm working with Mojo and need to create a list with elements of different data types (integers, strings, booleans, etc.). How can I achieve this? Are there specific collection types or methods in Mojo for mixed data types? Any guidance or documentation links would be greatly appreciated. Thanks in advance!...

Official Linux repositories

I am sorry if this question has already been answered but when do you plan to release mojo on other official repositories such as pacman so we do not have to use community aur version that hardly works?

Can Mojo source code be compiled to generate mlir code later?

Hello, I use mojo to compile mojo code to be X86 executable, and use objdump tool to get asm code, and I wonder if we can get MLIR code later?

Questions relative to Mojo's optimization and speed

Hello, I have a project in Python that requires doing a lot of processing on datas and I'm noticing it taking a lot of time. So I'm planning to use Mojo instead of Python. 1. I know that Mojo is way faster than Python in most cases but I'm wondering if it's still the case if I use python libraries like pandas or scikit-learn like so: ```Mojo from PythonInterface import Python...

String to float

How can i convert string to float32? e.g.,
var a:String = "-0.01536663"
var a:String = "-0.01536663"
atol is not helping as it's used to convert to integers and not float....

Create a SIMD[DType.address] from a DTypePointer[T]

It would seem like DTypePointer[T].address_of(SIMD[T) would be correct, but this returns a DTypePointer aswell, which has type T, not DType.address. A bitcast seems incorrect as this would directly cast the numeric value into a pointer location, which is wrong, and I do not feel that loading the data as an address is the correct answer either. Hoping to use gather and scatter on SIMD vectors from a DTypePointer if possible.

Compile Time UUID

Dainemo does a good job accomplishing this (https://github.com/StijnWoestenborghs/dainemo/blob/main/dainemo/utils/uuid.mojo) But I wonder if there is a better way using instrinsics or system calls to get the time (Since time.now() doesnt work at compile time) The goal being of course to be able to run the following code ...

Kotlin's extension function in Mojo?

Not so long ago, I've discovered that Kotlin have a possibility to extend already defined classes with a new function. For example: ```kotlin fun String.getWordsList(): List<String> {...

What is the size of the Int type in bits?

I did not find any relevant information about whether it is related to the platform(like 32 or 64 bits). Is it a signed or unsigned integer? Is it possible to store 128-bit integers with Mojo?

Type independent traits

Any ways to make the example code work? Would be nice to be able to implement custom traits for abstract classes ```typescript trait Container: fn contains(self, item: AnyType) -> Bool:...