• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • System Task Manager SDK Reference  5.10
    All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
    stm.h
    Go to the documentation of this file.
    1
    2//
    3// Notice
    4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
    5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
    6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
    7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
    8//
    9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
    10// information or for any infringement of patents or other rights of third parties that may
    11// result from its use. No license is granted by implication or otherwise under any patent
    12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
    13// expressly authorized by NVIDIA. Details are subject to change without notice.
    14// This code supersedes and replaces all information previously supplied.
    15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
    16// components in life support devices or systems without express written approval of
    17// NVIDIA CORPORATION & AFFILIATES.
    18//
    19// SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
    21//
    22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
    23// property and proprietary rights in and to this material, related
    24// documentation and any modifications thereto. Any use, reproduction,
    25// disclosure or distribution of this material and related documentation
    26// without an express license agreement from NVIDIA CORPORATION or
    27// its affiliates is strictly prohibited.
    28//
    30
    50#ifndef STM_H_
    51#define STM_H_
    52
    53#if __GNUC__ >= 4
    54#define STM_API __attribute__((visibility("default")))
    55#endif
    56
    57#include <stdint.h>
    58#include "stm_error.h"
    59#include <cuda_runtime.h>
    60#include <stdbool.h>
    61
    62#ifdef VIBRANTE
    63#if VIBRANTE_PDK_DECIMAL < 6000400
    64#include <nvmedia_dla.h>
    65#endif
    66#if VIBRANTE_PDK_DECIMAL >= 6000000
    67#include <cupva_host_wrapper.h>
    68#endif
    69
    70#endif
    71
    72#ifdef __cplusplus
    73extern "C" {
    74#endif
    75
    79typedef struct
    80{
    82 uint16_t scheduleId;
    84
    91typedef void (*stmRunnable_t)(void* userdata);
    92
    104typedef void (*stmCudaSubmitter_t)(void* userdata, cudaStream_t stream);
    105
    112STM_API void stmClientInit(const char* clientName);
    113
    121STM_API void stmClientInitWithDiscriminator(const char* clientName, int32_t discriminator);
    122
    132STM_API stmErrorCode_t stmRegisterCpuRunnable(stmRunnable_t func, const char* const runnableId, void* userdata);
    133
    143STM_API stmErrorCode_t stmRegisterCudaSubmitter(stmCudaSubmitter_t func, const char* const runnableId, void* userdata);
    144
    157STM_API stmErrorCode_t stmRegisterCudaResource(const char* resourceName, cudaStream_t stream);
    158
    159#ifdef VIBRANTE
    160#if VIBRANTE_PDK_DECIMAL < 6000400
    171typedef void (*stmDlaSubmitter_t)(void* userdata, NvMediaDla* dla);
    172#endif
    173
    174#if VIBRANTE_PDK_DECIMAL >= 6000200
    186typedef void (*stmCuDlaSubmitter_t)(void* userdata, cudaStream_t cudla);
    187#endif
    188
    189#if VIBRANTE_PDK_DECIMAL >= 6000000
    201typedef void (*stmVpuSubmitter_t)(void* userdata, cupvaStream_t vpu);
    202#endif
    203
    204#if VIBRANTE_PDK_DECIMAL < 6000400
    218STM_API stmErrorCode_t stmRegisterDlaResource(const char* resourceName, NvMediaDla* dla);
    219#endif
    220
    221#if VIBRANTE_PDK_DECIMAL >= 6000200
    237STM_API stmErrorCode_t stmRegisterCuDlaResource(const char* resourceName, cudaStream_t cudla);
    238#endif
    239
    240#if VIBRANTE_PDK_DECIMAL >= 6000000
    256STM_API stmErrorCode_t stmRegisterVpuResource(const char* resourceName, cupvaStream_t vpu);
    257#endif
    258
    259#if VIBRANTE_PDK_DECIMAL < 6000400
    270STM_API stmErrorCode_t stmRegisterDlaSubmitter(stmDlaSubmitter_t func, const char* const runnableId, void* userdata);
    271#endif
    272
    273#if VIBRANTE_PDK_DECIMAL >= 6000200
    286STM_API stmErrorCode_t stmRegisterCuDlaSubmitter(stmCuDlaSubmitter_t func, const char* const runnableId, void* userdata);
    287#endif
    288
    289#if VIBRANTE_PDK_DECIMAL >= 6000000
    302STM_API stmErrorCode_t stmRegisterVpuSubmitter(stmVpuSubmitter_t func, const char* const runnableId, void* userdata);
    303#endif
    304#endif
    305
    321
    335
    345
    351STM_API void stmClientExit(void);
    352
    353#ifdef __cplusplus
    354}
    355#endif
    356
    357#endif
    STM_API void stmClientInit(const char *clientName)
    Initialize STM client context.
    STM_API stmErrorCode_t stmEnterScheduler(void)
    Yield to STM scheduler, which will schedule all registered runnables in the STM schedule periodically...
    STM_API stmErrorCode_t stmRegisterVpuSubmitter(stmVpuSubmitter_t func, const char *const runnableId, void *userdata)
    Registers an stmVpuSubmitter_t function with the name provided by the user to the STM compiler.
    void(* stmRunnable_t)(void *userdata)
    Function signature for STM CPU runnable.
    Definition: stm.h:91
    STM_API stmErrorCode_t stmRegisterCuDlaResource(const char *resourceName, cudaStream_t cudla)
    Registers a cuDLA resource.
    uint32_t epochIterations
    Definition: stm.h:81
    STM_API stmErrorCode_t stmRegisterVpuResource(const char *resourceName, cupvaStream_t vpu)
    Registers a cuPVA resource.
    STM_API stmErrorCode_t stmGetRuntimeInfo(stmRunnableInfo_t *info)
    Get runtime information about execution.
    void(* stmVpuSubmitter_t)(void *userdata, cupvaStream_t vpu)
    Function signature for STM VPU submitter runnable.
    Definition: stm.h:201
    void(* stmCuDlaSubmitter_t)(void *userdata, cudaStream_t cudla)
    Function signature for STM cuDLA submitter runnable.
    Definition: stm.h:186
    STM_API stmErrorCode_t stmRegisterCudaResource(const char *resourceName, cudaStream_t stream)
    Registers a CUDA stream resource.
    STM_API void stmClientExit(void)
    Cleans up STM client context. No STM APIs can be called after this.
    STM_API stmErrorCode_t stmRegisterCuDlaSubmitter(stmCuDlaSubmitter_t func, const char *const runnableId, void *userdata)
    Registers an stmCudlaSubmitter_t function with the name provided by the user to the STM compiler.
    uint16_t scheduleId
    Definition: stm.h:82
    STM_API void stmClientInitWithDiscriminator(const char *clientName, int32_t discriminator)
    Initialize STM client context with a discriminator.
    STM_API stmErrorCode_t stmRegisterCpuRunnable(stmRunnable_t func, const char *const runnableId, void *userdata)
    Registers an stmRunnable_t function with the name provided by the user to the STM compiler.
    STM_API stmErrorCode_t stmRegisterCudaSubmitter(stmCudaSubmitter_t func, const char *const runnableId, void *userdata)
    Registers an stmCudaSubmitter_t function with the name provided by the user to the STM compiler.
    void(* stmCudaSubmitter_t)(void *userdata, cudaStream_t stream)
    Function signature for STM CUDA submitter runnable.
    Definition: stm.h:104
    STM_API stmErrorCode_t stmExitScheduler(void)
    Return from stmEnterScheduler().
    Information which can be queried by CPU runnables using stmGetRuntimeInfo()
    Definition: stm.h:80
    Return/error codes for all STM functions.
    stmErrorCode_t
    Return/error codes for all STM functions.
    Definition: stm_error.h:47
    人人超碰97caoporen国产