Ignore:
Timestamp:
Dec 5, 2016, 1:08:23 PM (3 years ago)
Author:
cameron
Message:

Automate instance creation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5217 r5220  
    223223    scanMatchK.generateKernel({&MatchResults}, {});
    224224           
    225     Value * scanMatchInstance = scanMatchK.createInstance({inputStream, fileSize, fileIdx});
    226    
    227     generatePipelineLoop(iBuilder, {&scanMatchK}, {scanMatchInstance}, fileSize);
     225    scanMatchK.setInitialArguments({inputStream, fileSize, fileIdx});
     226   
     227    generatePipelineLoop(iBuilder, {&scanMatchK}, fileSize);
    228228    iBuilder->CreateRetVoid();
    229229
     
    345345    BasisBits.allocateBuffer();
    346346
    347     Value * s2pInstance = s2pk.createInstance({});
    348  
    349347    Type * pthreadTy = size_ty;
    350348    FunctionType * funVoidPtrVoidTy = FunctionType::get(voidTy, int8PtrTy, false);   
     
    371369    if (CountOnly) {       
    372370        icgrepK.generateKernel({&BasisBits}, {});       
    373         Value * icgrepInstance = icgrepK.createInstance({});
    374371        if (pipelineParallel){
    375             generatePipelineParallel(iBuilder, {&s2pk, &icgrepK}, {s2pInstance, icgrepInstance});
     372            generatePipelineParallel(iBuilder, {&s2pk, &icgrepK});
    376373        } else if (segmentPipelineParallel){
    377             generateSegmentParallelPipeline(iBuilder, {&s2pk, &icgrepK}, {s2pInstance, icgrepInstance}, fileSize);
     374            generateSegmentParallelPipeline(iBuilder, {&s2pk, &icgrepK}, fileSize);
    378375        } else {
    379             generatePipelineLoop(iBuilder, {&s2pk, &icgrepK}, {s2pInstance, icgrepInstance}, fileSize);
    380         }
    381 
    382         Value * matchCount = icgrepK.createGetAccumulatorCall(icgrepInstance, "matchedLineCount");
     376            generatePipelineLoop(iBuilder, {&s2pk, &icgrepK}, fileSize);
     377        }
     378
     379        Value * matchCount = icgrepK.createGetAccumulatorCall(icgrepK.getInstance(), "matchedLineCount");
    383380
    384381        iBuilder->CreateRet(matchCount);
     
    391388
    392389            icgrepK.generateKernel({&BasisBits},  {&MatchResults});
    393             Value * icgrepInstance = icgrepK.createInstance({});
    394 
    395             generatePipelineLoop(iBuilder, {&s2pk, &icgrepK}, {s2pInstance, icgrepInstance}, fileSize);
     390            generatePipelineLoop(iBuilder, {&s2pk, &icgrepK}, fileSize);
    396391
    397392        }
     
    402397
    403398            icgrepK.generateKernel({&BasisBits}, {&MatchResults});
    404             Value * icgrepInstance = icgrepK.createInstance({});
    405399
    406400            kernel::ScanMatchKernel scanMatchK(iBuilder, mGrepType);
    407401            scanMatchK.generateKernel({&MatchResults}, {});               
    408             Value * scanMatchInstance = scanMatchK.createInstance({iBuilder->CreateBitCast(inputStream, int8PtrTy), fileSize, fileIdx});
     402            scanMatchK.setInitialArguments({iBuilder->CreateBitCast(inputStream, int8PtrTy), fileSize, fileIdx});
    409403
    410404            if (pipelineParallel){
    411                 generatePipelineParallel(iBuilder, {&s2pk, &icgrepK, &scanMatchK}, {s2pInstance, icgrepInstance, scanMatchInstance});
     405                generatePipelineParallel(iBuilder, {&s2pk, &icgrepK, &scanMatchK});
    412406            } else if (segmentPipelineParallel){
    413                 generateSegmentParallelPipeline(iBuilder, {&s2pk, &icgrepK, &scanMatchK}, {s2pInstance, icgrepInstance, scanMatchInstance}, fileSize);
     407                generateSegmentParallelPipeline(iBuilder, {&s2pk, &icgrepK, &scanMatchK}, fileSize);
    414408            }  else{
    415                 generatePipelineLoop(iBuilder, {&s2pk, &icgrepK, &scanMatchK}, {s2pInstance, icgrepInstance, scanMatchInstance}, fileSize);
     409                generatePipelineLoop(iBuilder, {&s2pk, &icgrepK, &scanMatchK}, fileSize);
    416410            }
    417411        }
Note: See TracChangeset for help on using the changeset viewer.