• Diego Caballero's avatar
    [Standalone] Decouple MKLDNN primitive build from code generation (#2701) · 14a2aeae
    Diego Caballero authored
    * [Standalone] Decouple MKLDNN primitive build from code generation
    
    This patch introduces a new pass, MKLDNNPrimitiveBuildPass, which
    iterates over all the ops assigned to MKLDNN and builds their
    corresponding primitives. Primitive indexes are stored in MKLDNNEmitter
    and can easily be retrieved with the get_primitive_index(node)
    interface. This decouples the creation of primitives from codegen and
    fixes the problem of MKLDNN primitives being created twice
    (CommonFunctionCollection pass and codegen).
    
    Current assertions only allow the creation of a single primitive per
    node but it should be simple to remove this when needed. Using a pass
    might not be the best approach here but I found it convenient for the
    current needs and it should be straightforward to convert into a utility,
    if needed.
    
    These changes caused a conflict with recently introduced
    'build_quantized_inner_product*'. These new build methods will be ported
    in a follow up patch to new build approach.
    
    * Remove unrelated comment
    
    * Remove TensorView code
    
    * Set m_node_primitive_map from MKLDNNPrimitiveBuildPass
    
    * Move node->primitive map from mkldnn pass to external function
    
    * Fix struct/class inconsistency en fw declaration
    14a2aeae
cpu_emitter.cpp 190 KB