Skip to content

Commit 0d8ce94

Browse files
authored
[BACKEND] Not to use the block io for accessing memory if the pitch is smaller than 64 bytes. (#4575)
Not to use the block io for accessing memory if the pitch is smaller than 64 bytes. Signed-off-by: Lu,Chengjun <[email protected]>
1 parent cd73baf commit 0d8ce94

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

third_party/intel/lib/TritonIntelGPUToLLVM/LoadStoreOpToLLVM.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,16 @@ struct BlockIOConversionBase : public LoadStoreConversionBase {
354354
constexpr int MIN_PITCH = 64;
355355
if (stride == 0)
356356
return b.i32_val(MIN_PITCH);
357-
else if (stride != -1)
358-
return b.i32_val(stride * elemSizeInBits / 8);
357+
else if (stride > 0) {
358+
// Only support stride > 0 for 2d block io.
359+
unsigned pitch = (unsigned)stride * elemSizeInBits / 8;
360+
if (pitch < MIN_PITCH)
361+
return nullptr; // return null for unsupported pitch.
362+
else
363+
return b.i32_val(pitch);
364+
} else if (stride < 0) {
365+
assert(stride == -1 && "invalid stride < 0");
366+
}
359367

360368
// ptrs[{0, 0}] and ptrs[{1, 0}] are currently used to calculate the
361369
// pitch.

0 commit comments

Comments
 (0)