Changeset 5543 for icGREP/icgrep-devel


Ignore:
Timestamp:
Jul 2, 2017, 10:00:26 AM (2 years ago)
Author:
cameron
Message:

Ensure size of dynamic buffers is a multiple of cache line size

Location:
icGREP/icgrep-devel/icgrep
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.cpp

    r5541 r5543  
    7878}
    7979
    80 
     80Value * CBuilder::CreateRoundUp(Value * number, Value * divisor, const Twine &Name) {
     81    return CreateMul(CreateUDivCeil(number, divisor), divisor, Name);
     82}
    8183
    8284Value * CBuilder::CreateOpenCall(Value * filename, Value * oflag, Value * mode) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5541 r5543  
    5656    // Equivalent to CreateUDiv(CreateAdd(number, CreateSub(divisor, ConstantInt::get(divisor->getType(), 1))), divisor)
    5757    llvm::Value * CreateUDivCeil(llvm::Value * number, llvm::Value * divisor, const llvm::Twine &Name = "");
    58        
     58   
     59    // Round up to a multiple of divisor.
     60    llvm::Value * CreateRoundUp(llvm::Value * number, llvm::Value * divisor, const llvm::Twine &Name = "");
     61           
    5962    llvm::Value * CreateMalloc(llvm::Value * size);
    6063
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5542 r5543  
    631631    const auto fieldWidth = mBaseType->getArrayElementType()->getScalarSizeInBits();
    632632    Value * bufSize = b->getSize((mBufferBlocks + mOverflowBlocks) * b->getBitBlockWidth() * numStreams * fieldWidth/8);
     633    bufSize = b->CreateRoundUp(bufSize, b->getSize(b->getCacheAlignment()));
    633634    Value * bufBasePtrField = b->CreateGEP(handle, {b->getInt32(0), b->getInt32(int(DynamicBuffer::Field::BaseAddress))});
    634635    Value * bufPtr = b->CreatePointerCast(b->CreateCacheAlignedMalloc(bufSize), bufBasePtrField->getType()->getPointerElementType());
Note: See TracChangeset for help on using the changeset viewer.