Skip to main content

CastTess.h File

CastTess Node — fused CVU kernel that casts FP32→BF16 then tessellates. More...

Included Headers

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

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

structCastTessOptions

Construction options for a CastTess Node. More...

classCastTess

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

Description

CastTess Node — fused CVU kernel that casts FP32→BF16 then tessellates.

Combines a BF16 cast and a tessellate layout shuffle into a single CVU pass. Inserted by the route planner before the MLA when the model expects BF16 input and MLA-side tessellation is not part of the compiled MLA kernel — fusing the two stages saves a DDR round-trip versus running Cast and Tess back to back.

See Also

"The dtype contract" page in /concepts/dtype_contract

File Listing

The file content with the documentation metadata removed is:

1
13#pragma once
14
15#include "builder/Node.h"
16#include "builder/NodeContractConfigurable.h"
17#include "builder/NodeContractProvider.h"
18#ifdef SIMA_NEAT_INTERNAL
19#include "model/internal/ModelRouteRetarget.h"
20#endif
21
22#include <nlohmann/json.hpp>
23
24#include <memory>
25#include <optional>
26#include <string>
27#include <vector>
28
29namespace simaai::neat {
30class Model;
31struct CompiledProcessCvuContract;
32
40 CastTessOptions() = default;
42 explicit CastTessOptions(const simaai::neat::Model& model);
43
44 std::string config_path;
45 std::optional<nlohmann::json>
47 std::string element_name;
48 std::shared_ptr<const CompiledProcessCvuContract>
50 int num_buffers = 0;
52 bool num_buffers_locked = false;
53#ifdef SIMA_NEAT_INTERNAL
54 std::shared_ptr<const simaai::neat::internal::ModelLineageBinding> model_lineage;
55#endif
56};
57
69class CastTess final : public Node, public NodeContractProvider, public NodeContractConfigurable {
70public:
72 explicit CastTess(CastTessOptions opt = {});
73 struct ConfigHolder;
74
76 std::string kind() const override {
77 return "CastTess";
78 }
80 NodeCapsBehavior caps_behavior() const override {
81 return NodeCapsBehavior::Static;
82 }
86 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
87 std::string* err) const override;
89 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
91 std::string backend_fragment(int node_index) const override;
93 std::vector<std::string> element_names(int node_index) const override;
94
96 const nlohmann::json* config_json() const;
97
99 const CastTessOptions& 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:
112 CastTessOptions opt_;
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> CastTess(CastTessOptions opt = {});
122} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.