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

When do nested list feature in Mojo will be fixed?

Just want to know when this feature to be fixed, saw an issue on github posted since oct last year.

Prevent inline

Does anyone know a trick or official means to prevent a function from being inlined? Any ugly trick would be fine....

PI in math library?

Does Mojo's math library contain PI? If not what are ways to add it to a mojo module?

What's the recommended way to develop using docker?

I coulndn't install in macos because of some errors with clang++, I created a ticket on github. But how should I try it out in a meanwhile? I want to clone llama.mojo repo and check it out

Trying to understand Parallelize

I have some code which I would like to speed up and cannot vectorize since it uses custom types. I am trying to use parallelize to split up the compute and am running in a Docker container on Intel Mac, Mojo 0.7.0. I have tried many combinations of parallelize[func](jobs, workers) but the best improvement I can get is about 2.5x. Why can I not do any better?

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:...

Store Reference in struct

Is there an example on how to create a struct with a Reference field?

Mojo for front-end development.

Is it possible to use Mojo for front-end development?

DTypePointer to StaticTuple array

Suppose I have defined a static tuple x as follows: var x = StaticTuple[4, Float32](1.0, 2.0, 3.0, 4.0). Is it possible to create an instance of DTypePointer[DType.float32] from the address of x's underlying storage?

error: use of unknown declaration '_ZeroStartingRange'

In a Mojo function, how can I use the built in type _ZeroStartingRange as a return type? I received the following code snippet from kapa.ai on Modular's Discord server, but it has the same issue. https://discord.com/channels/1087530497313357884/1119100298456215572/1202422957947879524 I'm currently using Mojo SDK 0.7.0. Thanks! ``` fn createRange(end: Int) -> _ZeroStartingRange: return rangeend (end)...

Large static list storage

What would be the best way to store a static list of integers in Mojo? I would just like to be able to initialise a large (tens of thousands) number of integers in a static list much like in python so that i can access values from other mojo programs.

Custom LLVM Plugins during Mojo build

Will there be the possibility pass custom llvm plugins during mojo build step? Especially for the AOT scenario we want to process the LLVM IR / provide custom backends.

How do I use hash map indexing without try blocks

How do I use a "function that raises in a context that cannot raise" if I know for sure it won't raise, for example in hash map indexing

image processing

Hey, any plans to make add image processing library? I would love that. #image #vision

import gpu.Function

Trying to replicate the code presented at mojo lightning talk https://www.modular.com/blog/mojo-lightning-talk But got the error 'package gpu doesnot contain Function...
No description

When to use arguments over parameters

Hi all. In what cases would it be appropriate to pass an input to a function as an argument rather than as a parameter? One situation where it seemed appropriate was if you only know the type of the input at runtime - but fn functions require you to specify types for arguments anyhow....

Set struct coming?

Now that hashable traits and structs based on them have gotten mature enough to have a Dict implementation (0.7), can we expect to see Set’s be implemented soon?

How to do recursive structs?

I'm trying to implement a json decoder, but I can't even make a struct that will hold the result. Here is the code I'm trying to run: ```python from stdlib_extensions.builtins import list, dict, HashableStr from collections.optional import Optional...