Skip to main content

DetessCast.h File

DetessCast Node — fused CVU kernel that detessellates and casts BF16→FP32. More...

Included Headers

#include "builder/Node.h" #include "builder/NodeContractConfigurable.h" #include "builder/NodeContractProvider.h" #include "builder/OutputSpec.h" #include <nlohmann/json.hpp> #include <memory> #include <optional> #include <string> #include <vector>

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

structDetessCastOptions

Construction options for a DetessCast Node. More...

classDetessCast

Fused CVU kernel Node: Detess followed by Cast (BF16→FP32). More...

Description

DetessCast Node — fused CVU kernel that detessellates and casts BF16→FP32.

Combines an MLA-layout untessellate with a BF16→FP32 cast in a single CVU pass. Inserted after MLA stages on the BF16 output path when downstream wants natural HWC/CHW float tensors — fusing the two stages saves a DDR round-trip versus running Detess then Cast.

See Also

"The dtype contract" page in /concepts/dtype_contract

File Listing

The file content with the documentation metadata removed is:

1
12#pragma once
13
14#include "builder/Node.h"
15#include "builder/NodeContractConfigurable.h"
16#include "builder/NodeContractProvider.h"
17#include "builder/OutputSpec.h"
18
19#include <nlohmann/json.hpp>
20
21#include <memory>
22#include <optional>
23#include <string>
24#include <vector>
25
26namespace simaai::neat {
27class Model;
28struct CompiledProcessCvuContract;
29
37 DetessCastOptions() = default;
39 explicit DetessCastOptions(const simaai::neat::Model& model);
40
41 std::string config_path;
42 std::optional<nlohmann::json>
44 std::string upstream_name;
45 std::string element_name;
46 std::shared_ptr<const CompiledProcessCvuContract>
48 int num_buffers = 0;
50 bool num_buffers_locked = false;
51};
52
64class DetessCast final : public Node,
65 public NodeContractProvider,
66 public NodeContractConfigurable,
67 public OutputSpecProvider {
68public:
70 explicit DetessCast(DetessCastOptions opt = {});
71 struct ConfigHolder;
72
74 std::string kind() const override {
75 return "DetessCast";
76 }
78 NodeCapsBehavior caps_behavior() const override {
79 return NodeCapsBehavior::Static;
80 }
84 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
85 std::string* err) const override;
87 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
89 std::string backend_fragment(int node_index) const override;
91 std::vector<std::string> element_names(int node_index) const override;
93 OutputSpec output_spec(const OutputSpec& input) const override;
94
96 const nlohmann::json* config_json() const;
97
99 const DetessCastOptions& options() const {
100 return opt_;
101 }
103 const std::string& config_path() const {
104 return config_path_;
105 }
106
107#ifdef SIMA_NEAT_INTERNAL
108 const std::optional<CompiledProcessCvuContract>& compiled_contract_internal() const;
109#endif
110
111private:
113 std::shared_ptr<ConfigHolder> config_holder_;
114 std::string config_path_;
115};
116
117} // namespace simaai::neat
118
119namespace simaai::neat::nodes {
121std::shared_ptr<simaai::neat::Node> DetessCast(DetessCastOptions opt = {});
122} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.