Commit 3f235180 authored by CARDOSI Paul's avatar CARDOSI Paul
Browse files

Rename some of the data access mode constructs.

parent 711beabe
......@@ -58,7 +58,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]){
std::uniform_real_distribution<double> dis01(0,1);
runtime.task(SpPriority(0), SpProbability(0.5), SpRead(b),
SpMaybeWrite(a),
SpPotentialWrite(a),
[dis01, mtEngine] (const int &inB, int &inA) mutable -> bool{
double val = dis01(mtEngine);
......
......@@ -36,7 +36,7 @@ int main(){
const int nbUncertainTasks = 3;
for(int idx = 0 ; idx < nbUncertainTasks ; ++idx){
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return true;
}).setTaskName("Uncertain task -- " + std::to_string(idx));
}
......
......@@ -154,7 +154,7 @@ int main(){
runtime.task(SpWrite(energyAll),
SpWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpAtomicWrite(*acceptedMove),
SpParallelWrite(*acceptedMove),
[verbose, BoxWidth, displacement, Temperature, idxDomain, idxLoop, randGen](
Matrix<double>& energyAllParam,
Domain<double>& domains_idxDomain,
......@@ -234,8 +234,8 @@ int main(){
for(int idxDomain = 0 ; idxDomain < NbDomains ; ++idxDomain){
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
[verbose, idxDomain, idxLoop, BoxWidth, displacement, Temperature, randGen](
Matrix<double>& energyAllParam,
......@@ -332,8 +332,8 @@ int main(){
for(int idxDomain = 0 ; idxDomain < NbDomains ; ++idxDomain){
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
[verbose, idxDomain, idxLoop, BoxWidth, displacement, Temperature, randGen](
Matrix<double>& energyAllParam,
......@@ -431,8 +431,8 @@ int main(){
for(int idxDomain = 0 ; idxDomain < NbDomains ; ++idxDomain){
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
[verbose, idxDomain, idxLoop, BoxWidth, displacement, randGen](
Matrix<double>& energyAllParam,
......
......@@ -149,8 +149,8 @@ int main(){
SpWrite(*movedDomain),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpWrite(domains[idxDomain]),
SpAtomicWrite(*acceptedMove),
SpAtomicWrite(*failedMove),
SpParallelWrite(*acceptedMove),
SpParallelWrite(*failedMove),
[&Temperature, idxDomain, idxLoop, &collisionLimit, &BoxWidth, &displacement, randGen](
Matrix<double>& energyAllParam,
Domain<double>& movedDomainParam,
......@@ -256,12 +256,12 @@ int main(){
}).setTaskName("MoveDomain -- "+std::to_string(idxLoop)+"/"+std::to_string(idxDomain));
randGen.skip(3*NbParticlesPerDomain);
runtime.task(SpMaybeWrite(energyAll),
runtime.task(SpPotentialWrite(energyAll),
SpWrite(*movedDomain),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpMaybeWrite(domains[idxDomain]),
SpAtomicWrite(*acceptedMove),
SpAtomicWrite(*failedMove),
SpPotentialWrite(domains[idxDomain]),
SpParallelWrite(*acceptedMove),
SpParallelWrite(*failedMove),
[&Temperature, idxDomain, idxLoop, &collisionLimit, &BoxWidth, &displacement, randGen](
Matrix<double>& energyAllParam,
Domain<double>& movedDomainParam,
......
......@@ -226,7 +226,7 @@ int main(){
runtime.task(SpWrite(energyAll),
SpWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpAtomicWrite(*acceptedMove),
SpParallelWrite(*acceptedMove),
[verbose, BoxWidth, displacement, Temperature, idxDomain, idxReplica, idxInnerLoop, randGen](
Matrix<double>& energyAllParam,
Domain<double>& domains_idxDomain,
......@@ -369,8 +369,8 @@ int main(){
for(int idxDomain = 0 ; idxDomain < NbDomains ; ++idxDomain){
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
[verbose, BoxWidth, displacement, Temperature, idxDomain, idxReplica, idxInnerLoop, randGen](
Matrix<double>& energyAllParam,
......@@ -433,10 +433,10 @@ int main(){
Matrix<double>& energyAll1 = replicaEnergyAll[idxReplica+1];
runtime.task(
SpMaybeWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll0),
SpMaybeWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll1),
SpPotentialWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll0),
SpPotentialWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll1),
[verbose, randGen0, idxReplica, &betas, idxLoop](
SpArrayAccessor<Domain<double>>& domains0Param,
Matrix<double>& energyAll0Param,
......@@ -534,8 +534,8 @@ int main(){
for(int idxDomain = 0 ; idxDomain < NbDomains ; ++idxDomain){
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
[verbose, BoxWidth, displacement, Temperature, idxDomain, idxReplica, idxInnerLoop, randGen](
Matrix<double>& energyAllParam,
......@@ -601,10 +601,10 @@ int main(){
Matrix<double>& energyAll1 = replicaEnergyAll[idxReplica+1];
runtime.task(
SpMaybeWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll0),
SpMaybeWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll1),
SpPotentialWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll0),
SpPotentialWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll1),
[verbose, randGen0, idxReplica, &betas, idxLoop](
SpArrayAccessor<Domain<double>>& domains0Param,
Matrix<double>& energyAll0Param,
......@@ -710,8 +710,8 @@ int main(){
}
runtime.task(
SpMaybeWrite(energyAll),
SpMaybeWrite(domains[idxDomain]),
SpPotentialWrite(energyAll),
SpPotentialWrite(domains[idxDomain]),
//SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpRead(*tmpDomains[0]), SpRead(*tmpDomains[1]), SpRead(*tmpDomains[2]), SpRead(*tmpDomains[3]),
[verbose, BoxWidth, displacement, idxDomain, idxReplica, idxInnerLoop, randGen, &domains](
......@@ -774,10 +774,10 @@ int main(){
Matrix<double>& energyAll1 = replicaEnergyAll[idxReplica+1];
runtime.task(
SpMaybeWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll0),
SpMaybeWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpMaybeWrite(energyAll1),
SpPotentialWriteArray(domains0.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll0),
SpPotentialWriteArray(domains1.data(), SpArrayView(NbDomains)),
SpPotentialWrite(energyAll1),
[randGen0, idxReplica, &betas](
SpArrayAccessor<Domain<double>>& /*domains0Param*/,
Matrix<double>& energyAll0Param,
......
......@@ -224,8 +224,8 @@ int main(){
SpWrite(*movedDomain),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpWrite(domains[idxDomain]),
SpAtomicWrite(*acceptedMove),
SpAtomicWrite(*failedMove),
SpParallelWrite(*acceptedMove),
SpParallelWrite(*failedMove),
[&Temperature, idxDomain, idxInnerLoop, idxReplica, &collisionLimit, &BoxWidth, &displacement, randGen](
Matrix<double>& energyAllParam,
Domain<double>& movedDomainParam,
......@@ -385,12 +385,12 @@ int main(){
});
randGen.skip(3*NbParticlesPerDomain);
runtime.task(SpMaybeWrite(energyAll),
runtime.task(SpPotentialWrite(energyAll),
SpWrite(*movedDomain),
SpReadArray(domains.data(),SpArrayView(NbDomains).removeItem(idxDomain)),
SpMaybeWrite(domains[idxDomain]),
SpAtomicWrite(*acceptedMove),
SpAtomicWrite(*failedMove),
SpPotentialWrite(domains[idxDomain]),
SpParallelWrite(*acceptedMove),
SpParallelWrite(*failedMove),
[&Temperature, idxDomain, idxInnerLoop, idxReplica, &collisionLimit, &BoxWidth, &displacement, randGen](
Matrix<double>& energyAllParam,
Domain<double>& movedDomainParam,
......@@ -470,9 +470,9 @@ int main(){
auto& domains1 = replicaDomains[idxReplica+1];
Matrix<double>& energyAll1 = replicaEnergyAll[idxReplica+1];
runtime.task(SpMaybeWrite(domains0), SpMaybeWrite(energyAll0),
SpMaybeWrite(domains1), SpMaybeWrite(energyAll1),
SpAtomicWrite(*nbExchanges),
runtime.task(SpPotentialWrite(domains0), SpPotentialWrite(energyAll0),
SpPotentialWrite(domains1), SpPotentialWrite(energyAll1),
SpParallelWrite(*nbExchanges),
[randGen0, idxReplica, &betas, idxLoop](small_vector<Domain<double>>& domains0Param,
Matrix<double>& energyAll0Param, small_vector<Domain<double>>& domains1Param,
Matrix<double>& energyAll1Param, int& nbExchangesParam) mutable -> bool {
......
......@@ -62,7 +62,7 @@ int main(){
promise1.get_future().get();
}).setTaskName("B");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("C");
......@@ -75,7 +75,7 @@ int main(){
// val is 1
runtime.task(SpMaybeWrite(val), [](int& valParam) -> bool {
runtime.task(SpPotentialWrite(val), [](int& valParam) -> bool {
valParam += 2;
return true;
}).setTaskName("E");
......@@ -119,7 +119,7 @@ int main(){
promise1.get_future().get();
}).setTaskName("B");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("C");
......@@ -132,7 +132,7 @@ int main(){
// val is 1
runtime.task(SpMaybeWrite(val), [](int& valParam) -> bool {
runtime.task(SpPotentialWrite(val), [](int& valParam) -> bool {
valParam += 2;
return true;
}).setTaskName("E");
......@@ -173,7 +173,7 @@ int main(){
promise1.get_future().get();
}).setTaskName("A");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("B");
......@@ -183,7 +183,7 @@ int main(){
counterFirstSpec += 1;
}).setTaskName("C");
runtime.task(SpMaybeWrite(val), [](int& valParam) -> bool {
runtime.task(SpPotentialWrite(val), [](int& valParam) -> bool {
valParam += 2;
return true;
}).setTaskName("D");
......@@ -223,11 +223,11 @@ int main(){
promise1.get_future().get();
}).setTaskName("A");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("B");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("C");
......@@ -265,11 +265,11 @@ int main(){
promise1.get_future().get();
}).setTaskName("A");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("B");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return true;
}).setTaskName("C");
......@@ -310,19 +310,19 @@ int main(){
promise1.get_future().get();
}).setTaskName("A");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return false;
}).setTaskName("B");
runtime.task(SpMaybeWrite(val), [](int& /*valParam*/) -> bool {
runtime.task(SpPotentialWrite(val), [](int& /*valParam*/) -> bool {
return true;
}).setTaskName("C");
runtime.task(SpMaybeWrite(val2), [](int& /*valParam2*/) -> bool {
runtime.task(SpPotentialWrite(val2), [](int& /*valParam2*/) -> bool {
return true;
}).setTaskName("D");
runtime.task(SpMaybeWrite(val3), [](int& /*valParam3*/) -> bool {
runtime.task(SpPotentialWrite(val3), [](int& /*valParam3*/) -> bool {
return true;
}).setTaskName("E");
......
......@@ -74,18 +74,18 @@ public:
// Write cannot not be done concurently, so create a new dependence
dependencesOnData.emplace_back(inTask, inAccessMode);
}
else if(inAccessMode == SpDataAccessMode::MAYBE_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::MAYBE_WRITE);
else if(inAccessMode == SpDataAccessMode::POTENTIAL_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::POTENTIAL_WRITE);
// Write cannot not be done concurently, so create a new dependence
dependencesOnData.emplace_back(inTask, inAccessMode);
}
else if(inAccessMode == SpDataAccessMode::ATOMIC_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::ATOMIC_WRITE);
else if(inAccessMode == SpDataAccessMode::PARALLEL_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::PARALLEL_WRITE);
// append to the last dependence, because can be done concurrently
dependencesOnData.back().addTaskForMultiple(inTask);
}
else if(inAccessMode == SpDataAccessMode::COMMUTE_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::COMMUTE_WRITE);
else if(inAccessMode == SpDataAccessMode::COMMUTATIVE_WRITE){
assert(dependencesOnData.back().getMode() == SpDataAccessMode::COMMUTATIVE_WRITE);
// append to the last dependence, because can be done concurrently
dependencesOnData.back().addTaskForMultiple(inTask);
}
......@@ -179,7 +179,7 @@ public:
std::unique_lock<std::mutex> lock(mutexDependences);
if(afterIdx != static_cast<long int>(dependencesOnData.size()-1)){
if(dependencesOnData[afterIdx].getMode() != SpDataAccessMode::WRITE
&& dependencesOnData[afterIdx].getMode() != SpDataAccessMode::MAYBE_WRITE){
&& dependencesOnData[afterIdx].getMode() != SpDataAccessMode::POTENTIAL_WRITE){
long int skipConcatDeps = afterIdx;
while(skipConcatDeps != static_cast<long int>(dependencesOnData.size()-1)
&& dependencesOnData[skipConcatDeps].getMode() == dependencesOnData[skipConcatDeps+1].getMode()){
......@@ -192,7 +192,7 @@ public:
else{
long int skipConcatDeps = afterIdx+1;
bool isCommutativeAccess = dependencesOnData[skipConcatDeps].getMode() != SpDataAccessMode::WRITE
&& dependencesOnData[skipConcatDeps].getMode() != SpDataAccessMode::MAYBE_WRITE;
&& dependencesOnData[skipConcatDeps].getMode() != SpDataAccessMode::POTENTIAL_WRITE;
do {
dependencesOnData[skipConcatDeps].fillWithTaskList(dependences);
skipConcatDeps += 1;
......@@ -207,7 +207,7 @@ public:
std::unique_lock<std::mutex> lock(mutexDependences);
if(beforeIdx != 0){
if(dependencesOnData[beforeIdx].getMode() != SpDataAccessMode::WRITE
&& dependencesOnData[beforeIdx].getMode() != SpDataAccessMode::MAYBE_WRITE){
&& dependencesOnData[beforeIdx].getMode() != SpDataAccessMode::POTENTIAL_WRITE){
long int skipConcatDeps = beforeIdx-1;
while(skipConcatDeps != -1
&& dependencesOnData[skipConcatDeps].getMode() == dependencesOnData[skipConcatDeps+1].getMode()){
......
......@@ -35,7 +35,7 @@ public:
explicit SpDependence(SpAbstractTask* inFirstTaskId, const SpDataAccessMode inMode)
: accessMode(inMode) ,idTaskWrite(nullptr), nbTasksInUsed(0) , nbTasksReleased(0){
SpDebugPrint() << "[SpDependence] => " << inFirstTaskId << " mode " << SpModeToStr(inMode);
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
idTaskWrite = inFirstTaskId;
}
else{
......@@ -56,7 +56,7 @@ public:
//! Add a task to the list of users
void addTaskForMultiple(SpAbstractTask* inOtherTaskId){
assert(accessMode != SpDataAccessMode::WRITE && accessMode != SpDataAccessMode::MAYBE_WRITE);
assert(accessMode != SpDataAccessMode::WRITE && accessMode != SpDataAccessMode::POTENTIAL_WRITE);
idTasksMultiple.push_back(inOtherTaskId);
}
......@@ -64,7 +64,7 @@ public:
//! the task must be valid and registered
bool canBeUsedByTask(const SpAbstractTask* useTaskId) const {
SpDebugPrint() << "[SpDependence]canBeUsedByTask " << useTaskId;
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
// If it is write
SpDebugPrint() << "[SpDependence]Is in write, next task is " << idTaskWrite;
// Must not have been already used
......@@ -74,7 +74,7 @@ public:
return true;
}
// If it is commute
else if(accessMode == SpDataAccessMode::COMMUTE_WRITE){
else if(accessMode == SpDataAccessMode::COMMUTATIVE_WRITE){
// The number of already user tasks must be less than the number of register tasks
assert(nbTasksInUsed < static_cast<long int>(idTasksMultiple.size()));
// In commute their must be only 0 or 1 usage at a time
......@@ -106,7 +106,7 @@ public:
}
void fillWithTaskList(small_vector_base<SpAbstractTask*>* potentialReady) const {
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
potentialReady->push_back(idTaskWrite);
}
else{
......@@ -119,7 +119,7 @@ public:
//! Copy all the tasks related to the dependence into the given vector
void fillWithListOfPotentiallyReadyTasks(small_vector_base<SpAbstractTask*>* potentialReady) const {
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
if(idTaskWrite->isState(SpTaskState::WAITING_TO_BE_READY)) {
potentialReady->push_back(idTaskWrite);
}
......@@ -137,7 +137,7 @@ public:
//! Marks the dependence as release by the given task
//! Must be called after setUsedByTask
bool releaseByTask([[maybe_unused]] SpAbstractTask* useTaskId){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
assert(nbTasksReleased == 0);
assert(nbTasksInUsed == 1);
assert(idTaskWrite == useTaskId);
......@@ -155,7 +155,7 @@ public:
assert(nbTasksReleased < nbTasksInUsed);
nbTasksReleased += 1;
assert(nbTasksReleased <= int(idTasksMultiple.size()));
if(accessMode == SpDataAccessMode::COMMUTE_WRITE){
if(accessMode == SpDataAccessMode::COMMUTATIVE_WRITE){
assert(nbTasksReleased == nbTasksInUsed);
// Return true if there still are any unfulfilled commutative write access requests
// on the data handle. So basically, by returning true in this case we notify the caller
......@@ -179,7 +179,7 @@ public:
//! Return true if all tasks have used the dependence (and finished to use)
//! Must be called after release
bool isOver() const{
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
assert(nbTasksReleased == 1);
assert(nbTasksInUsed == 1);
return true;
......@@ -197,10 +197,10 @@ public:
bool isAvailable() const {
assert(isOver() == false);
assert(nbTasksReleased <= nbTasksInUsed);
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::MAYBE_WRITE){
if(accessMode == SpDataAccessMode::WRITE || accessMode == SpDataAccessMode::POTENTIAL_WRITE){
return nbTasksInUsed == 0;
}
else if(accessMode == SpDataAccessMode::COMMUTE_WRITE){
else if(accessMode == SpDataAccessMode::COMMUTATIVE_WRITE){
return nbTasksInUsed == nbTasksReleased && (nbTasksReleased < static_cast<long int>(idTasksMultiple.size()));
}
else{
......
......@@ -61,7 +61,7 @@ class SpTasksManager{
aTask->takeControl();
if(aTask->isState(SpTaskState::WAITING_TO_BE_READY)){
SpDebugPrint() << "Is waiting to be ready " << aTask->getId();
const bool useCommute = aTask->hasMode(SpDataAccessMode::COMMUTE_WRITE);
const bool useCommute = aTask->hasMode(SpDataAccessMode::COMMUTATIVE_WRITE);
if(useCommute){
mutexCommute.lock();
}
......
......@@ -98,7 +98,7 @@ protected:
inline static constexpr bool is_data_dependency_v = is_data_dependency<T>::value;
template <class... ParamsTy>
using contains_maybe_write_dependencies = std::disjunction<access_modes_are_equal<SpDataAccessMode::MAYBE_WRITE, ParamsTy>...>;
using contains_maybe_write_dependencies = std::disjunction<access_modes_are_equal<SpDataAccessMode::POTENTIAL_WRITE, ParamsTy>...>;
template <class... ParamsTy>
inline static constexpr bool contains_maybe_write_dependencies_v = contains_maybe_write_dependencies<ParamsTy...>::value;
......@@ -592,11 +592,11 @@ private:
small_vector<const void *> originalAddresses;
constexpr const unsigned char maybeWriteFlags = 1 << static_cast<unsigned char>(SpDataAccessMode::MAYBE_WRITE);
constexpr const unsigned char maybeWriteFlags = 1 << static_cast<unsigned char>(SpDataAccessMode::POTENTIAL_WRITE);
constexpr const unsigned char writeFlags = 1 << static_cast<unsigned char>(SpDataAccessMode::WRITE)
| 1 << static_cast<unsigned char>(SpDataAccessMode::COMMUTE_WRITE)
| 1 << static_cast<unsigned char>(SpDataAccessMode::ATOMIC_WRITE);
| 1 << static_cast<unsigned char>(SpDataAccessMode::COMMUTATIVE_WRITE)
| 1 << static_cast<unsigned char>(SpDataAccessMode::PARALLEL_WRITE);
auto originalAddressesOfMaybeWrittenHandles = getOriginalAddressesOfHandlesWithAccessModes<maybeWriteFlags>(std::forward<DataDependencyTupleTy>(dataDepTuple));
auto originalAddressesOfWrittenHandles = getOriginalAddressesOfHandlesWithAccessModes<writeFlags>(std::forward<DataDependencyTupleTy>(dataDepTuple));
......@@ -1158,7 +1158,7 @@ private:
const SpTaskActivation initialActivationState,
const SpPriority& inPriority,
Tuple& args){
return copyIfAccess<false, true, SpDataAccessMode::MAYBE_WRITE>(copyMapsToLookInto, initialActivationState, inPriority, args);
return copyIfAccess<false, true, SpDataAccessMode::POTENTIAL_WRITE>(copyMapsToLookInto, initialActivationState, inPriority, args);
}
template <class Tuple, std::size_t N>
......@@ -1166,7 +1166,7 @@ private:
const SpTaskActivation initialActivationState,
const SpPriority& inPriority,
Tuple& args){
return copyIfAccess<true, false, SpDataAccessMode::MAYBE_WRITE>(copyMapsToLookInto, initialActivationState, inPriority, args);
return copyIfAccess<true, false, SpDataAccessMode::POTENTIAL_WRITE>(copyMapsToLookInto, initialActivationState, inPriority, args);
}
template <class Tuple, std::size_t N>
......
......@@ -317,7 +317,7 @@ public:
}
else if(testMode == SpDataAccessMode::READ && testDep->second == SpDataAccessMode::READ){
}
else if(testMode == SpDataAccessMode::ATOMIC_WRITE && testDep->second == SpDataAccessMode::ATOMIC_WRITE){
else if(testMode == SpDataAccessMode::PARALLEL_WRITE && testDep->second == SpDataAccessMode::PARALLEL_WRITE){
}
else{
return false;
......@@ -334,7 +334,7 @@ public:
}
else if(testMode == SpDataAccessMode::READ && testDep->second == SpDataAccessMode::READ){
}
else if(testMode == SpDataAccessMode::ATOMIC_WRITE && testDep->second == SpDataAccessMode::ATOMIC_WRITE){
else if(testMode == SpDataAccessMode::PARALLEL_WRITE && testDep->second == SpDataAccessMode::PARALLEL_WRITE){
}
else{
return false;
......
......@@ -22,9 +22,9 @@
enum class SpDataAccessMode{
READ=0,
WRITE,
ATOMIC_WRITE,
COMMUTE_WRITE,
MAYBE_WRITE
PARALLEL_WRITE,
COMMUTATIVE_WRITE,
POTENTIAL_WRITE
};
////////////////////////////////////////////////////////
......@@ -35,9 +35,9 @@ inline std::string SpModeToStr(const SpDataAccessMode inMode){
switch(inMode){
case SpDataAccessMode::READ: return "READ";
case SpDataAccessMode::WRITE: return "WRITE";
case SpDataAccessMode::ATOMIC_WRITE: return "ATOMIC_WRITE";
case SpDataAccessMode::COMMUTE_WRITE: return "COMMUTE_WRITE";
case SpDataAccessMode::MAYBE_WRITE: return "MAYBE_WRITE";
case SpDataAccessMode::PARALLEL_WRITE: return "PARALLEL_WRITE";
case SpDataAccessMode::COMMUTATIVE_WRITE: return "COMMUTATIVE_WRITE";
case SpDataAccessMode::POTENTIAL_WRITE: return "POTENTIAL_WRITE";
}
return "UNDEFINED";
}
......@@ -172,22 +172,22 @@ constexpr SpScalarDataMode<SpDataAccessMode::WRITE, DepType&> SpWrite(DepType& i
}
template <class DepType>
constexpr SpScalarDataMode<SpDataAccessMode::ATOMIC_WRITE, DepType&> SpAtomicWrite(DepType& inDep){
constexpr SpScalarDataMode<SpDataAccessMode::PARALLEL_WRITE, DepType&> SpParallelWrite(DepType& inDep){
static_assert(std::is_const<DepType>::value == false, "Atomic Write cannot be done on const value");
return SpScalarDataMode<SpDataAccessMode::ATOMIC_WRITE, DepType&>(inDep);
return SpScalarDataMode<SpDataAccessMode::PARALLEL_WRITE, DepType&>(inDep);
}
template <class DepType>
constexpr SpScalarDataMode<SpDataAccessMode::COMMUTE_WRITE, DepType&> SpCommuteWrite(DepType& inDep){
constexpr SpScalarDataMode<SpDataAccessMode::COMMUTATIVE_WRITE, DepType&> SpCommutativeWrite(DepType& inDep){
static_assert(std::is_const<DepType>::value == false, "Commute Write cannot be done on const value");
return SpScalarDataMode<SpDataAccessMode::COMMUTE_WRITE, DepType&>(inDep);
return SpScalarDataMode<SpDataAccessMode::COMMUTATIVE_WRITE, DepType&>(inDep);
}
template <class DepType>
constexpr SpScalarDataMode<SpDataAccessMode::MAYBE_WRITE, DepType&> SpMaybeWrite(DepType& inDep){
constexpr SpScalarDataMode<SpDataAccessMode::POTENTIAL_WRITE, DepType&> SpPotentialWrite(DepType& inDep){
static_assert(std::is_const<DepType>::value == false, "Maybe Write cannot be done on const value");
static_assert(SpDataCanBeDuplicate<DepType>::value, "Maybe write data must be duplicatable");
return SpScalarDataMode<SpDataAccessMode::MAYBE_WRITE, DepType&>(inDep);
return SpScalarDataMode<SpDataAccessMode::POTENTIAL_WRITE, DepType&>(inDep);
}
////////////////////////////////////////////////////////
......@@ -204,21 +204,21 @@ SpContainerDataMode<SpDataAccessMode::WRITE, DepType*,SpArrayAccessor<DepType>>
}
template <class DepType, class ViewType>