Options
All
  • Public
  • Public/Protected
  • All
Menu

tvmjs

Index

Type aliases

FTVMArrayAlloc

FTVMArrayAlloc: (shape: Pointer, ndim: number, dtypeCode: number, dtypeBits: number, dtypeLanes: number, deviceType: number, deviceId: number, out: Pointer) => number

int TVMArrayAlloc(const tvm_index_t* shape, int ndim, int dtype_code, int dtype_bits, int dtype_lanes, int device_type, int device_id, TVMArrayHandle* out);

Type declaration

    • (shape: Pointer, ndim: number, dtypeCode: number, dtypeBits: number, dtypeLanes: number, deviceType: number, deviceId: number, out: Pointer): number
    • Parameters

      • shape: Pointer
      • ndim: number
      • dtypeCode: number
      • dtypeBits: number
      • dtypeLanes: number
      • deviceType: number
      • deviceId: number
      • out: Pointer

      Returns number

FTVMArrayCopyFromBytes

FTVMArrayCopyFromBytes: (handle: Pointer, data: Pointer, nbytes: number) => number

int TVMArrayCopyFromBytes(TVMArrayHandle handle, void* data, size_t nbytes);

Type declaration

FTVMArrayCopyFromTo

FTVMArrayCopyFromTo: (from: Pointer, to: Pointer, stream: Pointer) => number

int TVMArrayCopyFromTo(TVMArrayHandle from, TVMArrayHandle to, TVMStreamHandle stream);

Type declaration

FTVMArrayCopyToBytes

FTVMArrayCopyToBytes: (handle: Pointer, data: Pointer, nbytes: number) => number

int TVMArrayCopyToBytes(TVMArrayHandle handle, void* data, size_t nbytes);

Type declaration

FTVMArrayFree

FTVMArrayFree: (handle: Pointer) => number

int TVMArrayFree(TVMArrayHandle handle);

Type declaration

FTVMBackendPackedCFunc

FTVMBackendPackedCFunc: (argValues: Pointer, argCodes: Pointer, nargs: number, outValue: Pointer, outCode: Pointer) => number

typedef int (TVMBackendPackedCFunc)(TVMValue args, int* type_codes, int num_args, TVMValue* out_ret_value, int* out_ret_tcode);

Type declaration

FTVMCFuncSetReturn

FTVMCFuncSetReturn: (ret: Pointer, value: Pointer, typeCode: Pointer, numRet: number) => number

int TVMCFuncSetReturn(TVMRetValueHandle ret, TVMValue* value, int* type_code, int num_ret);

Type declaration

FTVMCbArgToReturn

FTVMCbArgToReturn: (value: Pointer, code: Pointer) => number

int TVMCbArgToReturn(TVMValue* value, int* code);

Type declaration

FTVMFuncCall

FTVMFuncCall: (func: Pointer, argValues: Pointer, typeCode: Pointer, nargs: number, retValue: Pointer, retCode: Pointer) => number

int TVMFuncCall(TVMFunctionHandle func, TVMValue* arg_values, int* type_codes, int num_args, TVMValue* ret_val, int* ret_type_code);

Type declaration

FTVMFuncFree

FTVMFuncFree: (func: Pointer) => number

int TVMFuncFree(TVMFunctionHandle func);

Type declaration

FTVMFuncGetGlobal

FTVMFuncGetGlobal: (name: Pointer, out: Pointer) => number

int TVMFuncGetGlobal(const char* name, TVMFunctionHandle* out);

Type declaration

FTVMFuncListGlobalNames

FTVMFuncListGlobalNames: (outSize: Pointer, outArray: Pointer) => number

int TVMFuncListGlobalNames(int* outSize, const char*** outArray);

Type declaration

FTVMFuncRegisterGlobal

FTVMFuncRegisterGlobal: (name: Pointer, f: Pointer, override: number) => number

int TVMFuncRegisterGlobal( const char* name, TVMFunctionHandle f, int override);

Type declaration

FTVMGetLastError

FTVMGetLastError: () => Pointer

const char *TVMGetLastError();

Type declaration

FTVMModFree

FTVMModFree: (mod: Pointer) => number

int TVMModFree(TVMModuleHandle mod);

Type declaration

FTVMModGetFunction

FTVMModGetFunction: (mod: Pointer, funcName: Pointer, queryImports: number, out: Pointer) => number

int TVMModGetFunction(TVMModuleHandle mod, const char* func_name, int query_imports, TVMFunctionHandle *out);

Type declaration

FTVMModImport

FTVMModImport: (mod: Pointer, dep: Pointer) => number

int TVMModImport(TVMModuleHandle mod, TVMModuleHandle dep);

Type declaration

FTVMSynchronize

FTVMSynchronize: (deviceType: number, deviceId: number, stream: Pointer) => number

int TVMSynchronize(int device_type, int device_id, TVMStreamHandle stream);

