Ignore:
Timestamp:
Jan 14, 2017, 3:49:56 PM (2 years ago)
Author:
nmedfort
Message:

Changes working towards simplifying accessing stream elements + some modifications to simplify include / forward declarations within the CodeGen? library.

File:
1 edited

Legend:

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

    r5256 r5260  
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 */
    5 #include <kernels/stdout_kernel.h>
    6 #include <kernels/kernel.h>
     5#include "stdout_kernel.h"
     6#include <llvm/IR/Module.h>
    77#include <IR_Gen/idisa_builder.h>
     8
     9using namespace llvm;
    810
    911namespace kernel {
     
    5153   
    5254    Value * blockNo = getScalarField(self, blockNoScalar);
    53     //iBuilder->CallPrintInt("blockNo", blockNo);
    54     Value * basePtr = getStreamSetBlockPtr(self, "codeUnitBuffer", blockNo);
    55     //iBuilder->CallPrintInt("basePtr", iBuilder->CreatePtrToInt(basePtr, iBuilder->getInt64Ty()));
    5655    Value * byteOffset = iBuilder->CreateMul(iBuilder->CreateURem(processed, blockItems), itemBytes);
    57     Value * bytePtr = iBuilder->CreateGEP(iBuilder->CreateBitCast(basePtr, i8PtrTy), byteOffset);
    58 
     56    Value * bytePtr = getStreamView(i8PtrTy, self, "codeUnitBuffer", blockNo, byteOffset);
    5957    iBuilder->CreateWriteCall(iBuilder->getInt32(1), bytePtr, iBuilder->CreateMul(itemsToDo, itemBytes));
    6058
     
    7270    Module * m = iBuilder->getModule();
    7371    Function * finalBlockFunction = m->getFunction(mKernelName + finalBlock_suffix);
    74     Type * i8PtrTy = iBuilder->getInt8PtrTy();
    75    
     72    Type * i8PtrTy = iBuilder->getInt8PtrTy();   
    7673    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "fb_flush", finalBlockFunction, 0));
    7774    Constant * blockItems = iBuilder->getSize(iBuilder->getBitBlockWidth());
     
    8380    Value * itemsAvail = iBuilder->CreateSub(producerPos, processed);
    8481    Value * blockNo = getScalarField(self, blockNoScalar);
    85     Value * basePtr = getStreamSetBlockPtr(self, "codeUnitBuffer", blockNo);
    8682    Value * byteOffset = iBuilder->CreateMul(iBuilder->CreateURem(processed, blockItems), itemBytes);
    87     Value * bytePtr = iBuilder->CreateGEP(iBuilder->CreateBitCast(basePtr, i8PtrTy), byteOffset);
     83    Value * bytePtr = getStreamView(i8PtrTy, self, "codeUnitBuffer", blockNo, byteOffset);
    8884    iBuilder->CreateWriteCall(iBuilder->getInt32(1), bytePtr, iBuilder->CreateMul(itemsAvail, itemBytes));
    8985    setProcessedItemCount(self, "codeUnitBuffer", producerPos);
Note: See TracChangeset for help on using the changeset viewer.