Changeset 5200


Ignore:
Timestamp:
Oct 24, 2016, 10:59:28 AM (2 years ago)
Author:
lindanl
Message:

Force BlockSize? to be 64 for NVPTX.

File:
1 edited

Legend:

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

    r5176 r5200  
    177177
    178178    Function * mainFunc = m->getFunction("Main");
    179     Value * inputThreadPtr = iBuilder->CreateGEP(inputPtr, iBuilder->CreateMul(id, iBuilder->getInt32(8)));
    180     Type * const inputStreamType = PointerType::get(ArrayType::get(ArrayType::get(iBuilder->getBitBlockType(), 8), 1), 1);
    181     Value * inputStream = iBuilder->CreateBitCast(inputThreadPtr, inputStreamType);   
     179    Type * const inputStreamType = PointerType::get(ArrayType::get(ArrayType::get(iBuilder->getBitBlockType(), 8), 1), 1);   
     180    Value * inputStreamPtr = iBuilder->CreateBitCast(inputPtr, inputStreamType);
     181    Value * inputStream = iBuilder->CreateGEP(inputStreamPtr, id);
     182
    182183    Value * bufferSize = iBuilder->CreateLoad(bufferSizePtr);
    183184    if (CountOnly){
     
    187188    }
    188189    else {
    189         Value * outputThreadPtr = iBuilder->CreateGEP(outputPtr, iBuilder->CreateMul(id, iBuilder->getInt32(2)));
    190190        Type * const outputStremType = PointerType::get(ArrayType::get(iBuilder->getBitBlockType(), 2), 1);
    191         Value * outputStream = iBuilder->CreateBitCast(outputThreadPtr, outputStremType);
     191        Value * outputStreamPtr = iBuilder->CreateBitCast(outputPtr, outputStremType);
     192        Value * outputStream = iBuilder->CreateGEP(outputStreamPtr, id);
    192193        iBuilder->CreateCall(mainFunc, {inputStream, bufferSize, outputStream});
    193194    }   
     
    234235    bool CPU_Only = true;
    235236    LLVMContext TheContext;
    236     Module * cpuM = new Module(moduleName+":cpu", TheContext);
    237     IDISA::IDISA_Builder * CPUBuilder = IDISA::GetIDISA_Builder(cpuM);
    238     Module * M = cpuM; 
    239     IDISA::IDISA_Builder * iBuilder = CPUBuilder;
     237    Module * M = nullptr; 
     238    IDISA::IDISA_Builder * iBuilder = nullptr;
    240239
    241240#ifdef CUDA_ENABLED
     
    250249        addrSpace = 1;
    251250        CPU_Only = false;
     251        codegen::BlockSize = 64;
    252252    }   
    253253#endif
     254
     255    Module * cpuM = new Module(moduleName+":cpu", TheContext);
     256    IDISA::IDISA_Builder * CPUBuilder = IDISA::GetIDISA_Builder(cpuM);
     257
     258    if(CPU_Only) {
     259        M = cpuM;
     260        iBuilder = CPUBuilder;
     261    }
    254262
    255263    const unsigned segmentSize = codegen::SegmentSize;
Note: See TracChangeset for help on using the changeset viewer.