MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / JITPlaceholder

Method JITPlaceholder

src/jit/impl/placeholder_opr.cpp:13–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11MGB_DYN_TYPE_OBJ_FINAL_IMPL(JITPlaceholder);
12
13JITPlaceholder::JITPlaceholder(VarNode* src_var, size_t id, InpType inp_type)
14 : Super(src_var->owner_graph(), {}, ssprintf("JITPlaceholder@%zu", id), {}),
15 m_inp_type{inp_type},
16 m_id{id} {
17 mgb_assert(
18 src_var->dtype().category() == DTypeCategory::FLOAT ||
19 src_var->dtype().category() == DTypeCategory::INT,
20 "JIT can only be applied to float/int operators, got %s",
21 src_var->dtype().name());
22 add_equivalence_component<ScalarHash<DTypeEnum>>(src_var->dtype().enumv());
23 add_equivalence_component<ScalarHash<InpType>>(m_inp_type);
24 add_equivalence_component<ScalarHash<size_t>>(m_id);
25 if (m_inp_type == InpType::HOST_VALUE_FOR_SHAPE) {
26 mgb_assert(
27 src_var->dtype() == dtype::Int32{},
28 "src dtype should be int32 for SHAPE InpType, got %s",
29 src_var->dtype().name());
30 }
31 add_output(None)->dtype(src_var->dtype());
32}
33
34void JITPlaceholder::init_output_comp_node() {
35 output(0)->comp_node(CompNode::default_cpu());

Callers

nothing calls this directly

Calls 5

categoryMethod · 0.80
owner_graphMethod · 0.45
dtypeMethod · 0.45
nameMethod · 0.45
enumvMethod · 0.45

Tested by

no test coverage detected