Ignore:
Timestamp:
Feb 14, 2017, 12:45:42 PM (2 years ago)
Author:
cameron
Message:

Simplify stream set access; better naming of access functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/deletion.cpp

    r5313 r5317  
    5555
    5656void DeletionKernel::generateDoBlockMethod() {
    57     Value * delMaskPtr = getInputStream("delMaskSet", iBuilder->getInt32(0));
    58     Value * delMask = iBuilder->CreateBlockAlignedLoad(delMaskPtr);
     57    Value * delMask = loadInputStreamBlock("delMaskSet", iBuilder->getInt32(0));
    5958    const auto move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, delMask);
    6059    for (unsigned j = 0; j < mStreamCount; ++j) {
    61         Value * inputStreamPtr = getInputStream("inputStreamSet", iBuilder->getInt32(j));
    62         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr);
     60        Value * input = loadInputStreamBlock("inputStreamSet", iBuilder->getInt32(j));
    6361        Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, delMask, move_masks, input);
    64         Value * outputStreamPtr = getOutputStream("outputStreamSet", iBuilder->getInt32(j));
    65         iBuilder->CreateBlockAlignedStore(output, outputStreamPtr);
     62        storeOutputStreamBlock("outputStreamSet", iBuilder->getInt32(j), output);
    6663    }
    6764    Value * delCount = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(delMask));
    68     Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
    69     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
     65    storeOutputStreamBlock("deletionCounts", iBuilder->getInt32(0), iBuilder->bitCast(delCount));
    7066}
    7167
     
    7470    Value * remaining = iBuilder->CreateZExt(remainingBytes, vecTy);
    7571    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(vecTy), remaining));
    76     Value * const delmaskPtr = getInputStream("delMaskSet", iBuilder->getInt32(0));
    77     Value * delMask = iBuilder->CreateOr(EOF_del, iBuilder->CreateBlockAlignedLoad(delmaskPtr));
     72    Value * delMask = iBuilder->CreateOr(EOF_del, loadInputStreamBlock("delMaskSet", iBuilder->getInt32(0)));
    7873    const auto move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, delMask);
    7974    for (unsigned j = 0; j < mStreamCount; ++j) {
    80         Value * inputStreamPtr = getInputStream("inputStreamSet", iBuilder->getInt32(j));
    81         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr);
     75        Value * input = loadInputStreamBlock("inputStreamSet", iBuilder->getInt32(j));
    8276        Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, delMask, move_masks, input);
    83         Value * outputStreamPtr = getOutputStream("outputStreamSet", iBuilder->getInt32(j));
    84         iBuilder->CreateBlockAlignedStore(output, outputStreamPtr);
     77        storeOutputStreamBlock("outputStreamSet", iBuilder->getInt32(j), output);
    8578    }
    8679    Value * delCount = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(delMask));
    87     Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
    88     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
     80    storeOutputStreamBlock("deletionCounts", iBuilder->getInt32(0), iBuilder->bitCast(delCount));
    8981}
    9082
     
    132124
    133125void DeleteByPEXTkernel::generateDoBlockMethod() {
    134     Value * delMaskPtr = getInputStream("delMaskSet", iBuilder->getInt32(0));
    135     Value * delMask = iBuilder->CreateBlockAlignedLoad(delMaskPtr);
     126    Value * delMask = loadInputStreamBlock("delMaskSet", iBuilder->getInt32(0));
    136127    const auto masks = get_PEXT_masks(iBuilder, delMask);
    137128    for (unsigned j = 0; j < mStreamCount; ++j) {
    138         Value * inputStreamPtr = getInputStream("inputStreamSet", iBuilder->getInt32(j));
    139         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr);
     129        Value * input = loadInputStreamBlock("inputStreamSet", iBuilder->getInt32(j));
    140130        Value * output = apply_PEXT_deletion(iBuilder, masks, input);
    141         Value * outputStreamPtr = getOutputStream("outputStreamSet", iBuilder->getInt32(j));
    142         iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(output), outputStreamPtr);
     131        storeOutputStreamBlock("outputStreamSet", iBuilder->getInt32(j), output);
    143132    }
    144133    Value * delCount = partial_sum_popcount(iBuilder, mDelCountFieldWidth, apply_PEXT_deletion(iBuilder, masks, iBuilder->simd_not(delMask)));
    145     Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
    146     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
     134    storeOutputStreamBlock("deletionCounts", iBuilder->getInt32(0), iBuilder->bitCast(delCount));
    147135}
    148136
     
    151139    Value * remaining = iBuilder->CreateZExt(remainingBytes, vecTy);
    152140    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(vecTy), remaining));
    153     Value * const delmaskPtr = getInputStream("delMaskSet", iBuilder->getInt32(0));
    154     Value * delMask = iBuilder->CreateOr(EOF_del, iBuilder->CreateBlockAlignedLoad(delmaskPtr));
     141    Value * delMask = iBuilder->CreateOr(EOF_del, loadInputStreamBlock("delMaskSet", iBuilder->getInt32(0)));
    155142    const auto masks = get_PEXT_masks(iBuilder, delMask);
    156143    for (unsigned j = 0; j < mStreamCount; ++j) {
    157         Value * inputStreamPtr = getInputStream("inputStreamSet", iBuilder->getInt32(j));
    158         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr);
     144        Value * input = loadInputStreamBlock("inputStreamSet", iBuilder->getInt32(j));
    159145        Value * output = apply_PEXT_deletion(iBuilder, masks, input);
    160         Value * outputStreamPtr = getOutputStream("outputStreamSet", iBuilder->getInt32(j));
    161         iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(output), outputStreamPtr);
     146        storeOutputStreamBlock("outputStreamSet", iBuilder->getInt32(j), output);
    162147    }
    163148    Value * delCount = partial_sum_popcount(iBuilder, mDelCountFieldWidth, apply_PEXT_deletion(iBuilder, masks, iBuilder->simd_not(delMask)));
    164     Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
    165     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
     149    storeOutputStreamBlock("deletionCounts", iBuilder->getInt32(0), iBuilder->bitCast(delCount));
    166150}
    167151
Note: See TracChangeset for help on using the changeset viewer.