1. Attribute

1.1. GlobalDefs

This section describes Global enum and defines of TOPS runtime API.

enum topsDeviceAttribute_t

Values:

enumerator topsDeviceAttributeClockRate

Peak clock frequency in kilohertz.

enumerator topsDeviceAttributeComputeCapabilityMajor

Major compute capability version number.

enumerator topsDeviceAttributeComputeCapabilityMinor

Minor compute capability version number.

enumerator topsDeviceAttributeMaxBlockDimX

Max block size in width.

enumerator topsDeviceAttributeMaxBlockDimY

Max block size in height.

enumerator topsDeviceAttributeMaxBlockDimZ

Max block size in depth.

enumerator topsDeviceAttributeMaxGridDimX

Max grid size in width.

enumerator topsDeviceAttributeMaxGridDimY

Max grid size in height.

enumerator topsDeviceAttributeMaxGridDimZ

Max grid size in depth.

enumerator topsDeviceAttributeMaxThreadsPerBlock

Maximum number of threads per block.

enumerator topsDeviceAttributeMultiprocessorCount

Number of multiprocessors on the device.

enumerator topsDeviceAttributeMaxSharedMemoryPerBlock

Maximum shared memory available per block in bytes.

enumerator topsDeviceAttributeEnflameSpecificBegin
enumerator topsDeviceAttributeEnflameMcChannel

Memory Control Channel count.

enum topsComputeMode

Values:

enumerator topsComputeModeDefault
enumerator topsComputeModeExclusive
enumerator topsComputeModeProhibited
enumerator topsComputeModeExclusiveProcess
enum topsMemoryAdvise

Values:

enumerator topsMemAdviseSetReadMostly

be written to

Data will mostly be read and only occasionally

enumerator topsMemAdviseUnsetReadMostly

Undo the effect of topsMemAdviseSetReadMostly.

enumerator topsMemAdviseSetPreferredLocation

the specified device

Set the preferred location for the data as

enumerator topsMemAdviseUnsetPreferredLocation

Clear the preferred location for the data.

enumerator topsMemAdviseSetAccessedBy

so prevent page faults as much as possible

Data will be accessed by the specified device,

enumerator topsMemAdviseUnsetAccessedBy

for the specified device

Let TOPS to decide on the page faulting policy

enumerator topsMemAdviseSetCoarseGrain

The default memory model is fine-grain. That allows coherent operations between host and device, while executing kernels. The coarse-grain can be used for data that only needs to be coherent at dispatch boundaries for better performance

enumerator topsMemAdviseUnsetCoarseGrain

Restores cache coherency policy back to fine-grain.

enum topsMemRangeCoherencyMode

Values:

enumerator topsMemRangeCoherencyModeFineGrain

done coherently from all devices

Updates to memory with this attribute can be

enumerator topsMemRangeCoherencyModeCoarseGrain

performed by a single device at a time

Writes to memory with this attribute can be

enumerator topsMemRangeCoherencyModeIndeterminate

Memory region queried contains subregions with both topsMemRangeCoherencyModeFineGrain and topsMemRangeCoherencyModeCoarseGrain attributes

enum topsMemRangeAttribute

Values:

enumerator topsMemRangeAttributeReadMostly

only occasionally be written to

Whether the range will mostly be read and

enumerator topsMemRangeAttributePreferredLocation

The preferred location of the range.

enumerator topsMemRangeAttributeAccessedBy

set for the specified device

Memory range has topsMemAdviseSetAccessedBy

enumerator topsMemRangeAttributeLastPrefetchLocation

prefetched

The last location to where the range was

enumerator topsMemRangeAttributeCoherencyMode

topsMemRangeCoherencyMode for the range

Returns coherency mode

enum topsMemPoolAttr

Values:

enumerator topsMemPoolReuseFollowEventDependencies

(value type = int) Allow topsMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering dependency of the allocating stream on the free action exists. tops events and null stream interactions can create the required stream ordered dependencies. (default enabled)

