Ignore:
Timestamp:
Feb 3, 2018, 12:02:14 PM (20 months ago)
Author:
cameron
Message:

Using DirectCC builder updates; speedup wc -l

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

Legend:

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

    r5854 r5861  
    7878void CharClassesKernel::generatePabloMethod() {
    7979    PabloBuilder pb(getEntryScope());
    80     CC_Compiler * ccc;
     80    std::unique_ptr<CC_Compiler> ccc;
    8181    if (mUseDirectCC) {
    82         ccc = new Direct_CC_Compiler(this, pb.createExtract(getInputStreamVar("byteData"), pb.getInteger(0)));
     82        ccc = make_unique<cc::Direct_CC_Compiler>(this, pb.createExtract(getInput(0), pb.getInteger(0)));
     83    } else {
     84        ccc = make_unique<cc::Parabix_CC_Compiler>(this, getInputStreamSet("basis"));
    8385    }
    84     else {
    85         ccc = new Parabix_CC_Compiler(this, getInputStreamSet("basis"));
    86     }
    87 
    8886    unsigned n = mCCs.size();
    8987
     
    9694    }
    9795
    98     UCD::UCDCompiler ucdCompiler(*ccc);
     96    UCD::UCDCompiler ucdCompiler(*ccc.get());
    9997    if (LLVM_UNLIKELY(AlgorithmOptionIsSet(DisableIfHierarchy))) {
    10098        ucdCompiler.generateWithoutIfHierarchy(nameMap, pb);
     
    114112        }
    115113    }
    116     delete ccc;
    117114}
    118115
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.cpp

    r5856 r5861  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 */
     
    1212#include <cc/cc_compiler.h>
    1313#include <pablo/builder.hpp>
     14#include <IR_Gen/idisa_builder.h>
    1415#include <kernels/kernel_builder.h>
    1516
     
    2122using namespace re;
    2223using namespace llvm;
     24using namespace IDISA;
    2325
    24 LineFeedKernelBuilder::LineFeedKernelBuilder(const std::unique_ptr<kernel::KernelBuilder> & b, const unsigned codeUnitWidth)
    25 : PabloKernel(b, "lf" + std::to_string(codeUnitWidth),
     26LineFeedKernelBuilder::LineFeedKernelBuilder(const std::unique_ptr<kernel::KernelBuilder> & b, Binding && inputStreamSet)
     27: PabloKernel(b, "lf" + std::to_string(getNumOfStreams(inputStreamSet.getType())) + "x" + std::to_string(getStreamFieldWidth(inputStreamSet.getType())),
    2628// input
    27 #ifdef USE_DIRECT_LF_BUILDER
    28 {Binding{b->getStreamSetTy(1, codeUnitWidth), "byteStream", FixedRate(), Principal()}},
    29 #else
    30 {Binding{b->getStreamSetTy(codeUnitWidth), "basis", FixedRate(), Principal()}},
    31 #endif
    32 // output
    33 {Binding{b->getStreamSetTy(1), "lf"}}) {
    34 
     29{inputStreamSet},
     30{Binding{b->getStreamSetTy(1), "lf"}}),
     31    mNumOfStreams(getNumOfStreams(inputStreamSet.getType())),
     32    mStreamFieldWidth(getStreamFieldWidth(inputStreamSet.getType()))
     33{
    3534}
    3635
    3736void LineFeedKernelBuilder::generatePabloMethod() {
    3837    PabloBuilder pb(getEntryScope());
    39     #ifdef USE_DIRECT_LF_BUILDER
    40     cc::Direct_CC_Compiler ccc(this, pb.createExtract(getInputStreamVar("byteStream"), pb.getInteger(0)));
    41     #else
    42     cc::Parabix_CC_Compiler ccc(this, getInputStreamSet("basis"));
    43     #endif
    44     PabloAST * LF = ccc.compileCC("LF", makeByte(0x0A), pb);
     38    std::unique_ptr<CC_Compiler> ccc;
     39    if (mNumOfStreams == 1) {
     40        ccc = make_unique<cc::Direct_CC_Compiler>(this, pb.createExtract(getInput(0), pb.getInteger(0)));
     41    } else {
     42        ccc = make_unique<cc::Parabix_CC_Compiler>(this, getInputStreamSet("basis"));
     43    }
     44    PabloAST * LF = ccc->compileCC("LF", makeByte(0x0A), pb);
    4545    pb.createAssign(pb.createExtract(getOutput(0), 0), LF);
    4646}
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.h

    r5859 r5861  
    1111
    1212namespace kernel {
    13 //#define USE_DIRECT_LF_BUILDER
     13#define USE_DIRECT_LF_BUILDER
    1414
    1515class LineFeedKernelBuilder final : public pablo::PabloKernel {
    1616public:
    17     LineFeedKernelBuilder(const std::unique_ptr<KernelBuilder> & b, unsigned codeUnitWidth = 8);
     17    LineFeedKernelBuilder(const std::unique_ptr<KernelBuilder> & b, kernel::Binding && inputStreamSet);
    1818    bool isCachable() const override { return true; }
    1919    bool hasSignature() const override { return false; }
    2020protected:
    2121    void generatePabloMethod() override;
     22    unsigned mNumOfStreams;
     23    unsigned mStreamFieldWidth;
    2224};
    2325
Note: See TracChangeset for help on using the changeset viewer.