Ignore:
Timestamp:
Feb 3, 2017, 1:25:53 PM (3 years ago)
Author:
nmedfort
Message:

Partial removal of BlockNo?

File:
1 edited

Legend:

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

    r5292 r5297  
    4040}
    4141               
    42 void P2SKernel::generateDoBlockMethod(llvm::Value * blockNo) {
     42void P2SKernel::generateDoBlockMethod() {
    4343    Value * p_bitblock[8];
    4444    for (unsigned i = 0; i < 8; i++) {
    45         Value * ptr = getStream("basisBits", blockNo, iBuilder->getInt32(i));
     45        Value * ptr = getInputStream("basisBits", iBuilder->getInt32(i));
    4646        p_bitblock[i] = iBuilder->CreateBlockAlignedLoad(ptr);
    4747    }
     
    4949    p2s(iBuilder, p_bitblock, s_bytepack);
    5050    for (unsigned j = 0; j < 8; ++j) {
    51         Value * ptr = getStream("byteStream", blockNo, iBuilder->getInt32(0), iBuilder->getInt32(j));
     51        Value * ptr = getOutputStream("byteStream", iBuilder->getInt32(0), iBuilder->getInt32(j));
    5252        iBuilder->CreateBlockAlignedStore(s_bytepack[j], ptr);
    5353    }
     
    6363   
    6464
    65 void P2SKernelWithCompressedOutput::generateDoBlockMethod(llvm::Value * blockNo) {
     65void P2SKernelWithCompressedOutput::generateDoBlockMethod() {
    6666    PointerType * i8PtrTy = iBuilder->getInt8PtrTy();
    6767    IntegerType * i32 = iBuilder->getInt32Ty();
     
    7070    Value * basisBits[8];
    7171    for (unsigned i = 0; i < 8; i++) {
    72         Value * basisBitsBlock_ptr = getStream("basisBits", blockNo, iBuilder->getInt32(i));
     72        Value * basisBitsBlock_ptr = getInputStream("basisBits", iBuilder->getInt32(i));
    7373        basisBits[i] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr);
    7474    }
     
    7777
    7878    unsigned units_per_register = iBuilder->getBitBlockWidth()/8;
    79     Value * delCountBlock_ptr = getStream("deletionCounts", blockNo, iBuilder->getInt32(0));
     79    Value * delCountBlock_ptr = getInputStream("deletionCounts", iBuilder->getInt32(0));
    8080    Value * unit_counts = iBuilder->fwCast(units_per_register, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr));
    8181
    8282    Value * unitsGenerated = getProducedItemCount("byteStream"); // units generated to buffer
    83     Value * output_ptr = getStreamView(i8PtrTy, "byteStream", blockNo, iBuilder->getInt32(0));
     83    Value * output_ptr = getStreamView(i8PtrTy, "byteStream", getBlockNo(), iBuilder->getInt32(0));
    8484    Value * offset = iBuilder->getInt32(0);
    8585    for (unsigned j = 0; j < 8; ++j) {
    86         iBuilder->CreateAlignedStore(bytePack[j], iBuilder->CreateBitCast(iBuilder->CreateGEP(output_ptr, offset), bitBlockPtrTy), 1);
     86        iBuilder->CreateStore(bytePack[j], iBuilder->CreateBitCast(iBuilder->CreateGEP(output_ptr, offset), bitBlockPtrTy));
    8787        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(j)), i32);
    8888    }
     
    101101   
    102102
    103 void P2S16Kernel::generateDoBlockMethod(Value * blockNo) {
     103void P2S16Kernel::generateDoBlockMethod() {
    104104    Value * hi_input[8];
    105105    for (unsigned j = 0; j < 8; ++j) {
    106         Value * ptr = getStream("basisBits", blockNo, iBuilder->getInt32(0), iBuilder->getInt32(j));
     106        Value * ptr = getInputStream("basisBits", iBuilder->getInt32(0), iBuilder->getInt32(j));
    107107        hi_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
    108108    }
     
    111111    Value * lo_input[8];
    112112    for (unsigned j = 0; j < 8; ++j) {
    113         Value * ptr = getStream("basisBits", blockNo, iBuilder->getInt32(0), iBuilder->getInt32(j + 8));
     113        Value * ptr = getInputStream("basisBits", iBuilder->getInt32(0), iBuilder->getInt32(j + 8));
    114114        lo_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
    115115    }
     
    119119        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    120120        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    121         Value * ptr0 = getStream("i16Stream", blockNo, iBuilder->getInt32(2 * j));
     121        Value * ptr0 = getOutputStream("i16Stream", iBuilder->getInt32(2 * j));
    122122        iBuilder->CreateBlockAlignedStore(merge0, ptr0);
    123         Value * ptr1 = getStream("i16Stream", blockNo, iBuilder->getInt32(2 * j + 1));
     123        Value * ptr1 = getOutputStream("i16Stream", iBuilder->getInt32(2 * j + 1));
    124124        iBuilder->CreateBlockAlignedStore(merge1, ptr1);
    125125    }
     
    136136
    137137   
    138 void P2S16KernelWithCompressedOutput::generateDoBlockMethod(Value * blockNo) {
     138void P2S16KernelWithCompressedOutput::generateDoBlockMethod() {
    139139    IntegerType * i32Ty = iBuilder->getInt32Ty();
    140140    PointerType * bitBlockPtrTy = iBuilder->getBitBlockType()->getPointerTo();
     141
    141142    Value * hi_input[8];
    142143    for (unsigned j = 0; j < 8; ++j) {
    143         Value * ptr = getStream("basisBits", blockNo, iBuilder->getInt32(j));
     144        Value * ptr = getInputStream("basisBits", iBuilder->getInt32(j));
    144145        hi_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
    145146    }
    146147    Value * hi_bytes[8];
    147148    p2s(iBuilder, hi_input, hi_bytes);
     149
    148150    Value * lo_input[8];
    149151    for (unsigned j = 0; j < 8; ++j) {
    150         Value * ptr = getStream("basisBits", blockNo, iBuilder->getInt32(j + 8));
     152        Value * ptr = getInputStream("basisBits", iBuilder->getInt32(j + 8));
    151153        lo_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
    152154    }
    153155    Value * lo_bytes[8];
    154156    p2s(iBuilder, lo_input, lo_bytes);
    155     Value * delCountBlock_ptr = getStream("deletionCounts", blockNo, iBuilder->getInt32(0));
     157
     158    Value * delCountBlock_ptr = getInputStream("deletionCounts", iBuilder->getInt32(0));
    156159    Value * unit_counts = iBuilder->fwCast(iBuilder->getBitBlockWidth() / 16, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr));
    157160    PointerType * int16PtrTy = PointerType::get(iBuilder->getInt16Ty(), 0);
     161
    158162    ConstantInt * stride = iBuilder->getSize(iBuilder->getStride());
    159163    Value * i16UnitsGenerated = getProducedItemCount("i16Stream"); // units generated to buffer
    160164    Value * i16BlockNo = iBuilder->CreateUDiv(i16UnitsGenerated, stride);
    161165    Value * u16_output_ptr = getStreamView(int16PtrTy, "i16Stream", i16BlockNo, iBuilder->CreateURem(i16UnitsGenerated, stride));
     166
    162167    Value * offset = ConstantInt::get(i32Ty, 0);
     168
    163169    for (unsigned j = 0; j < 8; ++j) {
    164170        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    165         Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    166171        iBuilder->CreateAlignedStore(merge0, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    167172        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j)), i32Ty);
     173
     174        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    168175        iBuilder->CreateAlignedStore(merge1, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    169176        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j + 1)), i32Ty);
Note: See TracChangeset for help on using the changeset viewer.