June 2023
2023-06-29
⭐️ New
- You can now share
.ipynbnotebook files in Mojo Playground. Just save a file in theshareddirectory, 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 thehelpdirectory, in the Mojo Playground file browser.
🦋 Changed
- The
unroll2()andunroll3()functions in theFunctionalmodule have been renamed to overload theunroll()function. These functions unroll 2D and 3D loops andunroll()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
TargetInfomodule now includesis_little_endian()andis_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): passFor details on the overload resolution logic, see the Mojo Manual section on parameters.
-
A new
cost_of()function has been added toAutotune. 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 theAssertmodule has been renamed toconstrained().
🛠️ Fixed
-
Overloads marked with
@adaptivenow 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
TupleLiteraltype was renamed to justTuple, e.g.Tuple[Int, Float].
🛠️ Fixed
- Issue #354 - Returning a tuple doesn't work even with parens.
- Issue #365 - Copy-paste error
in
FloatLiteraldocs. - 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 ofTupleLiteraltype (notably, it will not work withPythonObjectyet) 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
Int32instead ofSI32, similarly usingFloat32instead ofF32. 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?
Thank you! We'll create more content like this.
Thank you for helping us improve!