Skip to content

Conversation

@FConstantinos
Copy link
Contributor

@FConstantinos FConstantinos commented Dec 15, 2025

  • Allows sequential execution of compute/dm threads in round robin
  • inserts a yield before blocking operations for RR scheduler to determine whether the thread can continue
  • Add support for matrix multiplication

@FConstantinos FConstantinos marked this pull request as ready for review December 17, 2025 22:38
@FConstantinos FConstantinos requested a review from a team as a code owner December 17, 2025 22:38
tt_testing.assert_close(out, expected)

def test_modes_produce_same_result(self) -> None:
"""Test that THREADED mode works (COOPERATIVE skipped due to getsource issues)."""
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the getsource issue?

Copy link
Contributor Author

@FConstantinos FConstantinos Dec 17, 2025

Choose a reason for hiding this comment

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

ah, just some issue I had while working on this, fixed now to run on both modes

def decorator(func: FunctionType) -> BindableTemplate:
class ComputeTemplate:
__name__ = func.__name__
_func = func # Store original function for inspect.getsource()
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using __wrapped__ instead of _func here. It's the standard convention from functools.wraps and has built-in support via inspect.unwrap() which would simplify the cooperative mode code to just inspect.unwrap(func) instead of manually accessing _func. Also means tools like debuggers and other decorators automatically understand the wrapping chain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is the issue I commented on earlier regarding getsource?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, exactly! Thanks, I fixed it now :)

@FConstantinos FConstantinos changed the title yield before wait/reserve yield before wait/reserve and support for matrix multiplication Dec 18, 2025
1 if i < remainder_tiles else 0
)
core_work.append((start_tile_id, num_tiles_this_core))
start_tile_id += num_tiles_this_core
Copy link
Contributor

Choose a reason for hiding this comment

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

After #67 goes in this will be available in our repo with no dependencies

Copy link
Contributor

@zoecarver zoecarver left a comment

Choose a reason for hiding this comment

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

Do we have some simulator documentation? Might be nice to document the new execution modes outside of the code. This looks good to me!

@ttl.compute()
def mm_compute():
# Compute each output tile (m, n).
for m in range(Mt):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit unused args

b_block = b_cb.wait() # blocking

if k == 0:
# Initialize output tile
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't need initialization/first iteration logic here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See below

b_block = b_cb.wait() # blocking

if k == 0:
# Initialize output tile.
Copy link
Contributor

Choose a reason for hiding this comment

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

same thing, shouldn't need first iteration logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This turns out to be a rather involved change and I'd prefer to fix it in another PR. In the meantime I've created an issue for this:

#151

@FConstantinos
Copy link
Contributor Author

Do we have some simulator documentation? Might be nice to document the new execution modes outside of the code. This looks good to me!

I've created a new ticket for that:

#152

@FConstantinos FConstantinos merged commit f86a4ce into main Dec 19, 2025
5 checks passed
@FConstantinos FConstantinos deleted the kostas/AST branch December 19, 2025 23:04
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.

4 participants