cupva_host_mem_alloc.h#

Fully qualified name: src/host/c_api/include/detail/scheduling/cupva_host_mem_alloc.h

File members: src/host/c_api/include/detail/scheduling/cupva_host_mem_alloc.h

/*
 * SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */
#ifndef CUPVA_HOST_MEM_ALLOC_H
#define CUPVA_HOST_MEM_ALLOC_H

#include <detail/scheduling/cupva_host_types_scheduling.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum
{
    CUPVA_MEM_ACCESS_TYPE_INVALID = 0,
    CUPVA_READ,
    CUPVA_WRITE,
    CUPVA_READ_WRITE,
    CUPVA_MEM_ACCESS_TYPE_MAX
} cupvaMemAccessType_t;

typedef enum
{
    CUPVA_MEM_ALLOC_TYPE_INVALID = 0,
    CUPVA_ALLOC_DRAM,
    CUPVA_ALLOC_CVSRAM,
    CUPVA_MEM_ALLOC_TYPE_MAX
} cupvaMemAllocType_t;

typedef enum
{
    CUPVA_L2SRAM_POLICY_INVALID = 0,
    CUPVA_L2SRAM_POLICY_FILL,
    CUPVA_L2SRAM_POLICY_FLUSH,
    CUPVA_L2SRAM_POLICY_FILL_AND_FLUSH,
    CUPVA_L2SRAM_POLICY_MAX
} cupvaL2SRAMPolicyType_t;

typedef enum
{
    CUPVA_EXTERNAL_ALLOC_TYPE_INVALID = 0,
    CUPVA_EXTERNAL_ALLOC_TYPE_CUDA,
    CUPVA_EXTERNAL_ALLOC_TYPE_HOST,
    CUPVA_EXTERNAL_ALLOC_TYPE_MAX
} cupvaMemExternalAllocType_t;

DLL_EXPORT cupvaError_t CupvaMemAlloc(void **const devPtr, int64_t const size, cupvaMemAccessType_t const accessType,
                                      cupvaMemAllocType_t const allocType);

DLL_EXPORT cupvaError_t CupvaMemFree(void *const devicePtr);

DLL_EXPORT cupvaError_t CupvaMemGetHostPointer(void **const hostPtr, void *const devicePtr);

DLL_EXPORT cupvaError_t CupvaMemRegister(const void *const ptr, int64_t const size,
                                         cupvaMemExternalAllocType_t const externalAllocType);
DLL_EXPORT cupvaError_t CupvaMemUnregister(const void *const ptr);

DLL_EXPORT cupvaError_t CupvaMapL2(void **const l2Ptr, void *const dramPtr, int64_t const size,
                                   cupvaL2SRAMPolicyType_t const policy);
#ifdef __cplusplus
}
#endif

#endif