enumerator topsMemPoolReuseAllowOpportunistic

(value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled)

enumerator topsMemPoolReuseAllowInternalDependencies

(value type = int) Allow topsMemAllocAsync to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by cuFreeAsync (default enabled).

enumerator topsMemPoolAttrReleaseThreshold

(value type = uint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0)

enumerator topsMemPoolAttrReservedMemCurrent

(value type = uint64_t) Amount of backing memory currently allocated for the mempool.

enumerator topsMemPoolAttrReservedMemHigh

(value type = uint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset. High watermark can only be reset to zero.

enumerator topsMemPoolAttrUsedMemCurrent

(value type = uint64_t) Amount of memory from the pool that is currently in use by the application.

enumerator topsMemPoolAttrUsedMemHigh

(value type = uint64_t) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset. High watermark can only be reset to zero.

enum topsMemLocationType

Values:

enumerator topsMemLocationTypeInvalid
enumerator topsMemLocationTypeDevice

Device location, thus it’s TOPS device ID.

enum topsMemAccessFlags

Values:

enumerator topsMemAccessFlagsProtNone

Default, make the address range not accessible.

enumerator topsMemAccessFlagsProtRead

Set the address range read accessible.

enumerator topsMemAccessFlagsProtReadWrite

Set the address range read-write accessible.

enum topsMemAllocationType

Values:

enumerator topsMemAllocationTypeInvalid
enumerator topsMemAllocationTypePinned

This allocation type is ‘pinned’, i.e. cannot migrate from its current location while the application is actively using it

enumerator topsMemAllocationTypeMax
enum topsMemAllocationHandleType

Values:

enumerator topsMemHandleTypeNone

Does not allow any export mechanism.

enumerator topsMemHandleTypePosixFileDescriptor

Allows a file descriptor for exporting. Permitted only on POSIX systems.

enumerator topsMemHandleTypeWin32

Allows a Win32 NT handle for exporting. (HANDLE)

enumerator topsMemHandleTypeWin32Kmt

Allows a Win32 KMT handle for exporting. (D3DKMT_HANDLE)

enum topsJitOption

Values:

enumerator topsJitOptionMaxRegisters
enumerator topsJitOptionThreadsPerBlock
enumerator topsJitOptionWallTime
enumerator topsJitOptionInfoLogBuffer
enumerator topsJitOptionInfoLogBufferSizeBytes
enumerator topsJitOptionErrorLogBuffer
enumerator topsJitOptionErrorLogBufferSizeBytes
enumerator topsJitOptionOptimizationLevel
enumerator topsJitOptionTargetFromContext
enumerator topsJitOptionTarget
enumerator topsJitOptionFallbackStrategy
enumerator topsJitOptionGenerateDebugInfo
enumerator topsJitOptionLogVerbose
enumerator topsJitOptionGenerateLineInfo
enumerator topsJitOptionCacheMode
enumerator topsJitOptionSm3xOpt
enumerator topsJitOptionFastCompile
enumerator topsJitOptionNumOptions
enum topsFuncAttribute

Warning

these hints and controls are ignored.

Values:

enumerator topsFuncAttributeMaxDynamicSharedMemorySize
enumerator topsFuncAttributePreferredSharedMemoryCarveout
enumerator topsFuncAttributeMax
enum topsFuncCache_t

Warning

these hints and controls are ignored.

Values:

enumerator topsFuncCachePreferNone

no preference for shared memory or L1 (default)

enumerator topsFuncCachePreferShared

prefer larger shared memory and smaller L1 cache

enumerator topsFuncCachePreferL1

prefer larger L1 cache and smaller shared memory

enumerator topsFuncCachePreferEqual

prefer equal size L1 cache and shared memory

enum topsSharedMemConfig

Warning

these hints and controls are ignored.

Values:

enumerator topsSharedMemBankSizeDefault

The compiler selects a device-specific value for the banking.

enumerator topsSharedMemBankSizeFourByte

when adjacent threads access data 4 bytes apart.

Shared mem is banked at 4-bytes intervals and performs best

enumerator topsSharedMemBankSizeEightByte

when adjacent threads access data 4 bytes apart.

Shared mem is banked at 8-byte intervals and performs best

enum topsExternalMemoryHandleType_enum

Values:

enumerator topsExternalMemoryHandleTypeOpaqueFd
enumerator topsExternalMemoryHandleTypeOpaqueWin32
enumerator topsExternalMemoryHandleTypeOpaqueWin32Kmt
enumerator topsExternalMemoryHandleTypeD3D12Heap
enumerator topsExternalMemoryHandleTypeD3D12Resource
enumerator topsExternalMemoryHandleTypeD3D11Resource
enumerator topsExternalMemoryHandleTypeD3D11ResourceKmt
enum topsExternalSemaphoreHandleType_enum

Values:

enumerator topsExternalSemaphoreHandleTypeOpaqueFd
enumerator topsExternalSemaphoreHandleTypeOpaqueWin32
enumerator topsExternalSemaphoreHandleTypeOpaqueWin32Kmt
enumerator topsExternalSemaphoreHandleTypeD3D12Fence
enum topsGLDeviceList

Values:

enumerator topsGLDeviceListAll

All tops devices used by current OpenGL context.

enumerator topsGLDeviceListCurrentFrame

frame

Tops devices used by current OpenGL context in current

enumerator topsGLDeviceListNextFrame

frame.

Tops devices used by current OpenGL context in next

enum __TOPS_NODISCARD topsError_t topsError_t
typedef enum topsDeviceAttribute_t topsDeviceAttribute_t
typedef enum topsMemoryAdvise topsMemoryAdvise
typedef enum topsMemRangeCoherencyMode topsMemRangeCoherencyMode
typedef enum topsMemRangeAttribute topsMemRangeAttribute
typedef enum topsMemPoolAttr topsMemPoolAttr
typedef enum topsMemLocationType topsMemLocationType
typedef struct topsMemLocation topsMemLocation

Specifies a memory location.

To specify a gpu, set type = topsMemLocationTypeDevice and set id = the gpu’s device ID

typedef enum topsMemAccessFlags topsMemAccessFlags
typedef struct topsMemAccessDesc topsMemAccessDesc

Memory access descriptor

typedef enum topsMemAllocationType topsMemAllocationType
typedef enum topsMemAllocationHandleType topsMemAllocationHandleType
typedef struct topsMemPoolProps topsMemPoolProps

Specifies the properties of allocations made from the pool.

typedef struct topsMemPoolPtrExportData topsMemPoolPtrExportData

Opaque data structure for exporting a pool allocation

typedef enum topsJitOption topsJitOption
typedef enum topsFuncAttribute topsFuncAttribute

Warning

these hints and controls are ignored.

typedef enum topsFuncCache_t topsFuncCache_t

Warning

these hints and controls are ignored.

typedef enum topsSharedMemConfig topsSharedMemConfig

Warning

these hints and controls are ignored.

typedef struct dim3 dim3
typedef struct topsLaunchParams_t topsLaunchParams
typedef enum topsExternalMemoryHandleType_enum topsExternalMemoryHandleType
typedef struct topsExternalMemoryHandleDesc_st topsExternalMemoryHandleDesc
typedef struct topsExternalMemoryBufferDesc_st topsExternalMemoryBufferDesc
typedef void *topsExternalMemory_t
typedef enum topsExternalSemaphoreHandleType_enum topsExternalSemaphoreHandleType
typedef struct topsExternalSemaphoreHandleDesc_st topsExternalSemaphoreHandleDesc
typedef void *topsExternalSemaphore_t
typedef struct topsExternalSemaphoreSignalParams_st topsExternalSemaphoreSignalParams
typedef struct topsExternalSemaphoreWaitParams_st topsExternalSemaphoreWaitParams

External semaphore wait parameters, compatible with driver type

typedef enum topsGLDeviceList topsGLDeviceList
typedef struct _topsGraphicsResource topsGraphicsResource
typedef topsGraphicsResource *topsGraphicsResource_t
__TOPS_NODISCARD
topsStreamDefault

Default stream creation flags. These are used with topsStreamCreate().

topsStreamNonBlocking

Stream does not implicitly synchronize with null stream.

topsStreamCallbackBlocking
topsStreamNonMerging
topsEventDefault

Default flags.

topsEventBlockingSync

Waiting will yield CPU. Power-friendly and usage-friendly but may increase latency.

topsEventDisableTiming

Disable event’s capability to record timing information. May improve performance.

topsEventInterprocess

Event can support IPC. Warning: It is not supported in TOPS.

topsEventRecordOnce

Event can only support record once. NOTE: tops extern

topsEventStrongOrder

Event can only support strong order. NOTE: tops extern

topsEventDisableQueryAndSync

Disable event query/sync operation.

topsEventReleaseToDevice

Use a device-scope release when recording this event. This flag is useful to obtain more precise timings of commands between events.

topsEventReleaseToSystem

Use a system-scope release when recording this event. This flag is useful to make non-coherent host memory visible to the host.

topsHostMallocDefault

Default pinned memory allocation on the host.

topsHostMallocPortable

Memory is considered allocated by all contexts.

topsHostMallocMapped

Map the allocation into the address space for the current device. The device pointer can be obtained with topsHostGetDevicePointer.

topsHostMallocWriteCombined

Allocates the memory as write-combined. On some system configurations, write-combined allocation may be transferred faster across the PCI Express bus, however, could have low read efficiency by most CPUs. It’s a good option for data transfer from host to device via mapped pinned memory.

topsHostMallocNumaUser

Host memory allocation will follow numa policy set by user.

topsHostMallocCoherent

Allocate coherent memory. Overrides TOPS_COHERENT_HOST_ALLOC for specific allocation.

topsHostMallocNonCoherent

Allocate non-coherent memory. Overrides TOPS_COHERENT_HOST_ALLOC for specific allocation.

topsMemAttachGlobal

Memory can be accessed by any stream on any device

topsMemAttachHost

Memory cannot be accessed by any stream on any device.

topsMemAttachSingle

Memory can only be accessed by a single stream on the associated device.

topsDeviceMallocDefault
topsDeviceMallocFinegrained

Memory is allocated in fine grained region of device.

topsMallocSignalMemory

Memory represents a HSA signal.

topsMallocTopDown

Memory allocation from top to down.

topsMallocForbidMergeMove

Memory allocation with forbidden to do fragment.

topsMallocPreferHighSpeedMem

Memory allocation prefer to be allocated on high speed mem, if it can not be satisfied, then allocate on global device memory.

topsMallocHostAccessable

Memory allocation host accessable.

topsHostRegisterDefault

Memory is Mapped and Portable.

topsHostRegisterPortable

Memory is considered registered by all contexts.

topsHostRegisterMapped

Map the allocation into the address space for the current device. The device pointer can be obtained with topsHostGetDevicePointer.

topsHostRegisterIoMemory

Not supported.

topsExtHostRegisterCoarseGrained

Coarse Grained host memory lock.

topsDeviceScheduleAuto

Automatically select between Spin and Yield.

topsDeviceScheduleSpin

Dedicate a CPU core to spin-wait. Provides lowest latency, but burns a CPU core and may consume more power.

topsDeviceScheduleYield

Yield the CPU to the operating system when waiting. May increase latency, but lowers power and is friendlier to other threads in the system.

topsDeviceScheduleBlockingSync
topsDeviceScheduleMask
topsDeviceMapHost
topsDeviceLmemResizeToMax
topsArrayDefault

Default TOPS array allocation flag.

topsArrayLayered
topsArraySurfaceLoadStore
topsArrayCubemap
topsArrayTextureGather
topsOccupancyDefault
topsCooperativeLaunchMultiDeviceNoPreSync
topsCooperativeLaunchMultiDeviceNoPostSync
topsCpuDeviceId
topsInvalidDeviceId
topsExtAnyOrderLaunch

AnyOrderLaunch of kernels.

topsStreamWaitValueGte
topsStreamWaitValueEq
topsStreamWaitValueAnd
topsStreamWaitValueNor
topsStreamPerThread

Implicit stream per application thread.

struct itopsStream_t
struct itopsEvent_t
struct itopsExecutable_t
struct itopsResource_t
struct itopsCtx_t
struct itopsTensor_t
struct topsMemLocation
#include <tops_runtime_api.h>

Specifies a memory location.

To specify a gpu, set type = topsMemLocationTypeDevice and set id = the gpu’s device ID

struct topsMemAccessDesc
#include <tops_runtime_api.h>

Memory access descriptor

struct topsMemPoolProps
#include <tops_runtime_api.h>

Specifies the properties of allocations made from the pool.

struct topsMemPoolPtrExportData
#include <tops_runtime_api.h>

Opaque data structure for exporting a pool allocation

union uint3
#include <tops_runtime_api.h>

Struct for data in 3D

Public Members

uint32_t x
uint32_t y
uint32_t z
struct uint3::[anonymous] [anonymous]
uint32_t data[3]
struct dim3
struct topsLaunchParams_t
struct topsExternalMemoryHandleDesc_st
struct topsExternalMemoryBufferDesc_st
struct topsExternalSemaphoreHandleDesc_st
struct topsExternalSemaphoreSignalParams_st
struct topsExternalSemaphoreWaitParams_st
#include <tops_runtime_api.h>

External semaphore wait parameters, compatible with driver type

1.2. GlobalDefsExt

This section describes Ext Global enum and defines of TOPS runtime API.

enum topsResLocMode

Values:

enumerator TOPS_RES_LOC__SAME
enumerator TOPS_RES_LOC__DIST
enum topsHbmPolicy

Values:

enumerator TOPS_HBM_POLICY__BEST_FIT
enumerator TOPS_HBM_POLICY__AFFINITY_ONLY
enumerator TOPS_HBM_POLICY__NONE
enum topsResBundlMode

Values:

enumerator TOPS_RES_BUNDLE_MODE__UNKNOWN
enumerator TOPS_RES_BUNDLE_MODE__DEVICE
enumerator TOPS_RES_BUNDLE_MODE__CLUSTER
enumerator TOPS_RES_BUNDLE_MODE__VG
enumerator TOPS_RES_BUNDLE_MODE__PG
enumerator TOPS_RES_BUNDLE_MODE__USER
enum topsExecutableInfoType

topsExecutableInfoType types

Values:

enumerator topsExecutableInfoInputCount
enumerator topsExecutableInfoOutputCount
enumerator topsExecutableInfoInputSizeList
enumerator topsExecutableInfoOutputSizeList
enumerator topsExecutableInfoInputRank
enumerator topsExecutableInfoInputDimsList
enumerator topsExecutableInfoOutputRank
enumerator topsExecutableInfoOutputDimsList
enumerator topsExecutableInfoInputDataTypeList
enumerator topsExecutableInfoOutputDataTypeList
enumerator topsExecutableInfoTensorTableSize
enumerator topsExecutableInfoInputMinDimsList
enumerator topsExecutableInfoInputMaxDimsList
enumerator topsExecutableInfoOutputMaxDimsList
enumerator topsExecutableInfoBlockCount
enumerator topsExecutableInfoInputBankList
enumerator topsExecutableInfoOutputBankList
enumerator topsExecutableInfoThreadNumberPerBlock
enum topsResourceBundleInfoType

topsResourceBundleInfoType types

Values:

enumerator topsResourceBundleProcessorCount
enum class topsReduceOpType

Reduce Operation define.

Values:

enumerator REDUCE_SUM
enumerator REDUCE_PROD
enumerator REDUCE_MAX
enumerator REDUCE_MIN
enumerator REDUCE_UNKNOW
enum class topsReduceDataType

Reduce Data type define.

Values:

enumerator INT8
enumerator CHAR
enumerator UINT8
enumerator INT32
enumerator INT
enumerator UINT32
enumerator INT64
enumerator UINT64
enumerator FLOAT16
enumerator HALF
enumerator FLOAT32
enumerator FLOAT
enumerator LFLOAT64
enumerator DOUBLE
enumerator BFLOAT16
enumerator UNKNOW
enum topsExtExecutableSectionHeaderType

topsExecutable section header types

Values:

enumerator SHT_NULL_
enumerator SHT_HEADER
enumerator SHT_RESOURCE
enumerator SHT_INPUT
enumerator SHT_OUT
enumerator SHT_CONSTANT
enumerator SHT_SIPCODE
enumerator SHT_SIP_FUNC_PARAM
enumerator SHT_SIP_FUNC_PARAM_UPDATE
enumerator SHT_STREAM
enumerator SHT_PACKET
enumerator SHT_PACKET_UPDATE
enumerator SHT_CLUSTER
enumerator SHT_JITBINARY
enumerator SHT_CPU_FUNC_PARAM
enumerator SHT_CPU_FUNC_DATA
enumerator SHT_CPU_FUNCTION
enumerator SHT_PROFILE
enumerator SHT_HOST_CONST
enumerator SHT_TASK
enumerator SHT_SIP_CALLBACK
enumerator SHT_TARGET_RESOURCE
enumerator SHT_TENSOR_TABLE
enumerator SHT_KERNEL_ASSERT_INFO
enumerator SHT_RAND_STATE
enumerator SHT_HOST_PROGRAM
enumerator SHT_RODATA
enumerator SHT_MANAGED_CONSTANT
enumerator SHT_USER5
enumerator SHT_USER6
enumerator SHT_USER7
enumerator SHT_USER8
enumerator SHT_USER9
enumerator SHT_LAST_TYPE
typedef struct itopsExecutable_t *topsExecutable_t
typedef struct itopsResource_t *topsResource_t
typedef struct topsResourceBundle topsResourceBundle_t
typedef struct topsResourceRequest topsResourceRequest_t

topsResourceRequest descriptor

typedef enum topsExecutableInfoType topsExecutableInfoType_t

topsExecutableInfoType types

typedef enum topsResourceBundleInfoType topsResourceBundleInfoType_t

topsResourceBundleInfoType types

typedef struct topsKernelDescriptor topsKernelDescriptor_t
typedef struct topsExtLaunchParams topsExtLaunchParams_t

topsExtLaunchParams descriptor

typedef struct topsExtExecutableSectionInfo topsExtExecutableSectionInfo_t

topsExecutable section information

typedef enum topsExtExecutableSectionHeaderType topsExtExecutableSectionHeaderType_t

topsExecutable section header types

typedef struct topsResourceRequestV2_st topsResourceRequestV2_t

topsResourceRequestV2 descriptor

MAX_CDMA_ENGINE_NUM_ON_20
struct topsResourceBundle
struct topsResourceRequest
#include <tops_ext.h>

topsResourceRequest descriptor

struct topsKernelDescriptor
struct topsExtLaunchParams
#include <tops_ext.h>

topsExtLaunchParams descriptor

struct topsExtExecutableSectionInfo
#include <tops_ext.h>

topsExecutable section information

struct topsResourceRequestV2_st
#include <tops_ext_experimental.h>

topsResourceRequestV2 descriptor