• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Compute Graph Framework SDK Reference  5.22
    All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    Non-sequential Passes

    ‍TO BE IMPLEMENTED

    By default each pass within a node depends on the previous pass. If a node can parallelize the computation across multiple hardware engines, e.g. two CPU cores, custom inter-pass dependencies can be defined.

    ‍The functions implementing the passes which might run concurrently need to be thread-safe.

    Example

    In the following example the two passes PROCESS_EVEN and PROCESS_ODD can run in parallel to perform their work concurrently.

    dot_non_sequential_passes.png
    Example of Non-Sequential Passes

    The corresponding C++ snippet describing the passes:

    static constexpr auto describePasses()
    {
    // the first pass has no (default) dependency
    describePass("SETUP"_sv, DW_PROCESSOR_TYPE_CPU),
    // the default dependency is the previous SETUP pass
    describePass("PROCESS_EVEN"_sv, DW_PROCESSOR_TYPE_CPU),
    // the default dependency would be the PROCESS_EVEN pass which is not desired
    // hence providing a custom dependency on the SETUP pass
    describePass("PROCESS_ODD"_sv, DW_PROCESSOR_TYPE_CPU, describePassDependencies("SETUP"_sv)),
    // the default dependency would be only the PROCESS_ODD pass which is not desired
    // hence providing custom dependencies on the PROCESS_EVEN and PROCESS_ODD pass
    describePass("POSTPROCESS"_sv, DW_PROCESSOR_TYPE_CPU, describePassDependencies("PROCESS_EVEN"_sv, "PROCESS_ODD"_sv)),
    // the default dependency is the previous POSTPROCESS pass
    describePass("TEARDOWN"_sv, DW_PROCESSOR_TYPE_CPU));
    };
    constexpr PassDescriptorT< 0 > describePass(dw::core::StringView &&name, dwProcessorType processorType)
    constexpr auto describePassCollection(const Args &&... args) -> std::tuple< Args... >
    constexpr auto describePassDependencies(const Args &&... args) -> std::array< dw::core::StringView, sizeof...(Args)>

    References

    • The schema for .node.json files captures the description of custom pass dependencies under passes -> dependencies.
    • The C++ API dw::framework::describePass() has an optional parameter to define custom inter-pass dependencies.
    人人超碰97caoporen国产