Skip to content

[Comgr] Link with TransformUtils that defines llvm::CloneFunction#2483

Merged
jmmartinez merged 1 commit into
amd-stagingfrom
users/juamarti/comgr-missing-lib
May 12, 2026
Merged

[Comgr] Link with TransformUtils that defines llvm::CloneFunction#2483
jmmartinez merged 1 commit into
amd-stagingfrom
users/juamarti/comgr-missing-lib

Conversation

@jmmartinez
Copy link
Copy Markdown

With BUILD_SHARED_LIBS, compilation would fail with:

/usr/bin/ld:
tools/comgr/CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o: in function
`COMGR::AMDGPUCompiler::cloneKernelsInBitcode(COMGR::DataSet*)': /home/juamarti/llvm/_llvm/amd/comgr/src/comgr-compiler.cpp:2588: undefined reference to `llvm::CloneFunction(llvm::Function*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> >
>&, llvm::ClonedCodeInfo*)'

With BUILD_SHARED_LIBS, compilation would fail with:

/usr/bin/ld:
tools/comgr/CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o: in
function
`COMGR::AMDGPUCompiler::cloneKernelsInBitcode(COMGR::DataSet*)':
/home/juamarti/llvm/_llvm/amd/comgr/src/comgr-compiler.cpp:2588:
undefined reference to `llvm::CloneFunction(llvm::Function*,
llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH,
llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> >
>&, llvm::ClonedCodeInfo*)'
@jmmartinez jmmartinez self-assigned this May 11, 2026
@jmmartinez jmmartinez marked this pull request as ready for review May 11, 2026 09:10
@chinmaydd chinmaydd added the comgr Related to Code Object Manager label May 11, 2026
@lamb-j
Copy link
Copy Markdown
Collaborator

lamb-j commented May 11, 2026

In the past I tried using CloneModule for something and it was incredibly slow. Not sure if cloneFunction has the same issues, but something to keep an eye out for

@jmmartinez jmmartinez merged commit 104e38a into amd-staging May 12, 2026
99 of 103 checks passed
@jmmartinez jmmartinez deleted the users/juamarti/comgr-missing-lib branch May 12, 2026 07:06
@jmmartinez
Copy link
Copy Markdown
Author

jmmartinez commented May 12, 2026

In the past I tried using CloneModule for something and it was incredibly slow. Not sure if cloneFunction has the same issues, but something to keep an eye out for

AFAIK CloneModule is implemented through CloneFunction. But I should double check.


It's used when translating spirv to bitcode. When we have several block-sizes specified in the action, we have to specialize the translated kernel for every size.

I wonder if this is often used with a single block-size. In that case we could avoid the clone and reuse the kernels that already exist. @steffenlarsen do you have more context about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comgr Related to Code Object Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants