Skip to content

Add Information to Make Binding Generation More Reproducible#116

Closed
isVoid wants to merge 2 commits intoNVIDIA:mainfrom
isVoid:fea-repro-info
Closed

Add Information to Make Binding Generation More Reproducible#116
isVoid wants to merge 2 commits intoNVIDIA:mainfrom
isVoid:fea-repro-info

Conversation

@isVoid
Copy link
Collaborator

@isVoid isVoid commented Apr 10, 2025

closes #107

In response to NVIDIA/numba-cuda#166 (comment), this PR adds additional metadata to the generated binding to make sure the bindings are more reproducible in later production range. One example of such metadata looks like below:

# Automatically generated by Numbast Static Binding Generator
# Generator Information:
# Ast_canopy version: 0.3.0
# Numbast version: 0.3.0
# Generation command: /raid/wangm/.miniforge3/numbast/bin/pytest -s numbast/src/numbast/tools/tests/test_repro_info.py
# Static binding generator parameters: {'cfg_path': '/tmp/pytest-of-wangm/pytest-51/test_repro_info0/config/cfg.yml', 'output_dir': local('/tmp/pytest-of-wangm/pytest-51/test_repro_info0/output'), 'input_header': None, 'retain': None, 'types': None, 'datamodels': None, 'compute_capability': None}
# Config file path (relative to the path of the generated binding): ../../config/cfg.yml

Note the Config file path in the last line. This is shown as a relative path to the generated binding file, which subsequently implies that the config file and the binding file should live under the same root (repo root) for better tracing.

@isVoid isVoid mentioned this pull request Apr 14, 2025
isVoid added a commit that referenced this pull request May 5, 2025
- The linkable code object that contains the shim functions are added to
`active_linking_library` in python.
- Streamed Shim Function Writes. The shim functions are written to a
string stream at lowering time using a special class named
`KeyedStringIO` that prevents double write of the same shim function.
- Ruff formatting generated code (with import sort):
#108
- Generation metadata added to binding: #116 
- Allow user to specify entry point and retain file list in config file
using relative path
d1e7aa2
- Allow user to add additional imports via `Additional Import` config
item
8f7bd22
- Allow user to override the include line in shim function via `Shim
Include Override` config item
8f7bd22
- Allow user to specify whether to include check in the binding to
assert existence of pynvjitlink
[bad0c69](bad0c69)
- Allow user to specify a custom macro, which dictates both how
clangTooling parses the header file, as well as how the shim function is
compiled with NVRTC.
[0f0ee9c](0f0ee9c)

[ORIGINAL]
This PR supercedes #102, which hand picked the parts where only lowering
modifications are involved. In essence, this PR uses a new attribute in
Numba-cuda target context named `_external_linkage`. By inserting the
correct external linkables in the context, this PR hides the shim
function usage to user, therefore eliminating the need for
`c_ext_shim_func` variable.

Additionally, since each shim function is isolated into the sub scope
inside each function lowering, the monolithic shim function block no
longer exists. This should presumably speedup compilation due to reduced
IO burden on the size of the shim function being parsed by the RTC.

~~depends on NVIDIA/numba-cuda#165

Jointly in work with NVIDIA/numba-cuda#166

Includes changes from #116, #108

---------

Co-authored-by: isVoid <isVoid@users.noreply.github.com>
Co-authored-by: Yevhenii Havrylko <yhavrylko@nvidia.com>
@isVoid
Copy link
Collaborator Author

isVoid commented May 5, 2025

Handled by #106

@isVoid isVoid closed this May 5, 2025
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.

[FEA] Include more metadata in the binding file for reproducibility

1 participant