Skip to content

cuda.core: add tests for ObjectCode.from_library#2281

Open
lijinf2 wants to merge 1 commit into
NVIDIA:mainfrom
lijinf2:fix_663_b
Open

cuda.core: add tests for ObjectCode.from_library#2281
lijinf2 wants to merge 1 commit into
NVIDIA:mainfrom
lijinf2:fix_663_b

Conversation

@lijinf2

@lijinf2 lijinf2 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

closes #663.

Adds tests for ObjectCode.from_library and extends the saxpy test-binary infrastructure from #2193.

  • build_test_binaries.sh: package saxpy.o into saxpy.a for Linux / saxpy.lib for Windows via nvcc -lib
  • CI (build-wheel.yml): upload library artifacts alongside object fixtures
  • test_module.py: new get_saxpy_library fixture and three tests mirroring from_object coverage (bytes, file path, linker integration)

Checklist

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

@copy-pr-bot

copy-pr-bot Bot commented Jun 30, 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.

@lijinf2 lijinf2 self-assigned this Jun 30, 2026
@github-actions github-actions Bot added CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module labels Jun 30, 2026
@lijinf2 lijinf2 added the test Improvements or additions to tests label Jun 30, 2026
@lijinf2 lijinf2 added this to the cuda.core v1.1.0 milestone Jun 30, 2026
@lijinf2

lijinf2 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a0f1507

@github-actions

Copy link
Copy Markdown

@leofang

leofang commented Jun 30, 2026

Copy link
Copy Markdown
Member

Thanks, Jinfeng! Technically we already tested from_library in the CI!

cudadevrt = ObjectCode.from_library(cudadevrt_path)

But I wouldn't complain for completeness 🙂

Let me get back to review tomorrow...

@leofang leofang self-requested a review June 30, 2026 04:01

@leofang leofang left a comment

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.

Let's try to reduce the boilerplate code. I understand that it's a lot cheaper to just generate code using agents. But there is really no good reason to add same code over and over. pytest parametrization can go a long way.



@pytest.fixture(scope="module")
def get_saxpy_library():

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.

Consolidate this fixture with get_saxpy_object above.

assert mod_obj.code_type == "library"


def test_object_code_load_library_with_linker(get_saxpy_library, init_cuda):

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.

Consolidate the test with test_object_code_load_object_with_linker above.

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 test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA]: Tests for ltoir, fatbin, object, and library constructors

2 participants