Type declaration

    • (deviceType: number, deviceId: number, stream: Pointer): number
    • Parameters

      • deviceType: number
      • deviceId: number
      • stream: Pointer

      Returns number

FTVMWasmAllocSpace

FTVMWasmAllocSpace: (size: number) => Pointer

void* TVMWasmAllocSpace(int size);

Type declaration

FTVMWasmFreeSpace

FTVMWasmFreeSpace: (ptr: Pointer) => void

void TVMWasmFreeSpace(void* data);

Type declaration

FTVMWasmFuncCreateFromCFunc

FTVMWasmFuncCreateFromCFunc: (resource: Pointer, out: Pointer) => number

int TVMWasmFuncCreateFromCFunc(void* resource_handle, TVMFunctionHandle *out);

Type declaration

FTVMWasmPackedCFunc

FTVMWasmPackedCFunc: (args: Pointer, typeCodes: Pointer, nargs: number, ret: Pointer, resourceHandle: Pointer) => number

int TVMWasmPackedCFunc(TVMValue* args, int* type_codes, int num_args, TVMRetValueHandle ret, void* resource_handle);

Type declaration

FTVMWasmPackedCFuncFinalizer

FTVMWasmPackedCFuncFinalizer: (resourceHandle: Pointer) => void

void TVMWasmPackedCFuncFinalizer(void* resource_handle);

Type declaration

    • Parameters

      Returns void

GPUPointer

GPUPointer: number

A pointer to points to the raw address space.

PackedFunc

PackedFunc: (...args: any) => any & Disposable & { _tvmPackedCell: PackedFuncCell }

Type for PackedFunc inthe TVMRuntime.

Pointer

Pointer: number

A pointer to points to the raw address space.

PtrOffset

PtrOffset: number

A pointer offset, need to add a base address to get a valid ptr.

Variables

Const RPC_MAGIC

RPC_MAGIC: 1045105 = 1045105

RPC magic header

Functions

StringToUint8Array

  • StringToUint8Array(str: string): Uint8Array
  • Convert string to Uint8array.

    Parameters

    • str: string

      The string.

    Returns Uint8Array

    The corresponding Uint8Array.

Uint8ArrayToString

  • Uint8ArrayToString(arr: Uint8Array): string
  • Convert Uint8array to string.

    Parameters

    • arr: Uint8Array

    Returns string

    The corresponding string.

assert

  • assert(condition: boolean, msg?: undefined | string): assertscondition
  • Internal assert helper

    Parameters

    • condition: boolean

      condition The condition to fail.

    • Optional msg: undefined | string

      msg The message.

    Returns assertscondition

createWebSocket

  • createWebSocket(url: string): WebSocket
  • Create a new websocket for a given URL

    Parameters

    • url: string

      The url.

    Returns WebSocket

detectGPUDevice

  • detectGPUDevice(): Promise<GPUDevice | undefined | null>
  • DetectGPU device in the environment.

    Returns Promise<GPUDevice | undefined | null>

detectLibraryProvider

  • detectLibraryProvider(importObject: Record<string, any>): LibraryProvider | undefined
  • Detect library provider from the importObject.

    Parameters

    • importObject: Record<string, any>

      The import object.

    Returns LibraryProvider | undefined

getPerformance

  • getPerformance(): Performance
  • Get performance measurement.

    Returns Performance

instantiate

  • instantiate(bufferSource: ArrayBuffer, importObject?: Record<string, any>, logger?: (msg: string) => void): Promise<Instance>
  • Asynchrously instantiate a new Instance.

    importObject can also be a LibraryProvider object, a WASI object, or an object containing wasmLibraryProvider field. We can take benefit of syslib implementations from the Emscripten by passing its generated js Module as the imports.

    Parameters

    • bufferSource: ArrayBuffer

      The source to be compiled.

    • Default value importObject: Record<string, any> = {}

      The import objects.

    • Default value logger: (msg: string) => void = console.log

      The system logger.

        • (msg: string): void
        • Parameters

          • msg: string

          Returns void

    Returns Promise<Instance>

wasmPath

  • wasmPath(): string
  • Get the path to the wasm library in nodejs.

    Returns string

    The wasm path.

Object literals

Const DLDataTypeCodeToStr

DLDataTypeCodeToStr: object

0

0: string = "int"

1

1: string = "uint"

2

2: string = "float"

3

3: string = "handle"

Const DeviceEnumToStr

DeviceEnumToStr: object

1

1: string = "cpu"

15

15: string = "webgpu"

2

2: string = "cuda"

4

4: string = "opencl"

8

8: string = "metal"

Const DeviceStrToEnum

DeviceStrToEnum: object

cl

cl: number = 4

cpu

cpu: number = 1

cuda

cuda: number = 2

metal

metal: number = 8

opencl

opencl: number = 4

vulkan

vulkan: number = 7

webgpu

webgpu: number = 15

Generated using TypeDoc