Skip to content

[codex] Add scalar pointer out-return support#344

Draft
isVoid wants to merge 2 commits into
mainfrom
codex/scalar-pointer-out
Draft

[codex] Add scalar pointer out-return support#344
isVoid wants to merge 2 commits into
mainfrom
codex/scalar-pointer-out

Conversation

@isVoid

@isVoid isVoid commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds scalar pointer output support for out_return argument intents. APIs with output parameters such as unsigned int* singleMipLevel can now be exposed as returned scalar values, so a C++ shape like uint4 texture_footprint(..., unsigned int*) can compile to a Numba-facing tuple result like (footprint, single_mip).

The implementation records which out_return parameters are pointer outputs, derives the returned Numba type from the pointee type, allocates hidden scalar storage, passes the expected pointer slot through the shim ABI, and materializes the scalar after the call. The same helper path is wired through dynamic functions, templated functions, struct/class-template methods, and static binding rendering.

Validation

  • PYTHONPATH=/home/wangm/numbast-optix/numbast-scalar-pointer-out/numbast/src:/home/wangm/numbast-optix/numbast-scalar-pointer-out/ast_canopy pytest -q numbast/tests/test_intent.py numbast/tests/test_deduction.py numbast/src/numbast/static/tests/test_function_static_bindings.py::test_scalar_pointer_out_return_static_rendering
  • PYTHONPATH=/home/wangm/numbast-optix/numbast-scalar-pointer-out/numbast/src:/home/wangm/numbast-optix/numbast-scalar-pointer-out/ast_canopy python -m py_compile numbast/src/numbast/intent.py numbast/src/numbast/intent_defs.py numbast/src/numbast/intent_utils.py numbast/src/numbast/callconv.py numbast/src/numbast/function.py numbast/src/numbast/function_template.py numbast/src/numbast/struct.py numbast/src/numbast/class_template.py numbast/src/numbast/static/function.py numbast/src/numbast/static/struct.py numbast/tests/test_intent.py numbast/tests/test_function.py numbast/src/numbast/static/tests/test_function_static_bindings.py

CUDA end-to-end tests were attempted locally but the environment has no CUDA device (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: f8989b76-18d4-4977-8daf-b11c236fbc66

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/scalar-pointer-out

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