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

Method IsAvailable

compiler/lib/KernelGen/BareMetal/Topk.cpp:11–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace BareMetal {
10
11bool TopkKernel::IsAvailable(TContext* ctx) const {
12 bool ok_dtype = ctx->getAttrOprand("operand:0").dtype == "f32" ||
13 ctx->getAttrOprand("operand:0").dtype == "f16";
14 bool ok_mode = ctx->getAttrStr("mode") == "KTH_ONLY" ||
15 ctx->getAttrStr("mode") == "VALUE_IDX_SORTED" ||
16 ctx->getAttrStr("mode") == "VALUE_IDX_NOSORT";
17 return ok_dtype && ok_mode;
18}
19
20namespace {
21void get_mode_bool(bool& with_index, bool& only_kth, TContext* ctx) {

Callers

nothing calls this directly

Calls 2

getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80

Tested by

no test coverage detected