Ignore:
Timestamp:
Dec 19, 2016, 12:58:29 PM (3 years ago)
Author:
cameron
Message:

Distinguishing between StreamType? and StreamSetType?; fixing StreamSetBlock? pointer calculations

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5227 r5229  
    5959    }
    6060
     61    inline Type * getStreamTy(const unsigned FieldWidth = 1) {
     62        return getBuilder()->getStreamTy(FieldWidth);
     63    }
     64   
    6165    inline Type * getStreamSetTy(const unsigned NumElements = 1, const unsigned FieldWidth = 1) {
    6266        return getBuilder()->getStreamSetTy(NumElements, FieldWidth);
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.cpp

    r5227 r5229  
    118118    Value * hi_input[8];
    119119    for (unsigned j = 0; j < 8; ++j) {
    120         hi_input[j] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     120        hi_input[j] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(j)});
    121121    }
    122122    Value * hi_bytes[8];
     
    125125    Value * lo_input[8];
    126126    for (unsigned j = 0; j < 8; ++j) {
    127         lo_input[j] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(j+8)});
     127        lo_input[j] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(j+8)});
    128128    }
    129129    Value * lo_bytes[8];
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.cpp

    r5217 r5229  
    163163void s2pKernel::generateDoBlockLogic(Value * self, Value * blockNo) {
    164164
    165     Value * bytePtr = iBuilder->CreateMul(blockNo, ConstantInt::get(blockNo->getType(), 8));
    166     Value * byteStream = getStreamSetBlockPtr(self, "byteStream", bytePtr);
     165    Value * byteStream = getStreamSetBlockPtr(self, "byteStream", blockNo);
    167166    Value * basisBits = getStreamSetBlockPtr(self, "basisBits", blockNo);
    168167
    169168    Value * bytepack[8];
    170169    for (unsigned i = 0; i < 8; i++) {
    171         Value * ptr = iBuilder->CreateGEP(byteStream, {iBuilder->getInt32(0), iBuilder->getInt32(i)});
     170        Value * ptr = iBuilder->CreateGEP(byteStream, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(i)});
    172171        bytepack[i] = iBuilder->CreateBlockAlignedLoad(ptr);
    173172    }
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5217 r5229  
    6767    void setEndOfInput(Value * bufferStructPtr);
    6868   
     69    llvm::Type * resolveStreamTypes(llvm::Type * type) {
     70        if (auto ty = dyn_cast<ArrayType>(type)) {
     71            unsigned numElems = ty->getNumElements();
     72            auto elemTy = ty->getElementType();
     73            if (isa<IDISA::StreamType>(elemTy)) {
     74                return ArrayType::get(cast<IDISA::StreamType>(elemTy)->resolveType(iBuilder), numElems);
     75            }
     76        }
     77        else if (auto ty = dyn_cast<IDISA::StreamType>(type)) {
     78            return ty->resolveType(iBuilder);
     79        }
     80        return type;
     81    }
     82   
    6983protected:
    7084    StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, llvm::Type * type, unsigned blocks, unsigned AddressSpace = 0)
    7185    : mBufferKind(k)
    7286    , iBuilder(b)
    73     , mStreamSetType(isa<IDISA::StreamType>(type) ? cast<IDISA::StreamType>(type)->resolveType(b) : type)
     87    , mStreamSetType(resolveStreamTypes(type))
    7488    , mBufferBlocks(blocks)
    7589    , mAddrSpace(AddressSpace)
Note: See TracChangeset for help on using the changeset viewer.