NVIDIA IndeX API nvidia_logo_transpbg.gif Up
isparse_volume_subset.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2023 NVIDIA Corporation. All rights reserved.
3 *****************************************************************************/
6
7#ifndef NVIDIA_INDEX_ISPARSE_VOLUME_SUBSET_H
8#define NVIDIA_INDEX_ISPARSE_VOLUME_SUBSET_H
9
10#include <mi/dice.h>
11#include <mi/base/interface_declare.h>
12#include <mi/math/vector.h>
13
15
16namespace nv {
17namespace index {
18
24{
43
44 SPARSE_VOLUME_VOXEL_FORMAT_COUNT,
45 SPARSE_VOLUME_VOXEL_FORMAT_INVALID = SPARSE_VOLUME_VOXEL_FORMAT_COUNT
46};
47
57{
58 switch (fmt)
59 {
60 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT8: return sizeof(mi::Uint8);
61 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT8_2: return 2 * sizeof(mi::Uint8);
62 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT8_4: return 4 * sizeof(mi::Uint8);
63 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT8: return sizeof(mi::Sint8);
64 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT8_2: return 2 * sizeof(mi::Sint8);
65 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT8_4: return 4 * sizeof(mi::Sint8);
66 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT16: return sizeof(mi::Uint16);
67 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT16_2: return 2 * sizeof(mi::Uint16);
68 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_UINT16_4: return 4 * sizeof(mi::Uint16);
69 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT16: return sizeof(mi::Sint16);
70 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT16_2: return 2 * sizeof(mi::Sint16);
71 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_SINT16_4: return 4 * sizeof(mi::Sint16);
72 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16: return sizeof(mi::Sint16);
73 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16_2: return 2 * sizeof(mi::Sint16);
74 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16_4: return 4 * sizeof(mi::Sint16);
75 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32: return sizeof(mi::Float32);
76 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32_2: return 2 * sizeof(mi::Float32);
77 case nv::index::SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32_4: return 4 * sizeof(mi::Float32);
78 default:
79 return 0;
80 }
81}
82
94 public mi::base::Interface_declare<0x60d74933,0xd556,0x49de,0xaa,0xbc,0x5d,0xa7,0xaa,0xc1,0x4c,0x50>
95{
96public:
98 virtual bool is_valid() const = 0;
99
102
104 virtual mi::math::Vector<mi::Sint32, 3> get_data_position() const = 0;
105
107 virtual mi::math::Vector<mi::Uint32, 3> get_data_extent() const = 0;
108
110 virtual void* get_device_data() const = 0;
111
113 virtual mi::Size get_data_size() const = 0;
114
116 virtual mi::Sint32 get_gpu_device_id() const = 0;
117};
118
127 public mi::base::Interface_declare<0x728bb4d5,0x1d77,0x42da,0x81,0x1c,0x39,0xa3,0x34,0x56,0x26,0xa4,
128 IDistributed_data_attribute_set_descriptor>
129{
130public:
136 {
138 };
139
147 virtual bool setup_attribute(
148 mi::Uint32 attrib_index,
149 const Attribute_parameters& attrib_params) = 0;
150
159 mi::Uint32 attrib_index,
160 Attribute_parameters& attrib_params) const = 0;
161};
162
178 public mi::base::Interface_declare<0xad2ab72c,0xab33,0x4357,0xb6,0xd5,0x5a,0xcd,0xb9,0xf9,0x62,0xca,
179 IDistributed_data_subset_data_descriptor>
180{
181public:
185 {
186 mi::math::Vector_struct<mi::Sint32, 3> brick_position;
188 mi::math::Bbox_struct<mi::Sint32, 3> brick_bbox_base_level_strict;
190 mi::math::Bbox_struct<mi::Sint32, 3> brick_bbox_base_level_extended;
192 mi::Uint32 brick_lod_level;
193 };
194
195public:
200 virtual mi::Uint32 get_dataset_number_of_lod_levels() const = 0;
201
208 virtual mi::math::Bbox_struct<mi::Sint32, 3> get_dataset_lod_level_box(mi::Uint32 lod_level) const = 0;
209
216 virtual mi::math::Vector_struct<mi::Uint32, 3> get_dataset_lod_level_resolution(mi::Uint32 lod_level) const = 0;
217
220 virtual mi::math::Vector_struct<mi::Uint32, 3> get_subset_data_brick_dimensions() const = 0;
221
224 virtual mi::Uint32 get_subset_data_brick_shared_border_size() const = 0;
225
234 virtual mi::math::Bbox_struct<mi::Sint32, 3> get_subset_lod_data_bounds(mi::Uint32 lod_level) const = 0;
235
239 virtual mi::math::Vector_struct<mi::Uint32, 2> get_subset_lod_level_range() const = 0;
240
243 virtual mi::Uint32 get_subset_number_of_data_bricks() const = 0;
244
252 virtual const Data_brick_info get_subset_data_brick_info(mi::Uint32 brick_index) const = 0;
253
256 virtual mi::Uint32 get_lod_subset_number_of_data_bricks() const = 0;
257
269 virtual mi::Uint32 get_lod_subset_data_brick_index(mi::Uint32 lod_brick_index) const = 0;
270
271 virtual mi::math::Matrix_struct<mi::Float32, 4, 4> get_dataset_transform() const = 0;
272};
273
284 public mi::base::Interface_declare<0x1dfa0274,0xcf8,0x4f4c,0xa8,0x65,0x24,0xd0,0xae,0xf5,0x89,0x31,
285 IDistributed_data_subset>
286{
287public:
299 {
300 void* data;
301 mi::Size size;
302 mi::Sint32 gpu_device_id;
306 };
307
313 {
316 };
317
325 {
326 BRICK_STATE_EMPTY = 0x00u,
327 BRICK_STATE_FILLED,
328 BRICK_STATE_HOMOGENEOUS
329 };
330
331public:
332
338
344
361 virtual bool write_brick_data(
362 mi::Uint32 brick_subset_idx,
363 mi::Uint32 brick_attrib_idx,
364 const void* src_values,
365 mi::Sint32 gpu_device_id,
366 Data_transformation brick_data_transform = DATA_TRANSFORMATION_NONE) = 0;
367
384 virtual bool write_brick_data(
385 mi::Uint32 brick_subset_idx,
386 mi::Uint32 brick_attrib_idx,
387 const mi::neuraylib::IRDMA_buffer* src_rdma_buffer,
388 Data_transformation brick_data_transform = DATA_TRANSFORMATION_NONE) = 0;
389
419 const mi::Uint32* brick_subset_indices,
420 const mi::Uint32* brick_attrib_indices,
421 mi::Uint32 nb_input_bricks,
422 const mi::Size* src_rdma_buffer_offsets,
423 const mi::neuraylib::IRDMA_buffer* src_rdma_buffer,
424 Data_transformation brick_data_transform = DATA_TRANSFORMATION_NONE) = 0;
425
438 mi::Uint32 brick_subset_idx,
439 mi::Uint32 brick_attrib_idx) = 0;
456 mi::Uint32 brick_subset_idx,
457 mi::Uint32 brick_attrib_idx) const = 0;
458
470 virtual mi::neuraylib::IRDMA_buffer* access_brick_data_buffer_rdma(
471 mi::neuraylib::IRDMA_context* rdma_ctx,
472 mi::Uint32 brick_subset_idx,
473 mi::Uint32 brick_attrib_idx) = 0;
474
486 mi::Uint32 brick_subset_idx,
487 mi::Uint32 brick_attrib_idx,
488 const void* brick_homog_value) = 0;
489
490 virtual const void* get_brick_homogeneous_value(
491 mi::Uint32 brick_subset_idx,
492 mi::Uint32 brick_attrib_idx) const = 0;
503 mi::Uint32 attrib_idx,
504 const void* background_value) = 0;
505
506 virtual const void* get_background_value(
507 mi::Uint32 attrib_idx) const = 0;
508
515 virtual void set_brick_state(
516 mi::Uint32 brick_subset_idx,
517 mi::Uint32 brick_attrib_idx,
518 Data_brick_state brick_state) = 0;
527 mi::Uint32 brick_subset_idx,
528 mi::Uint32 brick_attrib_idx) const = 0;
529
539 virtual bool store_internal_data_representation(const char* output_filename) const = 0;
548 virtual bool load_internal_data_representation(const char* input_filename) = 0;
549
550 // Experimental API
551 // \note WORK IN PROGRESS
552 // - will be refactored into a separate device-data interface exposing device available data
553 // if it is available in the particular context of usage
554 // - this is future work as we have to work out how to handle the existing APIs for writing
555 // directly to the GPU (write_brick_data(), especially with IRDMA_buffer interface).
556 // - for now we will expose currently required methods directly. they will return invalid
557 // GPU-resources when no GPU-device access is given at the particular point
558 // - the plan is to currently have these methods working for the inferencing-technique
559 // APIs added
560 //
561
564 {
568 };
569
581 mi::Uint32 subdata_attrib_idx,
582 mi::math::Vector_struct<mi::Sint32, 3> subdata_position,
583 mi::math::Vector_struct<mi::Uint32, 3> subdata_extent,
584 mi::Uint32 subdata_flags = SUB_DATA_GEN_DEFAULT) const = 0;
585
593 IVolume_device_data_buffer* subdata_volume_buffer) const = 0;
594
602 const IVolume_device_data_buffer* subdata_volume_buffer) const = 0;
603
604
605};
606
607} // namespace index
608} // namespace nv
609
610#endif // NVIDIA_INDEX_ISPARSE_VOLUME_SUBSET_H
Attribute-set descriptor for sparse volume subsets.
Definition: isparse_volume_subset.h:129
virtual bool setup_attribute(mi::Uint32 attrib_index, const Attribute_parameters &attrib_params)=0
Configure the parameters for an attribute for a sparse volume subset.
virtual bool get_attribute_parameters(mi::Uint32 attrib_index, Attribute_parameters &attrib_params) const =0
Get the attribute parameters of a currently valid attribute for a given index.
Data descriptor for sparse volume data subsets.
Definition: isparse_volume_subset.h:180
virtual mi::math::Bbox_struct< mi::Sint32, 3 > get_dataset_lod_level_box(mi::Uint32 lod_level) const =0
Returns the bounding box of the requested level-of-detail in local voxel coordinates.
virtual mi::Uint32 get_dataset_number_of_lod_levels() const =0
Returns the number of levels-of-detail in the volume dataset.
virtual mi::Uint32 get_subset_number_of_data_bricks() const =0
Returns the number of volume-data bricks available in the complete non-view-dependent volume-data sub...
virtual const Data_brick_info get_subset_data_brick_info(mi::Uint32 brick_index) const =0
Returns the volume-data brick information for a selected data brick in the complete non-view-dependen...
virtual mi::math::Vector_struct< mi::Uint32, 2 > get_subset_lod_level_range() const =0
Returns the level-of-detail range used by the subset.
virtual mi::math::Vector_struct< mi::Uint32, 3 > get_subset_data_brick_dimensions() const =0
Returns the dimensions of the volume-data bricks.
virtual mi::Uint32 get_lod_subset_number_of_data_bricks() const =0
Returns the number of volume-data bricks available in the view-dependent LOD working-set of the volum...
virtual mi::Uint32 get_lod_subset_data_brick_index(mi::Uint32 lod_brick_index) const =0
Returns the subset-local volume-data brick index for a LOD data-brick in the view-dependent LOD worki...
virtual mi::math::Vector_struct< mi::Uint32, 3 > get_dataset_lod_level_resolution(mi::Uint32 lod_level) const =0
Returns the data resolution of the requested level-of-detail in local voxel coordinates.
virtual mi::Uint32 get_subset_data_brick_shared_border_size() const =0
Returns the size of the shared volume-data brick boundary.
virtual mi::math::Bbox_struct< mi::Sint32, 3 > get_subset_lod_data_bounds(mi::Uint32 lod_level) const =0
Returns the data bounds covering all volume-data bricks required for the subset on a particular level...
Distributed data storage class for sparse volume subsets.
Definition: isparse_volume_subset.h:286
Data_transformation
Transformation that should be applied on the written data.
Definition: isparse_volume_subset.h:313
@ DATA_TRANSFORMATION_FLIP_AXIS_ORDER
Change voxel storage order (x/y/z to z/y/x)
Definition: isparse_volume_subset.h:315
@ DATA_TRANSFORMATION_NONE
Pass through unchanged.
Definition: isparse_volume_subset.h:314
virtual const ISparse_volume_attribute_set_descriptor * get_attribute_set_descriptor() const =0
Returns the attribute-set descriptor of the subset.
virtual bool write_brick_data_multiple(const mi::Uint32 *brick_subset_indices, const mi::Uint32 *brick_attrib_indices, mi::Uint32 nb_input_bricks, const mi::Size *src_rdma_buffer_offsets, const mi::neuraylib::IRDMA_buffer *src_rdma_buffer, Data_transformation brick_data_transform=DATA_TRANSFORMATION_NONE)=0
Write multiple volume-data bricks to the subset from a single IRDMA_buffer.
virtual bool set_brick_homogeneous_value(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx, const void *brick_homog_value)=0
Write a single homogeneous value for a volume-data brick to the subset from a memory block in main me...
virtual bool store_internal_data_representation(const char *output_filename) const =0
This method allows to write a compact cache file of successfully loaded subset data to the file syste...
virtual bool fill_volume_sub_data_buffer(IVolume_device_data_buffer *subdata_volume_buffer) const =0
Fill a volume data buffer with subset-volume data for use by the application.
virtual bool write_from_volume_sub_data_buffer(const IVolume_device_data_buffer *subdata_volume_buffer) const =0
Write back volume date from a volume data buffer.
virtual mi::neuraylib::IRDMA_buffer * access_brick_data_buffer_rdma(mi::neuraylib::IRDMA_context *rdma_ctx, mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx)=0
Creates an RDMA buffer that is a wrapper for the internal buffer.
virtual bool set_background_value(mi::Uint32 attrib_idx, const void *background_value)=0
Set a background value used in volume areas not covered by voxel or homogeneous brick data.
virtual void set_brick_state(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx, Data_brick_state brick_state)=0
Explicitly set the state of a data-brick in the subset.
virtual Data_brick_state get_brick_state(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx) const =0
Query the state of a data-brick in the subset.
virtual bool write_brick_data(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx, const mi::neuraylib::IRDMA_buffer *src_rdma_buffer, Data_transformation brick_data_transform=DATA_TRANSFORMATION_NONE)=0
Write a volume-data brick to the subset from a IRDMA_buffer.
virtual IVolume_device_data_buffer * allocate_volume_sub_data_device(mi::Uint32 subdata_attrib_idx, mi::math::Vector_struct< mi::Sint32, 3 > subdata_position, mi::math::Vector_struct< mi::Uint32, 3 > subdata_extent, mi::Uint32 subdata_flags=SUB_DATA_GEN_DEFAULT) const =0
Generating a volume data buffer for use by the application.
virtual const Data_brick_buffer_info access_brick_data_buffer(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx) const =0
Query the internal buffer information of the data-subset instance for a volume-data brick in order to...
virtual const ISparse_volume_subset_data_descriptor * get_subset_data_descriptor() const =0
Returns the data subset descriptor of the subset.
virtual bool load_internal_data_representation(const char *input_filename)=0
This method allows to load a compact cache file of a data subset.
virtual bool write_brick_data(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx, const void *src_values, mi::Sint32 gpu_device_id, Data_transformation brick_data_transform=DATA_TRANSFORMATION_NONE)=0
Write a volume-data brick to the subset from a memory block in main memory.
Sub_data_gen_flags
Flags used for specifying the data generation process.
Definition: isparse_volume_subset.h:564
@ SUB_DATA_GEN_INCLUDE_BORDER_VOXELS
! Volume data generation with included border voxel.
Definition: isparse_volume_subset.h:566
@ SUB_DATA_GEN_DEFAULT
! Default generation mode.
Definition: isparse_volume_subset.h:565
@ SUB_DATA_GEN_NO_CLIP_REQUEST_VOLUME
! Ignoring clip request
Definition: isparse_volume_subset.h:567
virtual const Data_brick_buffer_info access_brick_data_buffer(mi::Uint32 brick_subset_idx, mi::Uint32 brick_attrib_idx)=0
Query the internal buffer information of the data-subset instance for a volume-data brick in order to...
Data_brick_state
Definition of the state of a data-brick in the subset.
Definition: isparse_volume_subset.h:325
Volume device-data accessor interface.
Definition: isparse_volume_subset.h:95
virtual mi::Size get_data_size() const =0
The size of the buffer in Bytes.
virtual mi::math::Vector< mi::Sint32, 3 > get_data_position() const =0
Volume data position in local volume space.
virtual Sparse_volume_voxel_format get_data_format() const =0
Voxel format of the volume data.
virtual bool is_valid() const =0
Verify if a data subset is valid.
virtual void * get_device_data() const =0
Raw memory pointer to internal device-buffer data.
virtual mi::Sint32 get_gpu_device_id() const =0
GPU device id if the buffer is located on a GPU device,.
virtual mi::math::Vector< mi::Uint32, 3 > get_data_extent() const =0
Volume data extent.
Sparse_volume_voxel_format
Voxel format of sparse volume voxel data.
Definition: isparse_volume_subset.h:24
mi::Sint32 get_sizeof(const nv::index::Sparse_volume_voxel_format fmt)
Get the size in byte for a given sparse volume voxel data format.
Definition: isparse_volume_subset.h:56
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT8_2
Vector voxel format with 2 components and sint8 precision per component.
Definition: isparse_volume_subset.h:29
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16_4
Vector voxel format with 4 components and float16 precision per component.
Definition: isparse_volume_subset.h:39
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT16_2
Vector voxel format with 2 components and sint16 precision per component.
Definition: isparse_volume_subset.h:35
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT8_2
Vector voxel format with 2 components and uint8 precision per component.
Definition: isparse_volume_subset.h:26
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16
Scalar voxel format with float16 precision.
Definition: isparse_volume_subset.h:37
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT16_2
Vector voxel format with 2 components and float16 precision per component.
Definition: isparse_volume_subset.h:38
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT8
Scalar voxel format with uint8 precision.
Definition: isparse_volume_subset.h:25
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT16_2
Vector voxel format with 2 components and uint16 precision per component.
Definition: isparse_volume_subset.h:32
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT8
Scalar voxel format with sint8 precision.
Definition: isparse_volume_subset.h:28
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT16_4
Vector voxel format with 4 components and sint16 precision per component.
Definition: isparse_volume_subset.h:36
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT16
Scalar voxel format with sint16 precision.
Definition: isparse_volume_subset.h:34
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32_2
Vector voxel format with 2 components and float32 precision per component.
Definition: isparse_volume_subset.h:41
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32_4
Vector voxel format with 4 components and float32 precision per component.
Definition: isparse_volume_subset.h:42
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT8_4
Vector voxel format with 4 components and uint8 precision per component.
Definition: isparse_volume_subset.h:27
@ SPARSE_VOLUME_VOXEL_FORMAT_FLOAT32
Scalar voxel format with float32 precision.
Definition: isparse_volume_subset.h:40
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT16
Scalar voxel format with uint16 precision.
Definition: isparse_volume_subset.h:31
@ SPARSE_VOLUME_VOXEL_FORMAT_UINT16_4
Vector voxel format with 4 components and uint16 precision per component.
Definition: isparse_volume_subset.h:33
@ SPARSE_VOLUME_VOXEL_FORMAT_SINT8_4
Vector voxel format with 4 components and sint8 precision per component.
Definition: isparse_volume_subset.h:30
Distributed subset interaces for a large-scale distributed datasets.
Common namespace for all NVIDIA APIs.
Definition: iindex.h:349
Sparse volume attribute parameters.
Definition: isparse_volume_subset.h:136
Sparse_volume_voxel_format format
Attribute format. See Sparse_volume_voxel_format.
Definition: isparse_volume_subset.h:137
Definition of internal buffer information.
Definition: isparse_volume_subset.h:299
void * data
Raw memory pointer to internal buffer data.
Definition: isparse_volume_subset.h:300
mi::Sint32 gpu_device_id
GPU device id if the buffer is located on a GPU device, -1 to indicate a host buffer.
Definition: isparse_volume_subset.h:302
bool is_pinned_memory
Flag indicating if a host buffer is a pinned (page-locked) memory area.
Definition: isparse_volume_subset.h:304
mi::Size size
The size of the buffer in Bytes.
Definition: isparse_volume_subset.h:301
Internal brick structure information.
Definition: isparse_volume_subset.h:185
mi::math::Bbox_struct< mi::Sint32, 3 > brick_bbox_base_level_strict
Bbox of the brick in local space of the base-lod level without the coverage of the shared border voxe...
Definition: isparse_volume_subset.h:188
mi::math::Vector_struct< mi::Sint32, 3 > brick_position
Position in volume local space of the the particular brick (on its level-of-detail).
Definition: isparse_volume_subset.h:186
mi::Uint32 brick_lod_level
Level-of-detail of the particular brick.
Definition: isparse_volume_subset.h:192
mi::math::Bbox_struct< mi::Sint32, 3 > brick_bbox_base_level_extended
Bbox of the brick in local space of the base-lod level with the coverage of the shared border voxels.
Definition: isparse_volume_subset.h:190