rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
rule_signature.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <rexlib/core/operation/shape_rule/shape_rule_interpreter.hpp>
6#include <rexlib/core/operation/type_rule/type_rule_interpreter.hpp>
7
8#include <rexlib/core/operation/operand_specification.hpp>
9#include <rexlib/core/operation/operation_descriptor.hpp>
10#include <rexlib/core/operation/operation_signature.hpp>
11#include <rexlib/core/span.hpp>
12
13#include <type_traits>
14
15namespace rexlib
16{
17
33template <typename ShapeRule, typename TypeRule, typename Parameters>
35 : public operation_signature
36{
37public:
38 using parameters_type = Parameters;
39
40 static_assert(
41 ShapeRule::output_count == TypeRule::output_count &&
42 ShapeRule::input_count == TypeRule::input_count,
43 "The shape rule describes a different number of operands than the "
44 "typing rule."
45 );
46
53 template <
54 typename... Args,
55 typename = typename std::enable_if<
56 std::is_constructible<Parameters, Args...>::value
57 >::type
58 >
59 explicit rule_signature(Args&&... args);
60
67
81
82 void deduce(
87
88 void accept(
93
95
97 Parameters m_parameters;
98
99 static shape_rule_interpreter get_shape_interpreter() noexcept;
100 static type_rule_interpreter get_type_interpreter() noexcept;
101};
102
103} // namespace rexlib
104
105#include "rule_signature.inl"
Container for multidimensional numeric data.
Definition array.hpp:31
Shape and data type of an operand.
Definition operand_specification.hpp:24
Describes the operand count of an operation.
Definition operation_arity.hpp:16
Immutable static description of an operation type.
Definition operation_descriptor.hpp:30
Interface deciding the shape and data type of the operands of an operation.
Definition operation_signature.hpp:31
Operation signature made of a shape rule and a typing rule.
Definition rule_signature.hpp:36
void deduce(const operation_descriptor &descriptor, span< operand_specification > canonical_outputs, span< const operand_specification > inputs) const override
Compute the output operands the inputs call for.
void check_parameters(const operation_descriptor &descriptor) const
Check the parameters against the rules.
operation_arity get_arity() const noexcept override
Get the number of output and input operands.
void accept(const operation_descriptor &descriptor, span< const operand_specification > user_outputs, span< const operand_specification > inputs) const override
Decide whether output operands supplied in advance are admissible.
const Parameters & get_parameters() const noexcept
Get the parameters of the operation instance.
rule_signature(Args &&... args)
Construct the signature by constructing its parameters.
Interpreter of a shape rule lowered to tables.
Definition shape_rule_interpreter.hpp:38
Represents a non-owning area of contiguous memory.
Definition span.hpp:99
Interpreter of a typing rule lowered to a descriptor.
Definition type_rule_interpreter.hpp:40
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
@ inputs
Bound by the input axes that name the variable.