Skip to content

[codex] Add pointer-backed return materialization#342

Draft
isVoid wants to merge 2 commits into
mainfrom
codex/pointer-backed-return
Draft

[codex] Add pointer-backed return materialization#342
isVoid wants to merge 2 commits into
mainfrom
codex/pointer-backed-return

Conversation

@isVoid

@isVoid isVoid commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds an explicit pointer-backed return materialization path for APIs that return borrowed fixed-size pointer data, such as const float4* get_transform(handle). Configured functions now expose a Numba-visible UniTuple(pointee, length) return, with lowering copying the configured number of elements from the returned pointer.

Changes

  • Added PointerReturnMaterialization and config parsing for dynamic and static binding paths.
  • Extended FunctionCallConv to load fixed-size pointee data from the C++ return pointer and materialize it as a tuple return.
  • Added static binding config support via Function Return Materializations, including schema and generated schema docs.
  • Added dynamic/static tests and CUDA fixture declarations for a const float4* return materialized as UniTuple(float32x4, 3).
  • Documented the new config shape in the argument intents guide.

Validation

  • PYTHONPATH=/home/wangm/numbast-optix/numbast-pointer-backed-return/numbast/src:/home/wangm/numbast-optix/numbast-pointer-backed-return/ast_canopy pytest -q numbast/tests/test_callconv.py numbast/tests/test_function.py::test_pointer_return_binding_signature numbast/src/numbast/static/tests/test_function_static_bindings.py::test_pointer_return_static_binding_source numbast/src/numbast/static/tests/test_function_static_bindings.py::test_generated_callconv_alignof_helper_is_standalone numbast/src/numbast/tools/tests/test_config_schema_docs.py
  • Result: 12 passed in 0.87s

CUDA execution tests were added but could not be run on this machine because CUDA initialization reports CUDA_ERROR_NO_DEVICE.

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 05fadf56-153e-48c9-859f-8fc8ce9e7fd3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/pointer-backed-return

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant