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

    r5310 r5317  
    4444    Value * p_bitblock[8];
    4545    for (unsigned i = 0; i < 8; i++) {
    46         Value * ptr = getInputStream("basisBits", iBuilder->getInt32(i));
    47         p_bitblock[i] = iBuilder->CreateBlockAlignedLoad(ptr);
     46        p_bitblock[i] = loadInputStreamBlock("basisBits", iBuilder->getInt32(i));
    4847    }
    4948    Value * s_bytepack[8];
    5049    p2s(iBuilder, p_bitblock, s_bytepack);
    5150    for (unsigned j = 0; j < 8; ++j) {
    52         Value * ptr = getOutputStream("byteStream", iBuilder->getInt32(0), iBuilder->getInt32(j));
    53         iBuilder->CreateBlockAlignedStore(s_bytepack[j], ptr);
     51        storeOutputStreamPack("byteStream", iBuilder->getInt32(0), iBuilder->getInt32(j), s_bytepack[j]);
    5452    }
    5553}
     
    7068    Value * basisBits[8];
    7169    for (unsigned i = 0; i < 8; i++) {
    72         Value * basisBitsBlock_ptr = getInputStream("basisBits", iBuilder->getInt32(i));
    73         basisBits[i] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr);
     70        basisBits[i] = loadInputStreamBlock("basisBits", iBuilder->getInt32(i));
    7471    }
    7572    Value * bytePack[8];
     
    7774
    7875    unsigned units_per_register = iBuilder->getBitBlockWidth()/8;
    79     Value * delCountBlock_ptr = getInputStream("deletionCounts", iBuilder->getInt32(0));
     76    Value * delCountBlock_ptr = getInputStreamBlockPtr("deletionCounts", iBuilder->getInt32(0));
    8077    Value * unit_counts = iBuilder->fwCast(units_per_register, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr));
    8178
    82     Value * output_ptr = getOutputStream("byteStream", iBuilder->getInt32(0));
     79    Value * output_ptr = getOutputStreamBlockPtr("byteStream", iBuilder->getInt32(0));
    8380    output_ptr = iBuilder->CreatePointerCast(output_ptr, iBuilder->getInt8PtrTy());
    8481    Value * offset = iBuilder->getInt32(0);
     
    106103    Value * hi_input[8];
    107104    for (unsigned j = 0; j < 8; ++j) {
    108         Value * ptr = getInputStream("basisBits", iBuilder->getInt32(0), iBuilder->getInt32(j));
    109         hi_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
     105        hi_input[j] = loadInputStreamBlock("basisBits", iBuilder->getInt32(j));
    110106    }
    111107    Value * hi_bytes[8];
     
    113109    Value * lo_input[8];
    114110    for (unsigned j = 0; j < 8; ++j) {
    115         Value * ptr = getInputStream("basisBits", iBuilder->getInt32(0), iBuilder->getInt32(j + 8));
    116         lo_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
     111        lo_input[j] = loadInputStreamBlock("basisBits", iBuilder->getInt32(j + 8));
    117112    }
    118113    Value * lo_bytes[8];
     
    121116        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    122117        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    123         Value * ptr0 = getOutputStream("i16Stream", iBuilder->getInt32(2 * j));
    124         iBuilder->CreateBlockAlignedStore(merge0, ptr0);
    125         Value * ptr1 = getOutputStream("i16Stream", iBuilder->getInt32(2 * j + 1));
    126         iBuilder->CreateBlockAlignedStore(merge1, ptr1);
     118        storeOutputStreamPack("i16Stream", iBuilder->getInt32(0), iBuilder->getInt32(2 * j), merge0);
     119        storeOutputStreamPack("i16Stream", iBuilder->getInt32(0), iBuilder->getInt32(2 * j + 1), merge1);
    127120    }
    128121}
     
    146139    Value * hi_input[8];
    147140    for (unsigned j = 0; j < 8; ++j) {
    148         Value * ptr = getInputStream("basisBits", iBuilder->getInt32(j));
    149         hi_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
     141        hi_input[j] = loadInputStreamBlock("basisBits", iBuilder->getInt32(j));
    150142    }
    151143    Value * hi_bytes[8];
     
    154146    Value * lo_input[8];
    155147    for (unsigned j = 0; j < 8; ++j) {
    156         Value * ptr = getInputStream("basisBits", iBuilder->getInt32(j + 8));
    157         lo_input[j] = iBuilder->CreateBlockAlignedLoad(ptr);
     148        lo_input[j] = loadInputStreamBlock("basisBits", iBuilder->getInt32(j + 8));
    158149    }
    159150    Value * lo_bytes[8];
    160151    p2s(iBuilder, lo_input, lo_bytes);
    161152
    162     Value * delCountBlock_ptr = getInputStream("deletionCounts", iBuilder->getInt32(0));
     153    Value * delCountBlock_ptr = getInputStreamBlockPtr("deletionCounts", iBuilder->getInt32(0));
    163154    Value * unit_counts = iBuilder->fwCast(iBuilder->getBitBlockWidth() / 16, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr));
    164155
    165156
    166     Value * u16_output_ptr = getOutputStream("i16Stream", iBuilder->getInt32(0));
     157    Value * u16_output_ptr = getOutputStreamBlockPtr("i16Stream", iBuilder->getInt32(0));
    167158    u16_output_ptr = iBuilder->CreatePointerCast(u16_output_ptr, int16PtrTy);
    168159    Value * i16UnitsGenerated = getProducedItemCount("i16Stream"); // units generated to buffer
Note: See TracChangeset for help on using the changeset viewer.