Skip to main content

June 2023

2023-06-29

⭐️ New

  • You can now share .ipynb notebook files in Mojo Playground. Just save a file in the shared directory, and then right-click the file and select Copy Sharable link. To open a shared notebook, you must already have access to Mojo Playground; when you open a shared notebook, click Import at the top of the notebook to save your own copy. For more details about this feature, see the instructions inside the help directory, in the Mojo Playground file browser.

🦋 Changed

  • The unroll2() and unroll3() functions in the Functional module have been renamed to overload the unroll() function. These functions unroll 2D and 3D loops and unroll() can determine the intent based on the number of input parameters.

🛠️ Fixed

  • Issue #229 - Issue when throwing an exception from __init__ before all fields are initialized.

  • Issue #74 - Struct definition with recursive reference crashes.

  • Issue #285 - The TargetInfo module now includes is_little_endian() and is_big_endian() to check if the target host uses either little or big endian.

  • Issue #254 - Parameter name shadowing in nested scopes is now handled correctly.

2023-06-21

⭐️ New

  • Added support for overloading on parameter signature. For example, it is now possible to write the following:

    fn foo[a: Int](x: Int):
        pass
    
    fn foo[a: Int, b: Int](x: Int):
        pass

    For details on the overload resolution logic, see the Mojo Manual section on parameters.

  • A new cost_of() function has been added to Autotune. This meta-function must be invoked at compile time, and it returns the number of MLIR operations in a function (at a certain stage in compilation), which can be used to build basic heuristics in higher-order generators.

    from autotune import cost_of
    
    fn generator[f: fn(Int) -> Int]() -> Int:
        @parameter
        if cost_of[fn(Int) -> Int, f]() < 10:
            return f()
        else:
            # Do something else for slower functions...
  • Added a new example notebook with a basic Ray Tracing algorithm.

🦋 Changed

  • The constrained_msg() in the Assert module has been renamed to constrained().

🛠️ Fixed

  • Overloads marked with @adaptive now correctly handle signatures that differ only in declared parameter names, e.g. the following now works correctly:

    @adaptive
    fn foobar[w: Int, T: DType]() -> SIMD[T, w]: ...
    
    @adaptive
    fn foobar[w: Int, S: DType]() -> SIMD[S, w]: ...
  • Issue #219 - Issue when redefining a function and a struct defined in the same cell.

  • Issue #355 - The loop order in the Matmul notebook for Python and naive mojo have been reordered for consistency. The loop order now follows (M, K, N) ordering.

  • Issue #309 - Use snake case naming within the testing package and move the asserts out of the TestSuite struct.

2023-06-14

⭐️ New

  • Tuple type syntax is now supported, e.g. the following works:

    fn return_tuple() -> (Int, Int):
        return (1, 2)

🦋 Changed

  • The TupleLiteral type was renamed to just Tuple, e.g. Tuple[Int, Float].

🛠️ Fixed

  • Issue #354 - Returning a tuple doesn't work even with parens.
  • Issue #365 - Copy-paste error in FloatLiteral docs.
  • Issue #357 - Crash when missing input parameter to variadic parameter struct member function.

2023-06-07

⭐️ New

  • Tuple syntax now works on the left-hand side of assignments (in "lvalue" positions), enabling things like (a, b) = (b, a). There are several caveats: the element types must exactly match (no implicit conversions), this only works with values of TupleLiteral type (notably, it will not work with PythonObject yet) and parentheses are required for tuple syntax.

❌ Removed

  • Mojo Playground no longer includes the following Python packages (due to size, compute costs, and environment complications): torch, tensorflow, keras, transformers.

🦋 Changed

  • The data types and scalar names now conform to the naming convention used by numpy. So we use Int32 instead of SI32, similarly using Float32 instead of F32. Closes Issue #152.

🛠️ Fixed

  • Issue #287 - computed lvalues don't handle raising functions correctly
  • Issue #318 - Large integers are not being printed correctly
  • Issue #326 - Float modulo operator is not working as expected
  • Issue #282 - Default arguments are not working as expected
  • Issue #271 - Confusing error message when converting between function types with different result semantics

Was this page helpful?