-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set SYCL subgroup size via kernel property or
@simd_length
attribut…
…e. (#726)
- Loading branch information
Showing
10 changed files
with
227 additions
and
13 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
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,50 @@ | ||
#include <occa/internal/lang/expr.hpp> | ||
#include <occa/internal/lang/parser.hpp> | ||
#include <occa/internal/lang/statement.hpp> | ||
#include <occa/internal/lang/variable.hpp> | ||
#include <occa/internal/lang/builtins/attributes/simdLength.hpp> | ||
|
||
namespace occa { | ||
namespace lang { | ||
namespace attributes { | ||
|
||
const std::string& simdLength::name() const { return name_;} | ||
|
||
bool simdLength::forStatementType(const int sType) const { | ||
return (sType & statementType::for_); | ||
} | ||
|
||
bool simdLength::isValid(const attributeToken_t &attr) const { | ||
if (attr.kwargs.size()) { | ||
attr.printError(name_ + " does not take kwargs"); | ||
return false; | ||
} | ||
|
||
if (1 != attr.args.size()) { | ||
attr.printError(name_ + " takes one argument"); | ||
return false; | ||
} | ||
|
||
const auto& attr_arg = attr.args[0]; | ||
if (!attr_arg.canEvaluate()) { | ||
attr.printError(name_ + " cannot evaluate argument"); | ||
return false; | ||
} | ||
|
||
primitive value = attr_arg.expr->evaluate(); | ||
if (!value.isInteger()) { | ||
attr.printError(name_ + " take an integer argument"); | ||
return false; | ||
} | ||
|
||
if(0 > value.to<int>()) { | ||
attr.printError(name_ + " arguments must be postive!"); | ||
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,24 @@ | ||
#ifndef OCCA_INTERNAL_LANG_BUILTINS_ATTRIBUTES_SIMD_LENGTH_HEADER | ||
#define OCCA_INTERNAL_LANG_BUILTINS_ATTRIBUTES_SIMD_LENGTH_HEADER | ||
|
||
#include <occa/internal/lang/attribute.hpp> | ||
|
||
namespace occa { | ||
namespace lang { | ||
namespace attributes { | ||
|
||
class simdLength : public attribute_t { | ||
public: | ||
simdLength() = default; | ||
const std::string& name() const override; | ||
bool forStatementType(const int sType) const override; | ||
bool isValid(const attributeToken_t &attr) const override; | ||
private: | ||
static const inline std::string name_{"simd_length"}; | ||
}; | ||
|
||
} | ||
} | ||
} | ||
|
||
#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
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
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