Skip to content

cuda.core: add tests for ObjectCode.from_object#2193

Open
lijinf2 wants to merge 3 commits into
NVIDIA:mainfrom
lijinf2:fix_663
Open

cuda.core: add tests for ObjectCode.from_object#2193
lijinf2 wants to merge 3 commits into
NVIDIA:mainfrom
lijinf2:fix_663

Conversation

@lijinf2

@lijinf2 lijinf2 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Part of Issue #663.

Adds tests for ObjectCode.from_object and the
CI plumbing needed to support them.

  • Create cuda_core/tests/test_binaries/saxpy.cu.
  • Build (build-wheel.yml): Compile saxpy.cu to saxpy.o using nvcc, uploaded
    as ${CUDA_CORE_ARTIFACT_NAME}-test-binaries.
  • Test (test-wheel-{linux,windows}.yml): download the artifact into
    cuda_core/tests/test_binaries/.
  • Pytest (test_module.py): new get_saxpy_object fixture reads bytes
    from cuda_core/tests/test_binaries/saxpy.o; two new tests cover the
    bytes and file-path paths of ObjectCode.from_object.
  • Local dev: build saxpy.o with nvcc on demand if available, else
    skip the new tests.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@lijinf2 lijinf2 self-assigned this Jun 10, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module labels Jun 10, 2026
@lijinf2 lijinf2 changed the title Testing CI for fixing 663 Testing CI for fixing 663 ObjectCode.from_block Jun 10, 2026
@lijinf2 lijinf2 added this to the cuda.core next milestone Jun 10, 2026
@lijinf2

lijinf2 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test

@copy-pr-bot

copy-pr-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

/ok to test

@lijinf2, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@lijinf2 lijinf2 added the test Improvements or additions to tests label Jun 10, 2026
@lijinf2

lijinf2 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test bbfbbdf

@github-actions

Copy link
Copy Markdown

@lijinf2

lijinf2 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 44a490e

@lijinf2 lijinf2 changed the title Testing CI for fixing 663 ObjectCode.from_block cuda.core: add tests for ObjectCode.from_object Jun 11, 2026
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#include <cstddef>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is device code specific, let's use cuda/std/cstddef.

Comment on lines +191 to +195
if shutil.which("nvcc") is None:
pytest.skip(
f"saxpy.o not found at {obj_path} and nvcc is unavailable. "
"In CI this is downloaded from the build stage."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cuda.pathfinder.find_nvidia_binary_utility('nvcc') do similar things and potentially more in the future if we figure out how to deliver nvcc in one place. It's more future proof than shutil.which IMO.

mod_obj = ObjectCode.from_object(obj)
assert mod_obj.code == obj
assert mod_obj.code_type == "object"
# object code is only valid as linker input; get_kernel is unsupported

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is it possible to test this? Maybe write 1 kernel in Python and 1 device function in C++, and link them together?

@leofang

leofang commented Jun 11, 2026

Copy link
Copy Markdown
Member

Need to merge with the latest main to fix CI.

@leofang leofang added the P0 High priority - Must do! label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module P0 High priority - Must do! test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants