Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

File:
1 edited

Legend:

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

    r5335 r5435  
    1212namespace kernel {
    1313
    14 SwizzleGenerator::SwizzleGenerator(IDISA::IDISA_Builder * iBuilder, unsigned bitStreamCount, unsigned outputSets, unsigned inputSets, unsigned fieldWidth)
    15     : BlockOrientedKernel(iBuilder, "swizzle" + std::to_string(fieldWidth) + ":" + std::to_string(bitStreamCount), {}, {}, {}, {}, {})
    16     , mBitStreamCount(bitStreamCount)
    17     , mFieldWidth(fieldWidth)
    18     , mSwizzleFactor(iBuilder->getBitBlockWidth() / fieldWidth)
    19     , mInputSets(inputSets)
    20     , mOutputSets(outputSets) {
    21         assert((fieldWidth > 0) && ((fieldWidth & (fieldWidth - 1)) == 0) && "fieldWidth must be a power of 2");
    22         assert(fieldWidth < iBuilder->getBitBlockWidth() && "fieldWidth must be less than the block width");
    23         assert(mSwizzleFactor > 1 && "fieldWidth must be less than the block width");
    24         unsigned inputStreamsPerSet = (bitStreamCount + inputSets - 1)/inputSets;
    25         unsigned outputStreamsPerSet = (bitStreamCount + outputSets - 1)/outputSets;
    26         // Maybe the following is unnecessary.
    27         //assert(inputStreamsPerSet % swizzleFactor == 0 && "input sets must be an exact multiple of the swizzle factor");
    28         assert(outputStreamsPerSet % mSwizzleFactor == 0 && "output sets must be an exact multiple of the swizzle factor");
    29         for (unsigned i = 0; i < mInputSets; i++) {
    30             mStreamSetInputs.push_back(Binding{iBuilder->getStreamSetTy(inputStreamsPerSet, 1), "inputGroup" + std::to_string(i)});
    31         }
    32         for (unsigned i = 0; i < mOutputSets; i++) {
    33             mStreamSetOutputs.push_back(Binding{iBuilder->getStreamSetTy(outputStreamsPerSet, 1), "outputGroup" + std::to_string(i)});
    34         }
     14SwizzleGenerator::SwizzleGenerator(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder, unsigned bitStreamCount, unsigned outputSets, unsigned inputSets, unsigned fieldWidth)
     15: BlockOrientedKernel("swizzle" + std::to_string(fieldWidth) + ":" + std::to_string(bitStreamCount), {}, {}, {}, {}, {})
     16, mBitStreamCount(bitStreamCount)
     17, mFieldWidth(fieldWidth)
     18, mSwizzleFactor(iBuilder->getBitBlockWidth() / fieldWidth)
     19, mInputSets(inputSets)
     20, mOutputSets(outputSets) {
     21    assert((fieldWidth > 0) && ((fieldWidth & (fieldWidth - 1)) == 0) && "fieldWidth must be a power of 2");
     22    assert(fieldWidth < iBuilder->getBitBlockWidth() && "fieldWidth must be less than the block width");
     23    assert(mSwizzleFactor > 1 && "fieldWidth must be less than the block width");
     24    unsigned inputStreamsPerSet = (bitStreamCount + inputSets - 1)/inputSets;
     25    unsigned outputStreamsPerSet = (bitStreamCount + outputSets - 1)/outputSets;
     26    // Maybe the following is unnecessary.
     27    //assert(inputStreamsPerSet % swizzleFactor == 0 && "input sets must be an exact multiple of the swizzle factor");
     28    assert(outputStreamsPerSet % mSwizzleFactor == 0 && "output sets must be an exact multiple of the swizzle factor");
     29    for (unsigned i = 0; i < mInputSets; i++) {
     30        mStreamSetInputs.push_back(Binding{iBuilder->getStreamSetTy(inputStreamsPerSet, 1), "inputGroup" + std::to_string(i)});
    3531    }
     32    for (unsigned i = 0; i < mOutputSets; i++) {
     33        mStreamSetOutputs.push_back(Binding{iBuilder->getStreamSetTy(outputStreamsPerSet, 1), "outputGroup" + std::to_string(i)});
     34    }
     35}
    3636
    3737void SwizzleGenerator::generateDoBlockMethod() {
Note: See TracChangeset for help on using the changeset viewer.