Mapping attributes

From NVIDIA-Omniverse/ovrtx · View interactive version

Mapping attributes is an AI agent skill from the GitHub repository NVIDIA-Omniverse/ovrtx. Zero-copy attribute map/unmap for direct memory access to ovstage buffers. Use when user asks about zero-copy writes, map attribute, direct memory access, or repeated mapped updates. Use attribute-bindings for repeated writes with caller-owned tensors when a copy is acceptable.

How to use this skill

Skill file

Mapping Attributes

When to Use

Use this skill when the user asks about zero-copy writes, map_attribute, direct memory access, or mapped attribute updates. Use attribute-bindings for repeated writes through a reusable ovstage query when the caller already owns the data tensor.

Inputs

Resolve inputs in this order: existing repository files and referenced snippets, explicit user request, then broader agent context.

Prerequisites

Instructions

  1. Identify the concrete map/unmap target, language, prim list, attribute name, memory target, and synchronization requirement.
  2. Read the matching source snippet and copy its map/write/unmap lifecycle rather than inventing equivalent calls.
  3. Validate dtype, shape, semantic, mappability, and ownership rules before proposing or editing code.
  4. Keep mapped tensor views alive only until unmap, and copy anything that must outlive the mapping.
  5. For repeated map/unmap cycles, retain and reuse the ovstage query.
  6. When changing code, run the narrow docs test or example that owns the snippet whenever practical.

Output Format

Scripts

This skill has no scripts.

Limitations

Overview

Mapping gives you direct access to an ovstage attribute buffer. Instead of copying data in, write through each fetched group, then unmap and advance the write floor.

The pattern is: map -> write into tensor -> unmap.

Python

CPU mapping with NumPy

Source: tests/docs/python/test_attribute_bindings.py snippet doc-map-attribute-cpu

Context manager (recommended)

Source: tests/docs/python/test_attribute_bindings.py snippet doc-map-attribute-cpu

Deprecated renderer API: GPU mapping with Warp

From the planet-system example -- map on CUDA, compute with a Warp kernel, unmap with stream sync:

Source: tests/docs/python/test_attribute_bindings.py snippet doc-map-attribute-cuda

Reusing a query for mapping

Reuse the query across map/unmap cycles:

Source: tests/docs/python/test_attribute_bindings.py snippet doc-map-bound-attribute

C

Map, write, unmap

Source: tests/docs/c/test_attribute_bindings.cpp snippet doc-map-attribute-cpu-c

GPU mapping with CUDA sync

Source: examples/c/vulkan-interop/src/main.cpp snippet map-rendered-output-cuda-array

Key Types / Functions

| Python | C |

|--------|---|

| stage.map_attribute(query, attr, ordinal=..., element_sizes=...) | ovrtx_map_attribute(renderer, &binding, desc, &out) |

| mapping.fetch_next() | out_mapping.dl (DLTensor) |

| mapping.unmap() | ovrtx_unmap_attribute(renderer, handle, sync) |

Read and map descriptors use scalar lanes: scalars (N,), generic tuples (N, C), and semantic square matrices (N, S, S) for S=2, 3, or 4. Per-prim array tensors use the same trailing axes. Strides count scalar elements. Attribute creation and canonical write inputs still use the lane-based rules in the writing-attributes skill.

Source: tests/docs/python/test_attribute_shapes.py snippets doc-shape-scalar-int32, doc-shape-float3-array, doc-shape-mat4-array.

Troubleshooting

Deprecated Standalone APIs

The ovrtx attribute map/unmap APIs are deprecated in 0.4 and retained for

compatibility. New code should map through ovstage, iterate writable groups, unmap

the mapping, and advance the write floor.

See docs/core/ovstage_integration.rst, skills/update-0_3-0_4-c/SKILL.md and skills/update-0_3-0_4-python/SKILL.md.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.