Ignore:
Timestamp:
Oct 14, 2016, 6:53:44 AM (3 years ago)
Author:
cameron
Message:

CreateAtomicLoadAcquire?, CreateAtomicStoreRelease? with NVPTX overrides

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

Legend:

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

    r5188 r5192  
    189189    std::vector<Value *> producerPos;
    190190    /* Determine the actually available data examining all input stream sets. */
    191     LoadInst * p = iBuilder->CreateAlignedLoad(inbufProducerPtrs[0], sizeof(size_t));
    192     p->setOrdering(AtomicOrdering::Acquire);
     191    LoadInst * p = iBuilder->CreateAtomicLoadAcquire(inbufProducerPtrs[0]);
    193192    producerPos.push_back(p);
    194193    Value * availablePos = producerPos[0];
    195194    for (unsigned i = 1; i < inbufProducerPtrs.size(); i++) {
    196         LoadInst * p = iBuilder->CreateAlignedLoad(inbufProducerPtrs[i], sizeof(size_t));
    197         p->setOrdering(AtomicOrdering::Acquire);
     195       
     196        LoadInst * p = iBuilder->CreateAtomicLoadAcquire(inbufProducerPtrs[i]);
    198197        producerPos.push_back(p);
    199198        /* Set the available position to be the minimum of availablePos and producerPos. */
     
    269268        Value * ssStructPtr = getStreamSetStructPtr(self, mStreamSetOutputs[i].ssName);
    270269        Value * producerPosPtr = mStreamSetOutputBuffers[i]->getProducerPosPtr(ssStructPtr);
    271         iBuilder->CreateAlignedStore(produced, producerPosPtr, sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     270        iBuilder->CreateAtomicStoreRelease(produced, producerPosPtr);
    272271    }
    273272
     
    301300Value * KernelBuilder::getLogicalSegmentNo(Value * self) {
    302301    Value * ptr = iBuilder->CreateGEP(self, {iBuilder->getInt32(0), getScalarIndex(logicalSegmentNoScalar)});
    303     LoadInst * segNo = iBuilder->CreateAlignedLoad(ptr, sizeof(size_t));
    304     segNo->setOrdering(AtomicOrdering::Acquire);
     302    LoadInst * segNo = iBuilder->CreateAtomicLoadAcquire(ptr);
    305303    return segNo;
    306304}
     
    322320void KernelBuilder::setLogicalSegmentNo(Value * self, Value * newCount) {
    323321    Value * ptr = iBuilder->CreateGEP(self, {iBuilder->getInt32(0), getScalarIndex(logicalSegmentNoScalar)});
    324     iBuilder->CreateAlignedStore(newCount, ptr, sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     322    iBuilder->CreateAtomicStoreRelease(newCount, ptr);
    325323}
    326324
     
    475473    Value * waitCondTest = ConstantInt::get(int1ty, 1);   
    476474    for (unsigned i = 0; i < outbufProducerPtrs.size(); i++) {
    477         LoadInst * producerPos = iBuilder->CreateAlignedLoad(outbufProducerPtrs[i], sizeof(size_t));
    478         producerPos->setOrdering(AtomicOrdering::Acquire);
     475        LoadInst * producerPos = iBuilder->CreateAtomicLoadAcquire(outbufProducerPtrs[i]);
    479476        // iBuilder->CallPrintInt(name + ":output producerPos", producerPos);
    480         LoadInst * consumerPos = iBuilder->CreateAlignedLoad(outbufConsumerPtrs[i], sizeof(size_t));
    481         consumerPos->setOrdering(AtomicOrdering::Acquire);
     477        LoadInst * consumerPos = iBuilder->CreateAtomicLoadAcquire(outbufConsumerPtrs[i]);
    482478        // iBuilder->CallPrintInt(name + ":output consumerPos", consumerPos);
    483479        waitCondTest = iBuilder->CreateAnd(waitCondTest, iBuilder->CreateICmpULE(producerPos, iBuilder->CreateAdd(consumerPos, bufferSize)));
     
    494490    waitCondTest = ConstantInt::get(int1ty, 1);
    495491    for (unsigned i = 0; i < inbufProducerPtrs.size(); i++) {
    496         LoadInst * producerPos = iBuilder->CreateAlignedLoad(inbufProducerPtrs[i], sizeof(size_t));
    497         producerPos->setOrdering(AtomicOrdering::Acquire);
     492        LoadInst * producerPos = iBuilder->CreateAtomicLoadAcquire(inbufProducerPtrs[i]);
    498493        // iBuilder->CallPrintInt(name + ":input producerPos", producerPos);
    499         LoadInst * consumerPos = iBuilder->CreateAlignedLoad(inbufConsumerPtrs[i], sizeof(size_t));
    500         consumerPos->setOrdering(AtomicOrdering::Acquire);
     494        LoadInst * consumerPos = iBuilder->CreateAtomicLoadAcquire(inbufConsumerPtrs[i]);
    501495        // iBuilder->CallPrintInt(name + ":input consumerPos", consumerPos);
    502496        waitCondTest = iBuilder->CreateAnd(waitCondTest, iBuilder->CreateICmpULE(iBuilder->CreateAdd(consumerPos, requiredSize), producerPos));
     
    521515    for (unsigned i = 0; i < inbufConsumerPtrs.size(); i++) {
    522516        Value * consumerPos = iBuilder->CreateAdd(iBuilder->CreateLoad(inbufConsumerPtrs[i]), segSize);
    523         iBuilder->CreateAlignedStore(consumerPos, inbufConsumerPtrs[i], sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     517        iBuilder->CreateAtomicStoreRelease(consumerPos, inbufConsumerPtrs[i]);
    524518    }
    525519   
    526520    Value * produced = getProducedItemCount(self);
    527521    for (unsigned i = 0; i < outbufProducerPtrs.size(); i++) {
    528         iBuilder->CreateAlignedStore(produced, outbufProducerPtrs[i], sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     522        iBuilder->CreateAtomicStoreRelease(produced, outbufProducerPtrs[i]);
    529523    }
    530524   
     
    564558    for (unsigned i = 0; i < inbufConsumerPtrs.size(); i++) {
    565559        Value * consumerPos = iBuilder->CreateAdd(iBuilder->CreateLoad(inbufConsumerPtrs[i]), remainingBytes);
    566         iBuilder->CreateAlignedStore(consumerPos, inbufConsumerPtrs[i], sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     560        iBuilder->CreateAtomicStoreRelease(consumerPos, inbufConsumerPtrs[i]);
    567561    }
    568562    for (unsigned i = 0; i < outbufProducerPtrs.size(); i++) {
    569         iBuilder->CreateAlignedStore(producerPos, outbufProducerPtrs[i], sizeof(size_t))->setOrdering(AtomicOrdering::Release);
     563        iBuilder->CreateAtomicStoreRelease(producerPos, outbufProducerPtrs[i]);
    570564    }
    571565
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.cpp

    r5185 r5192  
    236236        Value * ssStructPtr = getStreamSetStructPtr(self, mStreamSetOutputs[i].ssName);
    237237        Value * producerPosPtr = mStreamSetOutputBuffers[i]->getProducerPosPtr(ssStructPtr);
    238         iBuilder->CreateAlignedStore(i16UnitsGenerated, producerPosPtr, sizeof(size_t))->setOrdering(AtomicOrdering::Release);
    239     }
    240     iBuilder->CreateRetVoid();
    241     iBuilder->restoreIP(savePoint);
    242 }
    243    
    244    
    245 }
     238        iBuilder->CreateAtomicStoreRelease(i16UnitsGenerated, producerPosPtr);
     239    iBuilder->CreateRetVoid();
     240    iBuilder->restoreIP(savePoint);
     241}
     242   
     243   
     244}
  • icGREP/icgrep-devel/icgrep/kernels/stdout_kernel.cpp

    r5188 r5192  
    5454    //iBuilder->CallPrintInt("streamStructPtr", iBuilder->CreatePtrToInt(streamStructPtr, iBuilder->getInt64Ty()));
    5555
    56     LoadInst * producerPos = iBuilder->CreateAlignedLoad(mStreamSetInputBuffers[0]->getProducerPosPtr(streamStructPtr), sizeof(size_t));
    57     producerPos->setOrdering(AtomicOrdering::Acquire);
     56    LoadInst * producerPos = iBuilder->CreateAtomicLoadAcquire(mStreamSetInputBuffers[0]->getProducerPosPtr(streamStructPtr));
    5857    //iBuilder->CallPrintInt("producerPos", producerPos);
    5958    Value * endSignal = iBuilder->CreateLoad(mStreamSetInputBuffers[0]->hasEndOfInputPtr(streamStructPtr));
     
    101100    Value * self = getParameter(finalBlockFunction, "self");
    102101    Value * streamStructPtr = getStreamSetStructPtr(self, "codeUnitBuffer");
    103     LoadInst * producerPos = iBuilder->CreateAlignedLoad(mStreamSetInputBuffers[0]->getProducerPosPtr(streamStructPtr), sizeof(size_t));
    104     producerPos->setOrdering(AtomicOrdering::Acquire);
     102    LoadInst * producerPos = iBuilder->CreateAtomicLoadAcquire(mStreamSetInputBuffers[0]->getProducerPosPtr(streamStructPtr));
    105103    Value * processed = getProcessedItemCount(self);
    106104    Value * itemsAvail = iBuilder->CreateSub(producerPos, processed);
Note: See TracChangeset for help on using the changeset viewer.