Skip to content

Ptxas: unresolved extern function __spirv_AtomicLoad(long long const*...) #7658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
12VIP opened this issue Dec 6, 2022 · 8 comments · Fixed by #7391
Closed

Ptxas: unresolved extern function __spirv_AtomicLoad(long long const*...) #7658

12VIP opened this issue Dec 6, 2022 · 8 comments · Fixed by #7391
Labels
bug Something isn't working cuda CUDA back-end

Comments

@12VIP
Copy link

12VIP commented Dec 6, 2022

Issue (ptxas error) observed while building sample application(after dpct migration)

In this case :
During compilation phase object file TestFluxBC.cpp.dp.o is generated then ,during linking phase :
command :
dpcpp_compiler/bin/clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda -o TestFluxBC tests/TestFluxBC.cpp.dp.o liblbpm-wia.a -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_cxx -lmpi

Error Reported:
ptxas fatal : Unresolved extern function '_Z18__spirv_AtomicLoadPKxN5__spv5Scope4FlagENS_19MemorySemanticsMask4FlagE'
llvm-foreach:
ptxas fatal : Unresolved extern function '_Z18__spirv_AtomicLoadPKxN5__spv5Scope4FlagENS_19MemorySemanticsMask4FlagE'
llvm-foreach:
clang++: error: ptxas command failed with exit code 255 (use -v to see invocation)
clang version 16.0.0 (/netbatch/donb3373736_00/runDir/jenkins-dir/workspace/Tools_SH/SYCLOS_Nightly/RHEL/llvm.src/clang 2359d94)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: sycl_nightly_20221203/dpcpp_compiler/bin
clang++: note: diagnostic msg: Error generating preprocessed source(s).

Function :
c++filt '_Z18__spirv_AtomicLoadPKxN5__spv5Scope4FlagENS_19MemorySemanticsMask4FlagE'
__spirv_AtomicLoad(long long const*, __spv::Scope::Flag, long long const::MemorySemanticsMask::Flag)

  • OS: Linux(Ubuntu)
  • DPC++ version: 16.0.0(2359d94)
  • Dependencies : openmpi

Will try to check on the reproducer steps(as lots of steps prerequisite) .Want to check if this is some known issue .

@12VIP 12VIP added the bug Something isn't working label Dec 6, 2022
@mmoadeli
Copy link
Contributor

mmoadeli commented Dec 6, 2022

Hi @12VIP thanks for reporting this issue. We will look into this and get back to you shortly. Would be helpful if you could share the related code to reproduce the issue.

@dm-vodopyanov
Copy link
Contributor

Quick look on the error message: the reason the compilation failed is that CUDA doesn't support SPIR-V.

@bader
Copy link
Contributor

bader commented Dec 6, 2022

Quick look on the error message: the reason the compilation failed is that CUDA doesn't support SPIR-V.

CUDA doesn't use SPIR-V, so I don't think this is the right guess. I suppose it has something to do with the libclc implementation, which is supposed to implement this function. The reason why this function definition is missing might be that long long type is not supported by OpenCL. @AerialMantis, could you assign someone to investigate, please?

@AlexeySachkov AlexeySachkov added the cuda CUDA back-end label Dec 7, 2022
@12VIP
Copy link
Author

12VIP commented Dec 7, 2022

files.zip : Attached cpp file & headers if required.

@zjin-lcf
Copy link
Contributor

zjin-lcf commented Dec 8, 2022

@12VIP
Do your files contain DPC++ codes ?

@12VIP
Copy link
Author

12VIP commented Dec 9, 2022

@zjin-lcf , Original code : https://github.com/OPM/LBPM/blob/master/tests/TestFluxBC.cpp
Attached earlier(files.zip with dpct) : TestFluxBC.cpp.dp.cpp .Both files are same only ,no dpc++ code as such .

@jchlanda
Copy link
Contributor

@12VIP I wasn't able to build your example (as attached in files.zip) due to broken dependencies, it would be great if you could provide us with a minimal SYCL example that exhibits the same issue. Recently we have merged in fixes to re-mangler, which might be of help in that case (as long long would likely be requiring re-mangline), further more I suggest you try this PR: #7391 as it introduces more support for generic address space atomics.

@jchlanda
Copy link
Contributor

In fact I've just had a look in the generated libclc files (from that PR I've mentioned above) and indeed it contains the function in question:

remangled-l32-signed_char.libspirv-nvptx64--nvidiacl.ll

479632:declare dso_local i64 @_Z18__spirv_AtomicLoadPKxN5__spv5Scope4FlagENS_19MemorySemanticsMask4FlagE(i64* noundef, i32 noundef, i32 noundef) local_unnamed_addr #50

steffenlarsen pushed a commit that referenced this issue Dec 14, 2022
The diffs are quite hard to follow, but in an essence this patch brings:
* a new entry, implementing a generic address space for multiple
`__CLC_NVVM_ATOMIC_XYZ_IMPL`, where `XYZ` stands for `CAS`, `INDEC`,
`LOAD`, `MAX`, `MIN`, `STORE` and `SUB`,
* fixes the name of mangled function that the IMPL uses,
* the rest is just formatting to 80 chars.

This patch supersedes: #5849 but it
requires the fixes to the remangler from:
#7220

Fixes: #7658
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda CUDA back-end
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants