template.def
← template dialect
Constraint-matched bodyful implementation of a template family.
Operation contract
| Property |
Value |
| Semantic phase |
— |
| Traits |
SymbolDefine, IsolatedFromAbove |
| Interfaces |
FuncLike |
Symbol contract
| Property |
Value |
| Kind |
template implementation |
| Defining field |
implementation |
| Interfaces |
func_like, template_provider |
| Flags |
— |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Result |
results |
any |
variadic |
— |
| Attribute |
family |
symbol (template_family) |
required |
— |
| Attribute |
implementation |
symbol |
required |
— |
| Attribute |
visibility |
enum Visibility |
optional |
— |
| Attribute |
cc |
enum CallingConv |
optional |
— |
| Attribute |
purity |
enum Purity |
optional |
— |
| Attribute |
temperature |
enum Temperature |
optional |
— |
| Attribute |
predicates |
predicate_list |
optional |
— |
| Attribute |
target |
symbol (target) |
optional |
— |
| Attribute |
requires |
parameterized_array |
optional |
Typed proof requirements over application-site target facts. Requirements filter eligibility and never add facts. |
| Attribute |
priority |
i64 |
optional |
— |
| Attribute |
retain |
enum Retain |
optional |
— |
| Region |
body |
region |
required |
Template implementation body. (terminator template.return.) |
Examples
template.def<@vector_transform> device priority(20) @vector_transform_fast(%value: vector<32xf32>) -> (vector<32xf32>) {
template.return %value : vector<32xf32>
}
template.def<@wave32_transform> requires [#target.subgroup.size<32>] @wave32_transform_impl(%value: vector<32xf32>) -> (vector<32xf32>) {
template.return %value : vector<32xf32>
}