Skip to content

Commit 9adc2ae

Browse files
committed
Adds triton snippet to the comment.
1 parent 6f05d07 commit 9adc2ae

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/Analysis/MaskAnalysis.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ LogicalResult MaskState::minStateScalar(const MaskState &lhsState,
239239
// are either going to take the mask dimension or take nothing at all. To do
240240
// that we use a select on the scalar value with the mask dimension in the
241241
// true case and zero in the false case.
242+
//
243+
// Example:
244+
// def kernel(..., index: i32, ...):
245+
// ...
246+
// offs = tl.arange(0, 8)
247+
// mask = offs < 4
248+
// scalar = index < 4
249+
// ... = tl.load(some_ptr, mask=scalar & mask, other=0)
242250
auto &scalarState = lhsState.scalar ? lhsState : rhsState;
243251
auto &nonScalarState = lhsState.scalar ? rhsState : lhsState;
244252
for (uint32_t i = 0; i < nonScalarState.getRank(); i++) {

0 commit comments

Comments
 (0)