Skip to content

Conversation

@shivasankarka
Copy link
Collaborator

@shivasankarka shivasankarka commented Nov 14, 2025

Refer to the PR commits below for full descriptions. In short, this PR enables Matrix to returns views now. It also upgrades the tests to use the latest Mojo TestSuite. Finally, it upgrades NuMojo to use latest Mojo nightly. This will let us roll out a new NuMojo version right after modular releases Mojo 25.7.0.

Notes:

shivasankarka and others added 3 commits November 5, 2025 00:11
This PR lays the groundwork for returning views in both the Matrix and
NDArray types.
It also implements full support for Matrix views. The design for
returning view is described in the NuMojo enhancement proposal #279

Support for NDArray views will be completed in a subsequent PR.

Currently test workflow is commented out. Since Mojo has removed the
`test` command, we will use the `TestSuite` to run tests hereafter. The
tests will be fixed in the follow up PR.

---------

Co-authored-by: ZHU Yuhao 朱宇浩 <[email protected]>
Mojo has deprecated `mojo test` command as of the latest nightly. This
PR adds support for using the `TestSuite` to run NuMojo tests and
updates the GitHub workflows.

---------

Co-authored-by: ZHU Yuhao 朱宇浩 <[email protected]>
# Description 

This pull request migrates the test infrastructure from using `mojo
test` to `mojo run` with a new TestSuite-based approach. It also
includes improvements to the Matrix class, including fixing buffer type
handling, enhancing slicing/indexing methods, and refactoring
cumsum/cumprod implementations.

- Migrated all test files to use TestSuite.discover_tests pattern with
main() functions
- Temporarily renamed all Matrix `__getitem__` and `__setitem__` that
return views to be `get()` and `set()` due to a Bug in Mojo which
doesn't allow use setting arrays with views as arguments in
`__setitem__`. A bug report has been made in Mojo repo which can be
found [here](modular/modular#5545).
- Currently, the default `__getitem__` and `__setitem__` will return
copies. Use `get` and `set` to returns views for now till Mojo bug gets
resolved.
- Added more `__setitem__` and `set` methods with various arguments to
improve setter of Matrix.
- Improved cumsum/cumprod implementations to better handle C and F
contiguous matrices
- Changed Buffered trait methods to static for is_own_data() and
is_ref_data()

---------

Co-authored-by: ZHU Yuhao 朱宇浩 <[email protected]>
This PR replaces UnsafePointer with `LegacyUnsafePointer` and fixes
import names for the UnsafePointer. This will enable use to temporarily
use old pointer and push changes to GitHub before migrating to
completely new `UnsafePointer` in the next PR.
@shivasankarka shivasankarka requested a review from a team November 15, 2025 04:52
Copy link
Collaborator

@forfudan forfudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shivasankarka, I am back from my holiday. Thanks for the updates! The change of test to test suite is quite a big step.

@shivasankarka
Copy link
Collaborator Author

Hey @shivasankarka, I am back from my holiday. Thanks for the updates! The change of test to test suite is quite a big step.

Welcome back :). Yeah, it's quite a change, it's also a tad slow to run all tests. But it gives much better debugging information right now.

@shivasankarka shivasankarka merged commit d2a1ce5 into pre-0.8 Nov 26, 2025
2 checks passed
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.

3 participants