Ignore:
Timestamp:
Feb 7, 2017, 3:23:42 PM (3 years ago)
Author:
nmedfort
Message:

Continued work on eliminating BlockNo?

File:
1 edited

Legend:

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

    r5297 r5307  
    2020//
    2121// Using aligned SIMD loads, an inner loop processes three registers full of input
    22 // data (i.e., three BytePacks) to produce four registers full of output.   This is 
     22// data (i.e., three BytePacks) to produce four registers full of output.   This is
    2323// a 3 step process.
    2424// Step 1:  Load input_pack0, apply the shuffle operation to produce output_pack0.
     
    3838// with the input data completely processed for each tripleBlock.
    3939//
    40 // The pipeline must guarantee that the doSegment method is called with the 
     40// The pipeline must guarantee that the doSegment method is called with the
    4141// a continous buffer for the full segment (number of blocks).
    4242
     
    376376}
    377377
     378//// Special processing for the base 64 format.   The output must always contain a multiple
     379//// of 4 bytes.   When the number of radix 64 values is not a multiple of 4
     380//// number of radix 64 values
     381//void base64Kernel::generateFinalBlockMethod(Value * remainingBytes) {
     382
     383//    BasicBlock * entry = iBuilder->GetInsertBlock();
     384//    BasicBlock * base64_loop = CreateBasicBlock("base64_loop");
     385//    BasicBlock * loopExit = CreateBasicBlock("loopExit");
     386//    BasicBlock * doPadding = CreateBasicBlock("doPadding");
     387//    BasicBlock * doPadding2 = CreateBasicBlock("doPadding2");
     388//    BasicBlock * fbExit = CreateBasicBlock("fbExit");
     389
     390//    Value * remainMod4 = iBuilder->CreateAnd(remainingBytes, iBuilder->getSize(3));
     391//    Value * padBytes = iBuilder->CreateSub(iBuilder->getSize(4), remainMod4);
     392//    padBytes = iBuilder->CreateAnd(padBytes, iBuilder->getSize(3));
     393
     394//    Constant * packSize = iBuilder->getSize(iBuilder->getStride() / 8);
     395
     396//    // Enter the loop only if there is at least one byte remaining to process.
     397//    iBuilder->CreateCondBr(iBuilder->CreateICmpEQ(remainingBytes, iBuilder->getSize(0)), fbExit, base64_loop);
     398
     399//    iBuilder->SetInsertPoint(base64_loop);
     400//    PHINode * idx = iBuilder->CreatePHI(iBuilder->getInt32Ty(), 2);
     401//    PHINode * loopRemain = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
     402//    idx->addIncoming(ConstantInt::getNullValue(iBuilder->getInt32Ty()), entry);
     403//    loopRemain->addIncoming(remainingBytes, entry);
     404//    Value * radix64streamPtr = getInputStream("radix64stream", iBuilder->getInt32(0), idx);
     405//    Value * bytepack = iBuilder->CreateBlockAlignedLoad(radix64streamPtr);
     406//    Value * base64pack = processPackData(bytepack);
     407//    Value * base64streamPtr = getOutputStream("base64stream", iBuilder->getInt32(0), idx);
     408
     409//    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(base64pack), base64streamPtr);
     410//    idx->addIncoming(iBuilder->CreateAdd(idx, ConstantInt::get(iBuilder->getInt32Ty(), 1)), base64_loop);
     411//    Value* remainAfterLoop = iBuilder->CreateSub(loopRemain, packSize);
     412//    loopRemain->addIncoming(remainAfterLoop, base64_loop);
     413
     414//    Value* continueLoop = iBuilder->CreateICmpSGT(remainAfterLoop, iBuilder->getSize(0));
     415//    iBuilder->CreateCondBr(continueLoop, base64_loop, loopExit);
     416
     417//    iBuilder->SetInsertPoint(loopExit);
     418//    iBuilder->CreateCondBr(iBuilder->CreateICmpEQ(padBytes, iBuilder->getSize(0)), fbExit, doPadding);
     419
     420//    iBuilder->SetInsertPoint(doPadding);
     421
     422//    base64streamPtr = getOutputStream("base64stream", iBuilder->getInt32(0), idx);
     423//    Value * i8streamPtr = iBuilder->CreatePointerCast(base64streamPtr, iBuilder->getInt8PtrTy());
     424//    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8streamPtr, remainingBytes));
     425//    iBuilder->CreateCondBr(iBuilder->CreateICmpEQ(remainMod4, iBuilder->getSize(3)), fbExit, doPadding2);
     426//    iBuilder->SetInsertPoint(doPadding2);
     427//    Value * finalPadPos = iBuilder->CreateAdd(remainingBytes, iBuilder->getSize(1));
     428//    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8streamPtr, finalPadPos));
     429//    iBuilder->CreateBr(fbExit);
     430//    iBuilder->SetInsertPoint(fbExit);
     431//    Value * produced = iBuilder->CreateAdd(getProducedItemCount("base64stream"), iBuilder->CreateAdd(remainingBytes, padBytes));
     432//    setProducedItemCount("base64stream", produced);
     433//}
     434
    378435// Special processing for the base 64 format.   The output must always contain a multiple
    379436// of 4 bytes.   When the number of radix 64 values is not a multiple of 4
     
    418475
    419476    iBuilder->SetInsertPoint(doPadding);
    420     Value * i8output_ptr = getStreamView(iBuilder->getInt8PtrTy(), "base64stream", getBlockNo(), iBuilder->getInt32(0));
     477    Value * i8output_ptr = getOutputStream("base64stream", iBuilder->getInt32(0));
     478    i8output_ptr = iBuilder->CreatePointerCast(i8output_ptr, iBuilder->getInt8PtrTy());
    421479    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, remainingBytes));
    422480    iBuilder->CreateCondBr(iBuilder->CreateICmpEQ(remainMod4, iBuilder->getSize(3)), fbExit, doPadding2);
Note: See TracChangeset for help on using the changeset viewer.