cuda.core: add tests for ObjectCode.from_object#2193
Conversation
|
/ok to test |
@lijinf2, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
|
/ok to test bbfbbdf |
|
|
/ok to test 44a490e |
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include <cstddef> |
There was a problem hiding this comment.
Since this is device code specific, let's use cuda/std/cstddef.
| 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." | ||
| ) |
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.
| 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 |
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?
|
Need to merge with the latest main to fix CI. |
|
/ok to test a36588b |
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