-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the
@nobarrier
attribute to stop barriers from being automatica…
…lly inserted between `@inner` loop blocks. (#544)
- Loading branch information
Showing
5 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <occa/internal/lang/expr.hpp> | ||
#include <occa/internal/lang/statement.hpp> | ||
#include <occa/internal/lang/builtins/attributes/noBarrier.hpp> | ||
|
||
namespace occa { | ||
namespace lang { | ||
namespace attributes { | ||
//---[ @nobarrier ]----------------------- | ||
noBarrier::noBarrier() {} | ||
|
||
const std::string& noBarrier::name() const { | ||
static std::string name_ = "nobarrier"; | ||
return name_; | ||
} | ||
|
||
bool noBarrier::forStatementType(const int sType) const { | ||
return (sType & statementType::for_); | ||
} | ||
|
||
bool noBarrier::isValid(const attributeToken_t &attr) const { | ||
if (attr.kwargs.size()) { | ||
attr.printError("[@nobarrier] does not take kwargs"); | ||
return false; | ||
} | ||
if (attr.args.size()) { | ||
attr.printError("[@nobarrier] does not take arguments"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
//================================== | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef OCCA_INTERNAL_LANG_BUILTINS_ATTRIBUTES_NOBARRIER_HEADER | ||
#define OCCA_INTERNAL_LANG_BUILTINS_ATTRIBUTES_NOBARRIER_HEADER | ||
|
||
#include <occa/internal/lang/attribute.hpp> | ||
|
||
namespace occa { | ||
namespace lang { | ||
namespace attributes { | ||
//---[ @nobarrier ]--------------- | ||
class noBarrier : public attribute_t { | ||
public: | ||
noBarrier(); | ||
|
||
virtual const std::string& name() const; | ||
|
||
virtual bool forStatementType(const int sType) const; | ||
|
||
virtual bool isValid(const attributeToken_t &attr) const; | ||
}; | ||
//================================ | ||
} | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters