Skip to content

Add the cuda.core.experimental.Linker class - #229

Merged
leofang merged 34 commits into
mainfrom
ksimpson/cuda_core_linker_155
Dec 7, 2024
Merged

Add the cuda.core.experimental.Linker class#229
leofang merged 34 commits into
mainfrom
ksimpson/cuda_core_linker_155

Conversation

@keenan-simpson

@keenan-simpsonkeenan-simpson commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

wrap nvjitlink into the object model.
Depends on #224

@copy-pr-bot

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.

@leofangleofang added this to the cuda.core beta 2 milestone Nov 11, 2024
@keenan-simpson
keenan-simpsonforce-pushed the ksimpson/cuda_core_linker_155 branch from 1916359 to 81086e0CompareNovember 13, 2024 17:33
@keenan-simpson
keenan-simpson marked this pull request as ready for review November 13, 2024 17:34
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/tests/test_linker.py Outdated
Comment threadcuda_core/tests/test_linker.py Outdated
@leofangleofang added P0 High priority - Must do! feature New feature or request cuda.core Everything related to the cuda.core module labels Nov 14, 2024
@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

/ok to test

@leofangleofang 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.

Thanks, Keenan! I haven't reviewed the tests yet (they seem OK from a quick glance). Left some comments below.

Please also modify docs/.../api.rst to document LinkerOptions/Linker and make sure the docs build without warnings and render OK.

Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment on lines 184 to 197

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.

Graham can correct me but there's probably a better way to pass multiple options to -Xptxas. Could you check if this is tested?

Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/cuda/core/experimental/_linker.py Outdated
Comment threadcuda_core/tests/test_linker.py Outdated
@rwgkrwgk changed the title Add the cuda.core.experiemental.Linker classAdd the cuda.core.experimental.Linker classNov 27, 2024
@keenan-simpson
keenan-simpsonforce-pushed the ksimpson/cuda_core_linker_155 branch from aed4c23 to 9d8ecbcCompareNovember 27, 2024 21:06
@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

TODO - fix the finalizer. Once Ralf's change is complete I will implement the finalizer to match.

@rwgk

rwgk commented Dec 2, 2024

Copy link
Copy Markdown
Contributor

Hi @ksimpson-work, I just merged #246. — The pattern for using weakref.finalize() isn't formalized, but it's very easy to adopt just by looking at the PR. Please let me know any questions. I'd be happy to meet 1:1 to explain.

@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

Thanks for the ping! I will look to implement now

@keenan-simpson
keenan-simpsonforce-pushed the ksimpson/cuda_core_linker_155 branch from 88c5ed2 to 702fbaaCompareDecember 4, 2024 20:02
Comment threadcuda_core/tests/test_linker.py Outdated
Comment threadcuda_core/tests/test_linker.py Outdated
@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

Tests are updated to link ptx inputs vs ltoir inputs when running with culink backend. The functions are all device, using a global was consistently causing an error when linking (undefined reference to B, C) although B and C were both declared in A and passed to the linker.

@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

Upon further investigation, the issue with linking ptx inputs was not an issue with the linker, but rather a user error in the compilation step. relocatable device code option was required in order to compile and output unreferenced device functions. This is, of course, a requirement to link them to some declaration in the entrypoint file.

@keenan-simpson

Copy link
Copy Markdown
ContributorAuthor

lazy load modules in #268

@leofang

Copy link
Copy Markdown
Member

/ok to test

@leofang

Copy link
Copy Markdown
Member

Windows failures are known (#271) and irrelevant. Let's merge. Thanks, Keenan!

cc @gmarkall@isVoid for vis

@leofang
leofang merged commit 0ca509e into mainDec 7, 2024
@leofang
leofang deleted the ksimpson/cuda_core_linker_155 branch December 7, 2024 04:44
@leofangleofang linked an issue Dec 7, 2024 that may be closed by this pull request
@leofangleofang mentioned this pull request Dec 7, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.coreEverything related to the cuda.core modulefeatureNew feature or requestP0High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cuda.core.Linker

3 participants

@keenan-simpson@rwgk@leofang