VGF Decoder C API
The Decoder C API is an optional C API that reads the contents of VGF files. To decode the VGF file, the decoder C API takes the VGF file as input and drives the VGF Decoder API directly. This API is a low-overhead thin C wrapper on C++ VGF Decoder API. The C linkage allows for higher ABI stability, and enables more options for additional language bindings and easier deployment or distribution of API updates. Similar to the VGF C++ Decoder API, the VGF C Decoder API has some restrictions. For example, the VGF C Decoder API makes no memory allocations. You must perform the memory allocations. The API also does not make any system calls. You must perform any required system calls, for example, loading a VGF file into memory.
Similar to the VGF C++ Decoder API, the C API uses the following execution flow in order to parse a VGF file.
The VGF file has the following sections in the order specified (see enum mlsdk_section_name
)
Each section of the VGF has its own decoder type. The memory requirement for each section decoder is retrieved by the corresponding calls, for example, function mlsdk_decoder_module_table_decoder_mem_reqs
for Module section.
Each section of the VGF has its corresponding call for creating its decoder, for example, mlsdk_decoder_create_module_table_decoder
function for Module section. Then, the created decoder reads data pertaining to that VGF section.
If the VGF file is obtained from an external source and potentially unsafe, each section has its own verifier, for example mlsdk_decoder_is_valid_module_table
.
Modules Section
mlsdk_decoder_get_module_table_num_entries
can use a module table decoder to retrieve the number of modules in a VGF file.
Currently, the modules are SPIR-V™ modules only.
You can use the following functions to retrieve module information through a module table decoder:
Name:
mlsdk_decoder_get_module_name
Type:
mlsdk_decoder_get_module_type
SPIR-V™ entry point:
mlsdk_decoder_get_module_entry_point
SPIR-V™ code:
mlsdk_decoder_get_module_code
There can be more than one module entry in the module section of a VGF. To retrieve the number of modules, you can call mlsdk_decoder_get_module_table_num_entries
.
Model Sequence Section
Each module can have one or more segments. The segments of the module have the same type as that of the module. All segments are stored in the model sequence table. To see the number of segments, you can use mlsdk_decoder_get_model_sequence_table_size
.
To retrieve the information for each segment, you can use their corresponding calls:
Name:
mlsdk_decoder_model_sequence_get_segment_name
Type:
mlsdk_decoder_model_sequence_get_segment_type
Input binding slot:
mlsdk_decoder_model_sequence_get_segment_input_binding_slot
Output binding slot:
mlsdk_decoder_model_sequence_get_segment_output_binding_slot
Descriptor binding slot:
mlsdk_decoder_model_sequence_get_segment_descriptor_binding_slot
DescriptorSet info size:
mlsdk_decoder_model_sequence_get_segment_descriptorset_info_size
Constant indexes:
mlsdk_decoder_model_sequence_get_segment_constant_indexes
Dispatch shape:
mlsdk_decoder_model_sequence_get_segment_dispatch_shape
The binding slot acts as a bridge between information on the resources used by a segment, and the resources. The resources are stored in the Model Resource Table (MRT). You can identify each resource using its MRT index. The following components of a segment have information (including MRT index) of their corresponding resource in the MRT. You can read the resources to a binding slot memory location allocated with the corresponding calls:
Segment inputs:
mlsdk_decoder_model_sequence_get_segment_input_binding_slot
Segment outputs:
mlsdk_decoder_model_sequence_get_segment_output_binding_slot
Segment descriptors:
mlsdk_decoder_model_sequence_get_segment_descriptor_binding_slot
You can use the binding slot to read:
Number of bindings of a binding slot of a segment component (inputs, outputs, descriptors):
mlsdk_decoder_binding_slot_size
Binding ids of entries in the binding slot:
mlsdk_decoder_binding_slot_binding_id
MRT indexes of entries in the binding slot:
mlsdk_decoder_binding_slot_mrt_index
Model Resource Section
This section describes the Model Resource Table (MRT). The MRT contains all the Model Resource entries of the VGF file. To find resources through their unique MRT index, you can use the MRT as a lookup table from the other sections of the VGF.
Model Constants Section
The model constants section is the largest section of a VGF file, which contains VGF constants information.
Caution
The data in the constant section is stored in raw bytes, there are no endianness checks. The target host and the host where you create the VGF must use the same endianness.
To retrieve the number of constants in a VGF file, using a constants table decoder, you can use mlsdk_decoder_get_constant_table_num_entries
.
To retrieve constant information through a module table decoder, you can use the following functions:
MRT index:
mlsdk_decoder_get_constant_table_mrt_index
Data:
mlsdk_decoder_get_constant_table_data
C Decoder API Reference
-
enum mlsdk_decoder_section
Enum for index of sections in the VGF.
Values:
-
enumerator mlsdk_decoder_section_modules
-
enumerator mlsdk_decoder_section_model_sequence
-
enumerator mlsdk_decoder_section_resources
-
enumerator mlsdk_decoder_section_constants
-
enumerator mlsdk_decoder_section_modules
-
enum mlsdk_decoder_module_type
Enum for module types.
Values:
-
enumerator mlsdk_decoder_module_type_compute
-
enumerator mlsdk_decoder_module_type_graph
-
enumerator mlsdk_decoder_module_type_compute
-
enum mlsdk_decoder_mrt_category
Enum for model resource table category.
Values:
-
enumerator mlsdk_decoder_mrt_category_input
-
enumerator mlsdk_decoder_mrt_category_output
-
enumerator mlsdk_decoder_mrt_category_intermediate
-
enumerator mlsdk_decoder_mrt_category_constant
-
enumerator mlsdk_decoder_mrt_category_input
-
typedef uint16_t mlsdk_vk_header_version
Type for VK_HEADER_VERSION.
-
typedef int32_t mlsdk_vk_descriptor_type
Type for VkDescriptorType enum.
-
typedef int32_t mlsdk_vk_format
Carrier type for VkFormat.
-
typedef struct mlsdk_decoder_binding_slots_handle_s const *mlsdk_decoder_binding_slots_handle
Handle to refer to a specific view of a bundle of binding slots.
-
typedef struct mlsdk_decoder_push_constant_ranges_handle_s const *mlsdk_decoder_push_constant_ranges_handle
Handle to refer to an array of push constant ranges.
-
mlsdk_vk_format mlsdk_vk_format_undefined()
return the value for an mlsdk_vk_format corresponding to VK_FORMAT_UNDEFINED.
-
void mlsdk_decoder_get_version(mlsdk_decoder_vgf_version *version)
Gets the library version.
- Parameters:
version -- The pointer to the struct to write the version information
-
size_t mlsdk_decoder_header_size()
Returns the size in bytes of the VGF header on disk.
- Returns:
The size in bytes of the VGF header data
-
size_t mlsdk_decoder_header_decoder_mem_reqs()
Returns the memory requirements in bytes to allocate memory for creating the header decoder.
- Returns:
The size in bytes of the memory needed to create the header decoder
-
mlsdk_decoder_header_decoder *mlsdk_decoder_create_header_decoder(const void *const headerData, void *decoderMemory)
Creates the header decoder.
- Parameters:
headerData -- The pointer to the header data
decoderMemory -- Memory allocated to be used to create the decoder
- Returns:
The pointer to the newly created decoder
-
bool mlsdk_decoder_is_header_valid(const mlsdk_decoder_header_decoder *const decoder)
Checks if the header is valid.
- Parameters:
decoder -- The header decoder associated to the header data
- Returns:
True if the parsed data is a valid VGF header, false otherwise
-
bool mlsdk_decoder_is_header_compatible(const mlsdk_decoder_header_decoder *const decoder)
Checks if the VGF file is compatible with this library version.
- Parameters:
decoder -- The header decoder associated to the header data
- Returns:
True if the VGF file is compatible with the library, false otherwise
-
void mlsdk_decoder_get_encoder_vk_header_version(const mlsdk_decoder_header_decoder *const decoder, mlsdk_vk_header_version *vkHeaderVersion)
Returns the value of VK_HEADERS_VERSION found in the VGF file.
- Parameters:
decoder -- The header decoder associated to the header data
vkHeaderVersion -- Return value of the VK_HEADERS_VERSION used while encoding the VGF
-
void mlsdk_decoder_get_header_version(const mlsdk_decoder_header_decoder *const decoder, mlsdk_decoder_vgf_version *version)
Gets the VGF file version.
- Parameters:
decoder -- The header decoder associated to the header data
version -- The pointer to the struct to write the result to
-
void mlsdk_decoder_get_header_section_info(const mlsdk_decoder_header_decoder *const decoder, mlsdk_decoder_section sectionName, mlsdk_decoder_vgf_section_info *section)
Gets the VGF file section info for the given section name.
- Parameters:
decoder -- The header decoder associated to the header data
sectionName -- Section name
section -- The pointer to the VGF section info
-
size_t mlsdk_decoder_module_table_decoder_mem_reqs()
Returns the memory requirements in bytes to allocate memory for creating the module table decoder.
- Returns:
The size in bytes of the memory needed to create the module table decoder
-
bool mlsdk_decoder_is_valid_module_table(const void *moduleTableData, uint64_t size)
Checks if pointer points to valid module table data.
- Parameters:
moduleTableData -- The pointer to the data
size -- The size in bytes of the data
- Returns:
True if the data is a valid section, false otherwise
-
mlsdk_decoder_module_table_decoder *mlsdk_decoder_create_module_table_decoder(const void *const moduleTableData, void *decoderMemory)
Creates the module table decoder.
- Parameters:
moduleTableData -- The pointer to the module table data
decoderMemory -- Memory allocated to be used to create the decoder
- Returns:
The pointer to the newly created decoder
-
size_t mlsdk_decoder_get_module_table_num_entries(const mlsdk_decoder_module_table_decoder *const decoder)
Returns the number of entries in the module table.
- Parameters:
decoder -- The pointer to the module table decoder
- Returns:
The number of entries in the table
-
mlsdk_decoder_module_type mlsdk_decoder_get_module_type(const mlsdk_decoder_module_table_decoder *const decoder, uint32_t idx)
Returns the module type of the idx-entry.
- Parameters:
decoder -- The pointer to the module table decoder
idx -- The index for the entry in the module table
- Returns:
The module type of the entry
-
const char *mlsdk_decoder_get_module_name(const mlsdk_decoder_module_table_decoder *const decoder, uint32_t idx)
Returns the module name of the idx-entry.
- Parameters:
decoder -- The pointer to the module table decoder
idx -- The index for the entry in the module table
- Returns:
Char pointer to the module name
-
const char *mlsdk_decoder_get_module_entry_point(const mlsdk_decoder_module_table_decoder *const decoder, uint32_t idx)
Returns the SPIR-V entry_point name stored in the module.
If no entry_point is stored in the module a null pointer is returned.
- Parameters:
decoder -- The pointer to the module table decoder
idx -- The index for the entry in the module table
- Returns:
Char pointer to the entry_point name
-
void mlsdk_decoder_get_module_code(const mlsdk_decoder_module_table_decoder *const decoder, uint32_t idx, mlsdk_decoder_spirv_code *spirvCode)
Gets the SPIR-V code stored in the module.
If no code is stored in the module the SPIR-V code pointer will be set to null and the words to zero.
- Parameters:
decoder -- The pointer to the module table decoder
idx -- The index for the entry in the module table
spirvCode -- The place where to store the SPIR-V code
-
size_t mlsdk_decoder_binding_slot_size(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_binding_slots_handle handle)
Returns the number of binding slots.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the binding slots array
- Returns:
Number of binding slots in model sequence
-
uint32_t mlsdk_decoder_binding_slot_binding_id(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_binding_slots_handle handle, uint32_t slotIdx)
Returns the binding id of a given binding slot.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the binding slots array
slotIdx -- The index of the binding slot in the binding slots array
- Returns:
Binding id of binding slot with index slotIdx
-
uint32_t mlsdk_decoder_binding_slot_mrt_index(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_binding_slots_handle handle, uint32_t slotIdx)
Returns the mrt index of a given binding slot.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the binding slots array
slotIdx -- The index of the binding slot in the model sequence binding
- Returns:
Mrt index of binding slot with index slotIdx
-
size_t mlsdk_decoder_get_push_constant_ranges_size(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_push_constant_ranges_handle handle)
Returns the number of push constant ranges.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the push constant ranges
- Returns:
Number of push constant ranges
-
uint32_t mlsdk_decoder_get_push_constant_range_stage_flags(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_push_constant_ranges_handle handle, uint32_t rangeIdx)
Returns the stage flags of a given push constant range.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the push constant ranges
rangeIdx -- The index of the push constant range in the model sequence push constant ranges
- Returns:
Stage flags of push constant range with index rangeIdx
-
uint32_t mlsdk_decoder_get_push_constant_range_offset(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_push_constant_ranges_handle handle, uint32_t rangeIdx)
Returns the offset of a given push constant range.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the push constant ranges
rangeIdx -- The index of the push constant range in the model sequence push constant ranges
- Returns:
Offset of push constant range with index rangeIdx
-
uint32_t mlsdk_decoder_get_push_constant_range_size(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, mlsdk_decoder_push_constant_ranges_handle handle, uint32_t rangeIdx)
Returns the number of push constants in a given push constant range.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
handle -- The handle to the push constant ranges
rangeIdx -- The index of the push constant range in the model sequence push constant ranges
- Returns:
Number of push constants in push constant range with index rangeIdx
-
bool mlsdk_decoder_is_valid_model_sequence(const void *modelSequenceData, uint64_t size)
Checks if pointer points to valid model sequence data.
- Parameters:
modelSequenceData -- The pointer to the data
size -- The size in bytes of the data
- Returns:
True if the data is a valid section, false otherwise
-
mlsdk_decoder_model_sequence_decoder *mlsdk_decoder_create_model_sequence_decoder(const void *const modelSequenceData, void *modelSequenceDecoderMemory)
Create the model sequence decoder.
- Parameters:
modelSequenceData -- The pointer to the model sequence data
modelSequenceDecoderMemory -- Memory allocated to be used to create the decoder
- Returns:
The pointer to the newly created model sequence decoder
-
size_t mlsdk_decoder_model_sequence_decoder_mem_reqs()
Returns the memory requirements in bytes to allocate memory for creating the model sequence decoder.
- Returns:
The size in bytes of the memory needed to create the model sequence decoder
-
size_t mlsdk_decoder_get_model_sequence_table_size(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder)
Returns the number of segments in a model sequence table.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
- Returns:
Number of segments in a model sequence table
-
size_t mlsdk_decoder_model_sequence_get_segment_descriptorset_info_size(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Returns the number of descriptorset infos in a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Number of descriptorset infos in segment with index segIdx
-
void mlsdk_decoder_model_sequence_get_segment_constant_indexes(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx, mlsdk_decoder_constant_indexes *constant)
Gets the constant indexes for the given segment into the constant section.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index of segment in the model sequence
constant -- Constant struct pointer where to store the data
-
mlsdk_decoder_module_type mlsdk_decoder_model_sequence_get_segment_type(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Returns the type of a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Type of segment with index segIdx
-
const char *mlsdk_decoder_model_sequence_get_segment_name(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Returns the name of given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Name of segment with index segIdx
-
uint32_t mlsdk_decoder_model_sequence_get_segment_module_index(const mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Returns the module index into the ModuleTable to access the associated Segment’s Module.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
The module index into the ModuleTable of the assocated Segment’s Module
-
void mlsdk_decoder_model_sequence_get_segment_dispatch_shape(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx, mlsdk_decoder_dispatch_shape *dispatchShape)
Gets the dispatch shape of given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
dispatchShape -- Pointer to a dispatch shape struct where to save the data
-
mlsdk_decoder_push_constant_ranges_handle mlsdk_decoder_model_sequence_get_segment_push_constant_range(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Gets the push constant range of a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Handle to the push constant ranges
-
mlsdk_decoder_binding_slots_handle mlsdk_decoder_model_sequence_get_segment_descriptor_binding_slot(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx, uint32_t descIdx)
Gets the binding slot of a given descriptor of a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
descIdx -- The index for the descriptor in the segment
- Returns:
Handle to the binding slots array descInd in the segment with index segIdx
-
mlsdk_decoder_binding_slots_handle mlsdk_decoder_model_sequence_get_segment_input_binding_slot(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Gets the input binding slot of a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Handle to the binding slots array
-
mlsdk_decoder_binding_slots_handle mlsdk_decoder_model_sequence_get_segment_output_binding_slot(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder, uint32_t segIdx)
Gets the output binding slot of a given segment of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
segIdx -- The index for the segment in the model sequence
- Returns:
Handle to the binding slots array
-
mlsdk_decoder_binding_slots_handle mlsdk_decoder_model_sequence_get_input_binding_slot(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder)
Gets the input binding slot of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
- Returns:
Handle to the binding slots array
-
mlsdk_decoder_binding_slots_handle mlsdk_decoder_model_sequence_get_output_binding_slot(mlsdk_decoder_model_sequence_decoder *const modelSequenceDecoder)
Gets the output binding slot of model sequence.
- Parameters:
modelSequenceDecoder -- The pointer to the model sequence decoder
- Returns:
Handle to the binding slots array
-
size_t mlsdk_decoder_model_resource_table_decoder_mem_reqs()
Returns the memory requirements in bytes to allocate memory for creating the model resource table decoder.
- Returns:
The size in bytes of the memory needed to create the model resource table decoder
-
bool mlsdk_decoder_is_valid_model_resource_table(const void *modelResourceTableData, uint64_t size)
Checks if pointer points to valid model resource table data.
- Parameters:
modelResourceTableData -- The pointer to the data
size -- The size in bytes of the data
- Returns:
True if the data is a valid section, false otherwise
-
mlsdk_decoder_model_resource_table_decoder *mlsdk_decoder_create_model_resource_table_decoder(const void *const modelResourceTableData, void *decoderMemory)
Create the model resource table decoder.
- Parameters:
modelResourceTableData -- The pointer to the module resource table data
decoderMemory -- Memory allocated to be used to create the decoder
- Returns:
The pointer to the newly created decoder
-
size_t mlsdk_decoder_get_model_resource_table_num_entries(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder)
Returns the number of entries in the model resource table.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
- Returns:
The number of entries in the table
-
mlsdk_vk_descriptor_type_optional mlsdk_decoder_get_vk_descriptor_type(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder, uint32_t idx)
Returns the vk_descriptor_type of the idx-entry in the model resource table or mlsdk_vk_descriptor_type_none for types with no corresponding descriptor type.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
idx -- The index for the entry in the model resource table
- Returns:
The model resource vk_descriptor_type of the entry
-
mlsdk_vk_format mlsdk_decoder_get_vk_format(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder, uint32_t idx)
Returns the vk_format of the idx-entry in the model resource table.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
idx -- The index for the entry in the model resource table
- Returns:
The model resource vk_format of the entry
-
mlsdk_decoder_mrt_category mlsdk_decoder_model_resource_table_get_category(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder, uint32_t mrtIdx)
Returns the category of the idx-entry in the model resource table.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
mrtIdx -- The index for the entry in the model resource table
- Returns:
The category of the entry
-
void mlsdk_decoder_model_resource_table_get_tensor_shape(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder, uint32_t mrtIdx, mlsdk_decoder_tensor_dimensions *dimensions)
Gets the shape of the idx-entry in the model resource table.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
mrtIdx -- The index for the entry in the model resource table
dimensions -- The pointer to the shape of the model resource table entry
-
void mlsdk_decoder_model_resource_table_get_tensor_strides(const mlsdk_decoder_model_resource_table_decoder *const modelResourceTableDecoder, uint32_t mrtIdx, mlsdk_decoder_tensor_dimensions *dimensions)
Gets the strides of the idx-entry in the model resource table.
- Parameters:
modelResourceTableDecoder -- The pointer to the model resource table decoder
mrtIdx -- The index for the entry in the model resource table
dimensions -- The pointer to the strides of the model resource table entry
-
bool mlsdk_decoder_is_valid_constant_table(const void *constantTableData, uint64_t size)
Checks if pointer points to valid constant table data.
- Parameters:
constantTableData -- The pointer to the data
size -- The size in bytes of the data
- Returns:
True if the data is a valid section, false otherwise
-
mlsdk_decoder_constant_table_decoder *mlsdk_decoder_create_constant_table_decoder(const void *const constantTableData, void *constantDecoderMemory)
Create the constant table decoder.
- Parameters:
constantTableData -- The pointer to the constant table data
constantDecoderMemory -- Memory allocated to be used to create the decoder
- Returns:
The pointer to the newly created decoder
-
size_t mlsdk_decoder_constant_table_decoder_mem_reqs()
Returns the memory requirements in bytes to allocate memory for creating the constant tabledecoder.
- Returns:
The size in bytes of the memory needed to create the constant table decoder
-
void mlsdk_decoder_constant_table_get_data(const mlsdk_decoder_constant_table_decoder *const constantDecoder, uint32_t idx, mlsdk_decoder_constant_data *constantData)
Gets the data for the constant stored in the idx-entry in the constant table.
If no code is stored in the module the constantData pointer will be set to null
- Parameters:
constantDecoder -- The pointer to the constant table decoder
idx -- The index for the entry in the constant table
constantData -- The place where to store the constant data
-
uint32_t mlsdk_decoder_constant_table_get_mrt_index(const mlsdk_decoder_constant_table_decoder *const constantDecoder, uint32_t constidx)
Returns the index into the module resource table associated to the constant.
- Parameters:
constantDecoder -- The pointer to the constant table decoder
constidx -- The index for the entry in the constant table
- Returns:
The index into the model resource table
-
bool mlsdk_decoder_constant_table_is_sparse(const mlsdk_decoder_constant_table_decoder *const constantDecoder, uint32_t constidx)
Returns true if the constant is sparse on one dimension.
- Parameters:
constantDecoder -- The pointer to the constant table decoder
constidx -- The index for the entry in the constant table
- Returns:
true if constant is sparse or false oherwise
-
int64_t mlsdk_decoder_constant_table_get_sparsity_dimension(const mlsdk_decoder_constant_table_decoder *const constantDecoder, uint32_t constidx)
Returns the dimension on which the constant is sparse.
- Parameters:
constantDecoder -- The pointer to the constant table decoder
constidx -- The index for the entry in the constant table
- Returns:
The dimension on which the constant is sparse
-
size_t mlsdk_decoder_get_constant_table_num_entries(const mlsdk_decoder_constant_table_decoder *const constantDecoder)
Returns the number of entries in the constant table.
- Parameters:
constantDecoder -- The pointer to the constant table decoder
- Returns:
The number of entries in the table
-
struct mlsdk_vk_descriptor_type_optional
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
Optional mlsdk_vk_descriptor_type.
-
struct mlsdk_decoder_vgf_version
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
Semantic version of the VGF format. Compatibility is ensured if the file uses the same major version wrt to this library and a minor version which is lesser or equal wrt this library.
-
struct mlsdk_decoder_vgf_section_info
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
Section info describing the location and size of a VGF section.
-
struct mlsdk_decoder_spirv_code
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
The SPIR-V code view.
-
struct mlsdk_decoder_constant_data
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
The constant data view.
-
struct mlsdk_decoder_dispatch_shape
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
The dispatch shape view.
-
struct mlsdk_decoder_constant_indexes
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
The constant view.
-
struct mlsdk_decoder_tensor_dimensions
- #include </home/svc_ngp/workspace/VulkanGithubPagesNightly/build/vgf-lib/docs/sources/include-c/vgf/decoder.h>
The dimensions view values of “-1” represent unshaped dimensions.