Changeset 5040 for icGREP


Ignore:
Timestamp:
May 14, 2016, 9:39:12 AM (3 years ago)
Author:
cameron
Message:

Buffered mode for u8u16 output

File:
1 edited

Legend:

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

    r5011 r5040  
    55#include <llvm/IR/Type.h>
    66#include <iostream>
     7#include <stdint.h>
     8#include <llvm/Support/FileSystem.h>
     9#include <llvm/Support/raw_ostream.h>
     10
     11
     12
     13extern "C" {
     14    void buffered_write(const char * ptr, size_t bytes) {
     15        outs().write(ptr, bytes);
     16    }
     17};
    718
    819namespace kernel{
     
    97108}
    98109
     110const size_t OutputBufferSize=65536;
     111
    99112void generateP2S_16_withCompressedOutputKernel(Module * m, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder) {
     113    outs().SetBufferSize(OutputBufferSize);
    100114    for (unsigned i = 0; i < 16; ++i) {
    101115        kBuilder->addInputStream(1);
     
    105119
    106120    kBuilder->prepareFunction();
    107     Function * writefn = create_write(m);
    108121   
    109122    Type * i8PtrTy = iBuilder->getInt8PtrTy();
    110123    Type * i64 = iBuilder->getIntNTy(64);
    111124    Type * bitBlockPtrTy = llvm::PointerType::get(iBuilder->getBitBlockType(), 0);
     125   
     126    Function * writefn = cast<Function>(m->getOrInsertFunction("buffered_write", iBuilder->getVoidTy(), i8PtrTy, i64, nullptr));
    112127   
    113128    Value * hi_input[8];
     
    148163        //iBuilder->CallPrintInt("byte_offset", byte_offset);
    149164    }
    150     iBuilder->CreateCall(writefn, std::vector<Value *>({iBuilder->getInt32(1), output_ptr, byte_offset}));
     165    iBuilder->CreateCall(writefn, std::vector<Value *>({output_ptr, byte_offset}));
    151166   
    152167    kBuilder->finalize();
Note: See TracChangeset for help on using the changeset viewer.