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

can I implement a trait for a third party type?

Am I right in my understanding that I can’t implement a trait I control for a type that I don’t control? For example I couldn’t implement a trait requiring an addition operator for any built in integer types? This is a point of difference with Rust traits and Haskell type classes?

Is it possible to push mojo code on GitHub?

Hi, I didn’t really understand “proprietary” license. Can I use mojo for development or not?

Does anybody know how to setup monorepo on Mojo?

I am trying to use Poetry to build this. Is there a Mojo specific package manager to wrap up codes into binary or share as in open source project?

Compile Time Binary Tree in Mojo

I'm new to Mojo (who isn't), and I'm trying the language for something else than ML: metaprogramming. So I made a binary tree type that is generated at compile time. Here is a gist with 72 lines Question: does such an approach make any sense? Am I pushing the language too far?...

Is StringLiteral intended for handling c strings?

Suppose I have c-library function in thing.c that returns a string. What datatype should I use to represent the return type for a FFI binding in a Mojo program? ```c char* returnABCD(void) { // Returns (pointer to a) null-terminated string return "abcd";...

Type conversion between basic types

I seem to struggle to figure out how to convert basic types. There are to_int() functions but converting to bool or to float from int or similar stumps me. How is it supposed to work? The code let a: Int32 = 5 let b: Float32 = Float32(a)...

Mojo + WebAssembly -> WASI-NN

Hey Team, I’m part of the community around the open standard for WebAssembly and WASI-NN. I know Chris is aware of WASM already but wanted to potentially start a conversation about a collaborative partnership between Mojo and WASI-NN specifically. The way i see it the MOJO team's work with Python data types for MLIR programming offers valuable insights for WASI-NN. Leveraging MOJO's expertise could significantly enhance hardware-agnostic optimization, memory management, and metaprogramming capabilities within WASI-NN, ultimately leading to a more robust and efficient platform for WebAssembly-based machine learning. Collaboration between MOJO and WASI-NN holds immense potential to accelerate the development and adoption of hardware-agnostic ML solutions, democratizing access to AI technology for developers and users alike. Could we potentially work together ? ...

Difference between a pointer and dtypepointer in mojo.

Hi could someone help me with the difference between the pointer function and a dtypepointer function in mojo.

cannot install mojo

Error: Command '['/root/.modular/pkg/packages.modular.com_mojo/venv/bin/python3', '-m', 'ensurepip', '--upgrade', '--default-pip']' I am getting this error when trying to install mojo on ubuntu Ubuntu 20.04.6 LTS Server

Unable to implement matrix multiplication on a large matrix

I tried to compare my matrix multiplication implementation with that of the same python implementation and the algorithm worked for smaller matrices but it crashed for bigger ones System information: ubuntu WSL windows 10 ...
No description

Should Tensor be a CollectionElement?

Tensor has copyinit and moveinit but still can’t be stored in DynamicVector. I think it just needs the CollectionElement conformance declared.

Term paper about Mojo - Open questions

Hi I am currently completing my Bachelor's degree in Computer Science at the Lucerne University of Applied Sciences and Arts in Switzerland. In my term paper, I am testing Mojo and comparing it with Python. This includes comparing differences, special concepts and performance. In one chapter I would like to explain how the interoperability between Python and Mojo exactly works. I was able to find some information on this in the manual and in the blogs, but not enough in-depth information. Therefore, I still have some open questions: - How can I as a programmer know where parts of my code are compiled? (LLVM or Python interpreter, what does it depend on). - How do the two compilers share resources? And how do the different compiled machine codes work together? (Are they uniform?)...

What would be the target-triple to cross-compile for Graviton.

From the MAX Engine FAQ
Does MAX Engine support generic ARM architectures? Yes, both Mojo and MAX Engine support generic ARM architectures like Apple ARM chips. We formally benchmark ourselves on Graviton because it’s the most commonly used ARM chip for server deployments, and our benchmarks are designed to match what users use most often in production.
...

Can i have a list of structs with different parameters?

Lets say I have a struct like the one below, is it possible to have a list of structs that have different values inside their compile time parameters? This is just a sample struct, I know it's trivial and you wouldn't create a Name struct but this is just demonstrate the concept. ``` trait Proto(Stringable, CollectionElement): fn print(self) -> None: ......

Can I have a struct hold a pointer to an another Self instance?

When I try doing that I get this issue: https://github.com/modularml/mojo/issues/1402 I'd love to do Day8 cleanly with a Tree but I fear I won't be able to if nobody has a work around this...

Distributing the binary as a docker image

I'm playing with mojo at ArchLinux and I am very excited about it, considering it is not yet supporting Windows, nor cross compilation, I would like to build a docker image of my binary, and import it at my Windows docker desktop, I would like to import from the scratch docker, what is the minimal setup or dependencies that should be including in my docker image to get the binary built using mojo run smoothly?

Are literals splatted in SIMD Operations?

Is there any performance difference if I write this ```python fn multiply_by_two[ dtype: DType, simd_width: Int...

How does memcpy work in 0.6.0 ?

Before, I wrote a helper function for string vector in 0.5.0 and memcpy was working fine, now I am unable to do so in 0.6.0, this is code snippet: ``` alias strtype = DTypePointer[DType.int8] var data: Pointer[strtype] ......

Will the special methods slowly transition to traits?

Will the special methods slowly get replaced by traits to allow for static analysis, optimizations, more safety, parameterized functions discriminating by traits etc. ? e.g. std::ops Traits like Add for __add__, Mul... in Rust ?...