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/radix64.cpp

    r5311 r5317  
    100100
    101101    // A block is made up of 8 packs.  Get the pointer to the first pack (changes the type of the pointer only).
    102     Value * sourcePackPtr = getInputStream("sourceStream", iBuilder->getInt32(0), iBuilder->getInt32(0));
    103     Value * outputPackPtr = getOutputStream("expandedStream", iBuilder->getInt32(0), iBuilder->getInt32(0));
     102    Value * sourcePackPtr = getInputStreamPackPtr("sourceStream", iBuilder->getInt32(0), iBuilder->getInt32(0));
     103    Value * outputPackPtr = getOutputStreamPackPtr("expandedStream", iBuilder->getInt32(0), iBuilder->getInt32(0));
    104104
    105105    Value * hasFullLoop = iBuilder->CreateICmpUGE(loopItemsToDo, triplePackSize);
     
    284284void radix64Kernel::generateDoBlockMethod() {
    285285    for (unsigned i = 0; i < 8; i++) {
    286         Value * expandedStream = getInputStream("expandedStream", iBuilder->getInt32(0), iBuilder->getInt32(i));
    287         Value * bytepack = iBuilder->CreateBlockAlignedLoad(expandedStream);
     286        Value * bytepack = loadInputStreamPack("expandedStream", iBuilder->getInt32(0), iBuilder->getInt32(i));
    288287        Value * radix64pack = processPackData(bytepack);
    289         Value * radix64stream = getOutputStream("radix64stream",iBuilder->getInt32(0), iBuilder->getInt32(i));
    290         iBuilder->CreateBlockAlignedStore(radix64pack, radix64stream);
     288        storeOutputStreamPack("radix64stream",iBuilder->getInt32(0), iBuilder->getInt32(i), radix64pack);
    291289    }
    292290    Value * produced = getProducedItemCount("radix64stream");
     
    316314    loopRemain->addIncoming(remainingBytes, entry);
    317315
    318     Value * expandedStreamLoopPtr = getInputStream("expandedStream", iBuilder->getInt32(0), idx);
    319     Value * bytepack = iBuilder->CreateBlockAlignedLoad(expandedStreamLoopPtr);
     316    Value * bytepack = loadInputStreamPack("expandedStream", iBuilder->getInt32(0), idx);
    320317    Value * radix64pack = processPackData(bytepack);
    321 
    322     Value * radix64streamPtr = getOutputStream("radix64stream", iBuilder->getInt32(0), idx);
    323     iBuilder->CreateBlockAlignedStore(radix64pack, radix64streamPtr);
     318    storeOutputStreamPack("radix64stream", iBuilder->getInt32(0), idx, radix64pack);
    324319
    325320    Value* nextIdx = iBuilder->CreateAdd(idx, ConstantInt::get(iBuilder->getInt32Ty(), 1));
     
    357352    Value * t0_61 = iBuilder->simd_sub(8, t0_51, iBuilder->simd_and(mask_gt_51, iBuilder->simd_fill(8, iBuilder->getInt8(75))));
    358353    Value * t0_62 = iBuilder->simd_sub(8, t0_61, iBuilder->simd_and(mask_eq_62, iBuilder->simd_fill(8, iBuilder->getInt8(15))));
    359     return iBuilder->simd_sub(8, t0_62, iBuilder->simd_and(mask_eq_63, iBuilder->simd_fill(8, iBuilder->getInt8(12))));
     354    return iBuilder->bitCast(iBuilder->simd_sub(8, t0_62, iBuilder->simd_and(mask_eq_63, iBuilder->simd_fill(8, iBuilder->getInt8(12)))));
    360355}
    361356
    362357void base64Kernel::generateDoBlockMethod() {
    363358    for (unsigned i = 0; i < 8; i++) {
    364         Value * radix64stream_ptr = getInputStream("radix64stream", iBuilder->getInt32(0), iBuilder->getInt32(i));
    365         Value * bytepack = iBuilder->CreateBlockAlignedLoad(radix64stream_ptr);
    366         Value* base64pack = processPackData(bytepack);
    367         Value * base64stream_ptr = getOutputStream("base64stream", iBuilder->getInt32(0), iBuilder->getInt32(i));
    368         iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(base64pack), base64stream_ptr);
     359        Value * bytepack = loadInputStreamPack("radix64stream", iBuilder->getInt32(0), iBuilder->getInt32(i));
     360        Value * base64pack = processPackData(bytepack);
     361        storeOutputStreamPack("base64stream", iBuilder->getInt32(0), iBuilder->getInt32(i), base64pack);
    369362    }
    370363    Value * produced = getProducedItemCount("base64stream");
     
    456449    idx->addIncoming(ConstantInt::getNullValue(iBuilder->getInt32Ty()), entry);
    457450    loopRemain->addIncoming(remainingBytes, entry);
    458     Value * radix64streamPtr = getInputStream("radix64stream", iBuilder->getInt32(0), idx);
    459     Value * bytepack = iBuilder->CreateBlockAlignedLoad(radix64streamPtr);
     451    Value * bytepack = loadInputStreamPack("radix64stream", iBuilder->getInt32(0), idx);
    460452    Value * base64pack = processPackData(bytepack);
    461     Value * base64streamPtr = getOutputStream("base64stream", iBuilder->getInt32(0), idx);
    462     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(base64pack), base64streamPtr);
     453    storeOutputStreamPack("base64stream", iBuilder->getInt32(0), idx, base64pack);
    463454    idx->addIncoming(iBuilder->CreateAdd(idx, ConstantInt::get(iBuilder->getInt32Ty(), 1)), base64_loop);
    464455    Value* remainAfterLoop = iBuilder->CreateSub(loopRemain, packSize);
     
    472463
    473464    iBuilder->SetInsertPoint(doPadding);
    474     Value * i8output_ptr = getOutputStream("base64stream", iBuilder->getInt32(0));
     465    Value * i8output_ptr = getOutputStreamBlockPtr("base64stream", iBuilder->getInt32(0));
    475466    i8output_ptr = iBuilder->CreatePointerCast(i8output_ptr, iBuilder->getInt8PtrTy());
    476467    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, remainingBytes));
Note: See TracChangeset for help on using the changeset viewer.