Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 4689b59

Browse files
committed
Change how index 0 load is implemented
1 parent b4c38bb commit 4689b59

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

torchinductor/codegen/triton.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,11 @@ def mask_loads(self, mask):
704704
def load(self, name: str, index: sympy.Expr, upcast: bool = False):
705705
var = self.args.input(name)
706706
indirect_indexing = self.is_indirect_indexing(index)
707-
is_index_0 = index == 0
708-
index, mask = self.indexing(index)
709-
if is_index_0 and "tl.zeros" not in index:
710-
# Need dense_indexing when index == 0
711-
index = f"{index} + tl.zeros({self.dense_size_str()}, tl.int32)"
707+
if index == 0:
708+
# No need to use mask when loading a single element from index 0
709+
index, mask = "0", "None"
710+
else:
711+
index, mask = self.indexing(index)
712712

713713
if "rmask" in mask:
714714
# This eviction policy heuristic is untested.

0 commit comments

Comments
 (0)