// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "paddle/cinn/adt/equation_function.h" namespace cinn::adt { std::string GetFunctionTypeName(const Function& function) { return function >> match{ [&](const Identity, tIn>& identity) { return "Identity"; }, [&](const Identity, tIn>& identity) { return "Identity"; }, [&](const IndexDot, tOut, tIn>>& dot) { return "IndexDot"; }, [&](const GetBroadcastedIterator, tIn>& broadcast) { return "GetBroadcastedIterator"; }, [&](const IndexUnDot, tOut>, tIn>& undot) { return "IndexUnDot"; }, [&](const InMsg2OutMsg, tOut>>, tIn>>& in_msg2out_msg) { return "InMsg2OutMsg"; }, [&](const ConstantFunction, tIn>& constant_function) { return "ConstantFunction"; }, }; } const void* GetFunctionDataPtr(const Function& function) { return function >> match{ [&](const Identity, tIn>& identity) -> const void* { return &identity.tuple(); }, [&](const Identity, tIn>& identity) -> const void* { return &identity.tuple(); }, [&](const IndexDot, tOut, tIn>>& dot) -> const void* { return &dot.tuple(); }, [&](const GetBroadcastedIterator, tIn>& broadcast) -> const void* { return &broadcast.tuple(); }, [&](const IndexUnDot, tOut>, tIn>& undot) -> const void* { return &undot.tuple(); }, [&](const InMsg2OutMsg, tOut>>, tIn>>& in_msg2out_msg) -> const void* { return &in_msg2out_msg.tuple(); }, [&](const ConstantFunction, tIn>& constant_function) -> const void* { return &constant_function.tuple(); }, }; } } // namespace cinn::adt