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

Simplify stream set access; better naming of access functions

Location:
icGREP/icgrep-devel/icgrep/editd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/editd/editd_cpu_kernel.cpp

    r5297 r5317  
    3030
    3131    Value * pattStartPtr = getScalarField("pattStream");
    32     Value * stideCarryArr = getScalarField("srideCarry");
     32    Value * strideCarryArr = getScalarField("strideCarry");
    3333
    3434    unsigned carryIdx = 0;
     
    4141    Value * pattCh = iBuilder->CreateLoad(pattPtr);
    4242    Value * pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    43     Value * pattStreamPtr = getInputStream("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    44     Value * pattStream = iBuilder->CreateLoad(pattStreamPtr);
     43    Value * pattStream = loadInputStreamBlock("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    4544    pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
    4645
     
    5453        pattCh = iBuilder->CreateLoad(pattPtr);
    5554        pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    56         pattStreamPtr = getInputStream("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    57         pattStream = iBuilder->CreateLoad(pattStreamPtr);
     55        Value * pattStream = loadInputStreamBlock("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    5856
    59         bitblock_advance_ci_co(e[i-1][0], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, 0);
     57        bitblock_advance_ci_co(e[i-1][0], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, 0);
    6058        e[i][0] = iBuilder->CreateAnd(adv[i-1][0], pattStream);
    6159        for(unsigned j = 1; j<= mEditDistance; j++){
    62             bitblock_advance_ci_co(e[i-1][j], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, j);
    63             bitblock_advance_ci_co(e[i-1][j-1], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, j-1);
    64             bitblock_advance_ci_co(e[i][j-1], 1, stideCarryArr, carryIdx++, adv, calculated, i, j-1);
     60            bitblock_advance_ci_co(e[i-1][j], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, j);
     61            bitblock_advance_ci_co(e[i-1][j-1], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, j-1);
     62            bitblock_advance_ci_co(e[i][j-1], 1, strideCarryArr, carryIdx++, adv, calculated, i, j-1);
    6563            Value * tmp1 = iBuilder->CreateAnd(adv[i-1][j], pattStream);
    6664            Value * tmp2 = iBuilder->CreateAnd(adv[i-1][j-1], iBuilder->CreateNot(pattStream));
     
    7270    }
    7371   
    74     Value * ptr = getOutputStream("ResultStream", iBuilder->getInt32(0));
    75     iBuilder->CreateStore(e[mPatternLen - 1][0], ptr);
     72    storeOutputStreamBlock("ResultStream", iBuilder->getInt32(0), e[mPatternLen-1][0]);
    7673    for(unsigned j = 1; j<= mEditDistance; j++){
    77         ptr = getOutputStream("ResultStream", iBuilder->getInt32(j));
    78         iBuilder->CreateStore(iBuilder->CreateAnd(e[mPatternLen-1][j], iBuilder->CreateNot(e[mPatternLen-1][j-1])), ptr);
     74        storeOutputStreamBlock("ResultStream", iBuilder->getInt32(j), iBuilder->CreateAnd(e[mPatternLen-1][j], iBuilder->CreateNot(e[mPatternLen-1][j-1])));
    7975    }
    8076       
     
    9389             {Binding{b->getStreamSetTy(dist + 1), "ResultStream"}},
    9490             {Binding{PointerType::get(b->getInt8Ty(), 1), "pattStream"},
    95              Binding{PointerType::get(ArrayType::get(b->getBitBlockType(), pattLen * (dist + 1) * 4), 0), "srideCarry"}},
     91             Binding{PointerType::get(ArrayType::get(b->getBitBlockType(), pattLen * (dist + 1) * 4), 0), "strideCarry"}},
    9692             {},
    9793             {Binding{b->getBitBlockType(), "EOFmask"}}),
  • icGREP/icgrep-devel/icgrep/editd/editd_gpu_kernel.cpp

    r5297 r5317  
    2929    Value * pattPos = iBuilder->getInt32(0);
    3030    Value * pattBuf = getScalarField("pattStream");
    31     Value * stideCarryArr = getScalarField("srideCarry");
     31    Value * strideCarryArr = getScalarField("strideCarry");
    3232   
    3333    unsigned carryIdx = 0;
     
    4444    Value * pattCh = iBuilder->CreateLoad(pattPtr);
    4545    Value * pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    46     Value * pattStreamPtr = getInputStream("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    47     Value * pattStream = iBuilder->CreateLoad(pattStreamPtr);
     46    Value * pattStream = loadInputStreamBlock("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    4847    pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
    4948
     
    5655        pattCh = iBuilder->CreateLoad(pattPtr);
    5756        pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    58         pattStreamPtr = getInputStream("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
    59         pattStream = iBuilder->CreateLoad(pattStreamPtr);
    60         bitblock_advance_ci_co(iBuilder, e[i-1][0], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, 0);
     57        pattStream = loadInputStreamBlock("CCStream", iBuilder->CreateZExt(pattIdx, int32ty));
     58        bitblock_advance_ci_co(iBuilder, e[i-1][0], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, 0);
    6159        e[i][0] = iBuilder->CreateAnd(adv[i-1][0], pattStream);
    6260        for(unsigned j = 1; j<= mEditDistance; j++){
    63             bitblock_advance_ci_co(iBuilder, e[i-1][j], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, j);
    64             bitblock_advance_ci_co(iBuilder, e[i-1][j-1], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, j-1);
    65             bitblock_advance_ci_co(iBuilder, e[i][j-1], 1, stideCarryArr, carryIdx++, adv, calculated, i, j-1);
     61            bitblock_advance_ci_co(iBuilder, e[i-1][j], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, j);
     62            bitblock_advance_ci_co(iBuilder, e[i-1][j-1], 1, strideCarryArr, carryIdx++, adv, calculated, i-1, j-1);
     63            bitblock_advance_ci_co(iBuilder, e[i][j-1], 1, strideCarryArr, carryIdx++, adv, calculated, i, j-1);
    6664            Value * tmp1 = iBuilder->CreateAnd(adv[i-1][j], pattStream);
    6765            Value * tmp2 = iBuilder->CreateAnd(adv[i-1][j-1], iBuilder->CreateNot(pattStream));
     
    7169        pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
    7270    }
    73     Value * ptr = getOutputStream("ResultStream", iBuilder->getInt32(0));
    74     iBuilder->CreateStore(e[mPatternLen-1][0], ptr);
     71    storeOutputStreamBlock("ResultStream", iBuilder->getInt32(0), e[mPatternLen-1][0]);
    7572    for(unsigned j = 1; j<= mEditDistance; j++){
    76         ptr = getOutputStream("ResultStream", iBuilder->getInt32(j));
    77         iBuilder->CreateStore(iBuilder->CreateAnd(e[mPatternLen - 1][j], iBuilder->CreateNot(e[mPatternLen - 1][j - 1])), ptr);
     73        storeOutputStreamBlock("ResultStream", iBuilder->getInt32(j), iBuilder->CreateAnd(e[mPatternLen - 1][j], iBuilder->CreateNot(e[mPatternLen - 1][j - 1])));
    7874    }
    7975}
     
    8985              {Binding{b->getStreamSetTy(dist + 1), "ResultStream"}},
    9086              {Binding{PointerType::get(b->getInt8Ty(), 1), "pattStream"},
    91               Binding{PointerType::get(ArrayType::get(b->getBitBlockType(), pattLen * (dist + 1) * 4), 0), "srideCarry"}},
     87              Binding{PointerType::get(ArrayType::get(b->getBitBlockType(), pattLen * (dist + 1) * 4), 0), "strideCarry"}},
    9288              {},
    9389              {Binding{b->getBitBlockType(), "EOFmask"}})
  • icGREP/icgrep-devel/icgrep/editd/editdscan_kernel.cpp

    r5311 r5317  
    3131    std::vector<Value * > matchWordVectors;
    3232    for(unsigned d = 0; d <= mEditDistance; d++) {
    33         Value * ptr = getInputStream("matchResults", iBuilder->getInt32(d));
    34         Value * matches = iBuilder->CreateBlockAlignedLoad(ptr);
     33        Value * matches = loadInputStreamBlock("matchResults", iBuilder->getInt32(d));
    3534        matchWordVectors.push_back(iBuilder->CreateBitCast(matches, scanwordVectorType));
    3635    }
Note: See TracChangeset for help on using the changeset viewer.