Clarify stream kernel bounds assumptions

This commit is contained in:
Marek Lemańczyk committed 2025-10-22 21:41:51 +02:00
1 parent 586eb8d303
commit ea0770a84a
1 file changed
+20 -14
@@ -87,11 +87,13 @@ internal static class DivisorByDivisorKernels
byte modulus)
{
int globalIndex = index;
int length = (int)remainders.Length;
if (globalIndex >= length)
{
return;
}
// EvenPerfectBitScanner launches this stream kernel with an extent matching the remainder span length,
// so the defensive guard stays commented out to keep the kernel branch-free.
// int length = (int)remainders.Length;
// if (globalIndex >= length)
// {
// return;
// }
int localIndex = Group.IdxX;
int groupSize = Group.Dimension.X;
@@ -136,11 +138,13 @@ internal static class DivisorByDivisorKernels
ArrayView<byte> mask)
{
int globalIndex = index;
int length = (int)mask.Length;
if (globalIndex >= length)
{
return;
}
// EvenPerfectBitScanner launches this auto-grouped kernel with an extent matching the mask length,
// so the defensive guard stays commented out to keep the kernel branch-free.
// int length = (int)mask.Length;
// if (globalIndex >= length)
// {
// return;
// }
byte value10 = remainder10[globalIndex];
bool lastIsSeven = lastIsSevenFlag != 0;
@@ -164,10 +168,12 @@ internal static class DivisorByDivisorKernels
{
int globalIndex = index;
int length = (int)mask.Length;
if (globalIndex >= length)
{
return;
}
// EvenPerfectBitScanner launches this stream kernel with an extent matching the mask length,
// so the defensive guard stays commented out to keep the kernel branch-free.
// if (globalIndex >= length)
// {
// return;
// }
int localIndex = Group.IdxX;
int groupSize = Group.Dimension.X;