Clearer code following code review.

This commit is contained in:
Frederic Bastien 2020-01-31 06:20:45 -08:00
parent 7f3d24f6b0
commit eacb0742a9

View File

@ -1956,12 +1956,10 @@ static void EmitTile(
IrArray::Index source_idx = tile_origin_index.AddOffsetToDim(
start_offset_x, KernelMappingScheme::DimX, b);
// True when we all threads will always completly unroll.
// True when all threads will always execute all instructions.
// So we do not need to emit condition.
bool always_full_unroll = false;
if (mapping_scheme.GetDimsInElems()[2] % tile_size_x == 0){
always_full_unroll = true;
}
bool always_full_tile =
mapping_scheme.GetDimsInElems()[2] % tile_size_x == 0;
ksl->For(
loop_name + "_y_in_tile",
@ -1977,7 +1975,7 @@ static void EmitTile(
constant(j * step_x), KernelMappingScheme::DimX, b);
// The if-statement below always evaluates to true for the blocks
// where the entire processed tile fits within the input buffer.
if (!always_full_unroll) {
if (!always_full_tile) {
ksl->If(loop_name + "_x_in_tile", b->CreateICmpULT(x_loc, tile_width),
[&] { emit_elem_function(source_idx_x, y_loc, x_loc, j); });
} else {