12#include <nlohmann/json.hpp>
71 const nlohmann::json& desc,
72 const T& transformation,
75 { T::from_json(
builder, desc) } -> std::same_as<T>;
76 { transformation.to_json(out) } -> std::same_as<void>;
87template<
typename T,
typename Visitor>
90 return std::forward<Visitor>(
visitor).template operator()<T>();
115template<
typename Visitor>
118 if (transformation_name ==
"LoopTiling") {
120 }
else if (transformation_name ==
"MapCollapse") {
122 }
else if (transformation_name ==
"MapDelinearize") {
124 }
else if (transformation_name ==
"MultiLevelTiling") {
126 }
else if (transformation_name ==
"LoopDistribute") {
128 }
else if (transformation_name ==
"LoopInterchange") {
130 }
else if (transformation_name ==
"LocalStorage") {
132 }
else if (transformation_name ==
"SoftwarePipelining") {
134 }
else if (transformation_name ==
"TileFusion") {
136 }
else if (transformation_name ==
"TileVectorizer") {
138 }
else if (transformation_name ==
"LoopSkewing") {
140 }
else if (transformation_name ==
"LoopShift") {
142 }
else if (transformation_name ==
"LoopSplit") {
144 }
else if (transformation_name ==
"LoopParallelization") {
146 }
else if (transformation_name ==
"OMPTransform") {
148 }
else if (transformation_name ==
"LoopPeeling") {
150 }
else if (transformation_name ==
"TrivialLoopElimination") {
152 }
else if (transformation_name ==
"RedundantZeroInitElimination") {
154 }
else if (transformation_name ==
"StreamK") {
156 }
else if (transformation_name ==
"VectorizeTransform") {
158 }
else if (transformation_name ==
"UnrollTransform") {
160 }
else if (transformation_name ==
"CUDATransform") {
162 }
else if (transformation_name ==
"CUDAOffloadTransform") {
164 }
else if (transformation_name ==
"ROCMOffloadTransform") {
166 }
else if (transformation_name ==
"CUDAParallelizeNestedMap") {
168 }
else if (transformation_name ==
"ROCMTransform") {
170 }
else if (transformation_name ==
"ROCMParallelizeNestedMap") {
172 }
else if (transformation_name ==
"GPUOffloadNestedLoop") {
173 const std::string gpu_type = desc.contains(
"parameters") && desc[
"parameters"].contains(
"gpu_type")
174 ? desc[
"parameters"][
"gpu_type"].get<std::string>()
183 }
else if (transformation_name ==
"GPUConditionPropagation") {
185 }
else if (transformation_name ==
"GPUConditionPropagationScope") {
187 }
else if (transformation_name ==
"GPULoopReordering") {
189 }
else if (transformation_name ==
"EinsumLift") {
191 }
else if (transformation_name ==
"EinsumExtend") {
193 }
else if (transformation_name ==
"EinsumExpand") {
195 }
else if (transformation_name ==
"Einsum2Dot") {
197 }
else if (transformation_name ==
"Einsum2Gemm") {
199 }
else if (transformation_name ==
"FuseFMA") {
201 }
else if (transformation_name ==
"UnfuseFMA") {
203 }
else if (transformation_name ==
"QuantizeContraction") {
205 }
else if (transformation_name ==
"OzakiContraction") {
207 }
else if (transformation_name ==
"GpuMmaEinsumTransform") {
236 requires replayable_transformation_concept<T>
239 T first(T::from_json(
builder, desc));
240 nlohmann::json canonical;
241 first.to_json(canonical);
245 error_out =
"to_json() produced a schema-invalid description: " + error_out;
250 if (desc.contains(
"transformation_type") && desc.at(
"transformation_type") != canonical.at(
"transformation_type")) {
251 error_out =
"transformation_type changed across round-trip: description '" +
252 desc.at(
"transformation_type").get<std::string>() +
"' vs to_json '" +
253 canonical.at(
"transformation_type").get<std::string>() +
"'";
259 T second(T::from_json(
builder, canonical));
260 nlohmann::json canonical_again;
261 second.to_json(canonical_again);
262 if (canonical != canonical_again) {
263 error_out =
"from_json/to_json is not a stable round-trip: " + canonical.dump() +
264 " != " + canonical_again.dump();
286 if (!desc.contains(
"transformation_type") || !desc.at(
"transformation_type").is_string()) {
287 error_out =
"description is missing a string 'transformation_type'";
290 const auto transformation_name = desc.at(
"transformation_type").get<std::string>();
291 std::string local_error;
296 error_out = std::move(local_error);
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
static const std::string value()
Definition cuda.h:45
static const std::string value()
Definition rocm.h:45
Definition function_builder.h:10
Definition control_flow_node.h:16