MCPcopy Create free account
hub / github.com/MegEngine/MegCC / IsAvailable

Method IsAvailable

compiler/lib/KernelGen/BareMetal/Relayout.cpp:13–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace BareMetal;
12
13bool RelayoutKernel::IsAvailable(TContext* context) const {
14 bool ok_dtype = context->getAttrOprand("operand:0").dtype ==
15 context->getAttrOprand("operand:1").dtype;
16 std::vector<size_t> shape_in = context->getAttrOprand("operand:0").shape;
17 std::vector<size_t> shape_out = context->getAttrOprand("operand:0").shape;
18 bool ok_shape = shape_in.size() == shape_out.size();
19 for (size_t i = 0; ok_shape && i < shape_in.size(); ++i) {
20 ok_shape = ok_shape && shape_in.at(i) == shape_out.at(i);
21 }
22 return ok_dtype && ok_shape;
23}
24
25//! kernel gen
26std::string RelayoutKernel::GetKernelSymbol(TContext* context) const {

Callers

nothing calls this directly

Calls 1

getAttrOprandMethod · 0.80

Tested by

no test coverage detected