Skip to content

[mojo] Bring NuMojo up to compat with stdlib version 0.26.2.0.dev2026031005#333

Closed
josiahls wants to merge 8 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.9from
josiahls:fix/mojo-updates
Closed

[mojo] Bring NuMojo up to compat with stdlib version 0.26.2.0.dev2026031005#333
josiahls wants to merge 8 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.9from
josiahls:fix/mojo-updates

Conversation

@josiahls
Copy link
Copy Markdown
Contributor

@josiahls josiahls commented Mar 10, 2026

Mojo Compatibility Updates for NuMojo

This PR updates NuMojo for compatibility with recent Mojo nightlies and fixes several related issues.

Changes

Mojo Language & API Updates

  • @parameter ifcomptime if: Replaces deprecated @parameter if with comptime if across the codebase (formatting, dtype utilities, complex SIMD, etc.).

  • VariadicList is_owned: Fixes VariadicList usage where is_owned=False was needed for correct inference. Affects NDArrayShape, NDArrayStrides, Item, IndexBuffer, and creation routines (empty, ones, zeros, full, rand).

  • _get_ptrunsafe_get: Replaces _get_ptr with unsafe_get for Variant/VariantList access in NDArray and ComplexNDArray slicing, since _get_ptr is now hidden behind a storage field.

Trait Updates

  • Representable and StringableWritable: Replaces deprecated Representable and Stringable traits with Writable where appropriate. Affects Device, ComplexDType, ComplexNDArray, ComplexSIMD, ImaginaryUnit, NumojoError, IndexBuffer, Item, NDArrayShape, NDArrayStrides, NewAxis, Matrix, DataContainer, and storage types.

Bug Fixes

  • Recursive stringification in NDArrayStrides: Fixes infinite recursion when write_to used String(self), which re-entered write_to. Switched to self.__str__() in both __repr__ and write_to to avoid recursion.

  • AcceleratorDataContainer copy semantics: Fixes implicit copy of DeviceStorage by explicitly copying host_storage and device_storage in the copy initializer.

Dependency Update

  • Modular/Mojo version: Bumps the modular dependency to >=26.2.0.dev2026031005,<27.

@josiahls josiahls force-pushed the fix/mojo-updates branch 2 times, most recently from 27c39e0 to 9e6952d Compare March 10, 2026 17:16
@forfudan
Copy link
Copy Markdown
Collaborator

Hi @josiahls, the format of the PR seems not very proper. Would you checkout the other PRs and update it?

  1. Would you provide a title to the PR with a bracket [] showing the topics it covers.
  2. Would you provide a description on what have been changed.

I noticed that you have changed 24 files, which is not a proper given that @shivasankarka's PRs #331 and #332 are still under review. It is nice to make it smaller PRs very time, or let us know in the Discord that you are planning to make changes across many files.

Moveover, if you need to still work on the PR, it might be nice to make it a draft PR. Thank you for your understanding.

@josiahls josiahls changed the title Fix/mojo updates [mojo] Bring NuMojo up to compat with stdlib version 0.26.2.0.dev2026031005 Mar 10, 2026
@josiahls josiahls marked this pull request as draft March 10, 2026 17:30
@josiahls josiahls marked this pull request as draft March 10, 2026 17:30
Changed these to is_owned=False. Unclear if some of these should own (?)
Representable is being deprecated in favor of Writable.
Stringable is being deprecated in favor of Writable.
`_get_ptr` is now hidden behind a storage field, and
they are provided `unsafe_get` should be attempting the same
goal here.
Since we are unifying everything under Writable,
if Writable calls String(self) we get a horrible recursive bug.
Changed to explicitly copy the DeviceStorage.
@josiahls
Copy link
Copy Markdown
Contributor Author

Closing, solved by chunked prs

@josiahls josiahls closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants