cuda.core: add tests for ObjectCode.from_object#2193
Open
lijinf2 wants to merge 3 commits into
Open
Conversation
Contributor
Contributor
Author
|
/ok to test |
Contributor
@lijinf2, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
Contributor
Author
|
/ok to test bbfbbdf |
|
Contributor
Author
|
/ok to test 44a490e |
isVoid
reviewed
Jun 11, 2026
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include <cstddef> |
Contributor
There was a problem hiding this comment.
Since this is device code specific, let's use cuda/std/cstddef.
isVoid
reviewed
Jun 11, 2026
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." | ||
| ) |
Contributor
There was a problem hiding this comment.
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.
leofang
reviewed
Jun 11, 2026
| 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 |
Member
There was a problem hiding this comment.
Q: Is it possible to test this? Maybe write 1 kernel in Python and 1 device function in C++, and link them together?
Member
|
Need to merge with the latest main to fix CI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of Issue #663.
Adds tests for
ObjectCode.from_objectand theCI plumbing needed to support them.
cuda_core/tests/test_binaries/saxpy.cu.build-wheel.yml): Compile saxpy.cu to saxpy.o using nvcc, uploadedas
${CUDA_CORE_ARTIFACT_NAME}-test-binaries.test-wheel-{linux,windows}.yml): download the artifact intocuda_core/tests/test_binaries/.test_module.py): newget_saxpy_objectfixture reads bytesfrom
cuda_core/tests/test_binaries/saxpy.o; two new tests cover thebytes and file-path paths of
ObjectCode.from_object.saxpy.owithnvccon demand if available, elseskip the new tests.
Checklist