Skip to content

Improve C ABI struct change error handling - #2386

Open
jrbourbeau wants to merge 2 commits into
NVIDIA:mainfrom
jrbourbeau:c-abi-struct-error
Open

Improve C ABI struct change error handling#2386
jrbourbeau wants to merge 2 commits into
NVIDIA:mainfrom
jrbourbeau:c-abi-struct-error

Conversation

@jrbourbeau

Copy link
Copy Markdown
Member

Over in #2369 I saw this C ABI change error

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.15/x64/bin/check-c-abi", line 6, in <module>
    sys.exit(main_cli())
using dlpack from /home/runner/work/cuvs/cuvs/dlpack/include
             ^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages/check_c_abi/main.py", line 136, in main_cli
    errors = analyze_c_abi(old_abi, new_abi)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages/check_c_abi/abi.py", line 351, in analyze_c_abi
    errors.extend(_analyze_struct_abi(old_abi, new_abi))
  File "/opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages/check_c_abi/abi.py", line 293, in _analyze_struct_abi
    new_struct.members,
    ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'new_struct' where it is not associated with a value

This PR adds a continue so we avoid any unbounded variables.

Signed-off-by: James Bourbeau <jbourbeau@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@jrbourbeau
jrbourbeau marked this pull request as ready for review July 31, 2026 15:49
@jrbourbeau
jrbourbeau requested a review from a team as a code owner July 31, 2026 15:49
@jrbourbeau
jrbourbeau requested a review from bdice July 31, 2026 15:49
@jrbourbeau jrbourbeau added bug Something isn't working non-breaking Introduces a non-breaking change labels Jul 31, 2026
@jrbourbeau

Copy link
Copy Markdown
Member Author

Okay, now we're getting a more informative error message

using dlpack from /home/runner/work/cuvs/cuvs/dlpack/include
Error: Function has been removed. Symbol cuvsDatasetCreate from cuvs/core/dataset.h:57
Error: Function has been removed. Symbol cuvsDatasetMakePadded from cuvs/core/dataset.h:70
Error: Function has been removed. Symbol cuvsDatasetMakePaddedView from cuvs/core/dataset.h:80
Error: Function has been removed. Symbol cuvsDatasetMakeStandardView from cuvs/core/dataset.h:89
Error: Function has been removed. Symbol cuvsDatasetDestroy from cuvs/core/dataset.h:94
Error: Function has been removed. Symbol cuvsDatasetGetMemType from cuvs/core/dataset.h:97
Error: Function has been removed. Symbol cuvsDatasetGetLayout from cuvs/core/dataset.h:101
Error: Function has been removed. Symbol cuvsDatasetGetIsOwning from cuvs/core/dataset.h:104
Error: Function has been removed. Symbol cuvsDatasetGetDtype from cuvs/core/dataset.h:107
Error: Function has been removed. Symbol cuvsCagraUpdateDataset from cuvs/neighbors/cagra.h:596
Error: Function has changed parameter type 'cuvsDataset_t' to 'DLManagedTensor *' for 'dataset'. Symbol cuvsCagraBuild from cuvs/neighbors/cagra.h:638
Error: Function has changed parameter type 'cuvsDataset_t' to 'DLManagedTensor *' for 'extended_dataset'. Symbol cuvsCagraExtend from cuvs/neighbors/cagra.h:667
Error: Function has changed parameter type 'int64_t' to 'cuvsCagraIndex_t' for 'new_start_row'. Symbol cuvsCagraExtend from cuvs/neighbors/cagra.h:667
Error: Function has a deleted parameter 'cuvsCagraIndex_t index'. Symbol cuvsCagraExtend from cuvs/neighbors/cagra.h:695
Error: Function has been removed. Symbol cuvsCagraSerializeGraph from cuvs/neighbors/cagra.h:827
Error: Function has been removed. Symbol cuvsCagraSerializeGraphAndDataset from cuvs/neighbors/cagra.h:844
Error: Function has been removed. Symbol cuvsCagraDeserializeGraph from cuvs/neighbors/cagra.h:888
Error: Function has been removed. Symbol cuvsCagraDeserializeGraphAndDataset from cuvs/neighbors/cagra.h:911
Error: Function has changed parameter type 'cuvsDataset_t' to 'cuvsCagraIndex_t' for 'merged_dataset'. Symbol cuvsCagraMerge from cuvs/neighbors/cagra.h:957
Error: Function has a deleted parameter 'cuvsCagraIndex_t output_index'. Symbol cuvsCagraMerge from cuvs/neighbors/cagra.h:1029
Error: Struct has been removed. Symbol cuvsDataset from cuvs/core/dataset.h:41
Error: Struct member has changed type 'void *' to 'cuvsCagraCompressionParams_t' for member 'graph_build_params'. Symbol cuvsCagraIndexParams from cuvs/neighbors/cagra.h:203
Error: Enum value CUVS_DATASET_LAYOUT_STANDARD has been removed. Symbol cuvsDatasetLayout_t from cuvs/core/dataset.h:21
Error: Enum value CUVS_DATASET_LAYOUT_PADDED has been removed. Symbol cuvsDatasetLayout_t from cuvs/core/dataset.h:21
Error: Enum value CUVS_DATASET_MEM_TYPE_HOST has been removed. Symbol cuvsDatasetMemType_t from cuvs/core/dataset.h:29
Error: Enum value CUVS_DATASET_MEM_TYPE_DEVICE has been removed. Symbol cuvsDatasetMemType_t from cuvs/core/dataset.h:29

Why this is failing in the first place isn't clear to me as this PR and #2369 don't touch any C code, so this looks unrelated.

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

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants