Skip to content

Conversation

@peterbell10
Copy link
Contributor

To make life simple, this assumes that expand_dims(x, dim) has a SliceLayout with matching dimension as the outermost layout.

@gluon.jit
def broadcast_kernel():
layout: ttgl.constexpr = ttgl.BlockedLayout([1, 1], [2, 16], [4, 1], [1, 0])
a = ttgl.arange(0, 16, layout=ttgl.SliceLayout(0, layout))[None, :]
Copy link
Collaborator

Choose a reason for hiding this comment

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

😍

Comment on lines 45 to 46
assert isinstance(layout, SliceLayout)
assert layout.dim == axis
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind adding some error messages here? In particular, the error message printing the invalid value I find is super helpful because often it's hard to tell by looking at the kernel code (it's like writing C++ but everything is auto)

@peterbell10 peterbell10 force-pushed the pb/gluon-interface branch from 5ef25d3 to 48fbbe9 Compare June 6, 2025 00:20
Base automatically changed from pb/gluon-interface to main June 6, 2025 01:54
@peterbell10 peterbell10 force-pushed the pb/gluon-broadcast branch from 16f7d0e to 4c836a3 Compare June 6, 2025 02:06
@peterbell10 peterbell10 force-pushed the pb/gluon-broadcast branch from 4c836a3 to 02f3999 Compare June 6, 2025 02:11
@peterbell10 peterbell10 marked this pull request as ready for review June 6, 2025 02:12
@peterbell10 peterbell10 requested a review from ptillet as a code owner June 6, 2025 02:12
Copy link
Collaborator

@ThomasRaoux ThomasRaoux left a comment

Choose a reason for hiding this comment

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

Nice!

@peterbell10 peterbell10 enabled auto-merge (squash) June 6, 2025 02:45
@peterbell10 peterbell10 merged commit b3209f1 into main Jun 6, 2025
8 checks passed
@peterbell10 peterbell10 deleted the pb/gluon-broadcast branch June 6, 2025 03:05
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