- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I just upgraded from OneAPI dpcpp from 2021.1 to 2021.2. My codes that worked previously with 2021.1 now failed in 2021.2 with link error:
InvalidModule: Invalid SPIR-V module: Casts from private/local/global address space are allowed only to generic
llvm-foreach:
[build] dpcpp: error: llvm-spirv command failed with exit code 1 (use -v to see invocation)
Amon
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
Please give us an small reproducer so as to get a more insight into your issue and do let us know your environment details to reproduce the same errors.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have had struggled several times to trim down my source code to a program that could reproduce the issue but I still fail to make it.
However, I have some observations that can share:
- it happens at llvm code generation during linking
- it is not related to source code using OpenCL API (correction of my statement in my initial post). It is related to the C++ template code with template class generation. Something similar to the code below:
foo.h:
template<typename T> class foo { ... };
foo.cpp:
#include "foo.h"
// it seems this way to generate the code for particular types triggers the issue
template class foo<float>;
template class foo<double>;
main.cpp:
#include "foo.h"
void main() { foo<float> f; }
- The issue happens if foo.cpp is first compiled as static library and linked with main.o. [Note: it is a pattern I observed where the issue happens; such a simple program does not reproduce the issue I mentioned! ]
- I also observed another pattern, similar to something below. I solved the issue by replacing static std::vector<std::string> as inline std::array<std::string_view, ...>.
foo.h:
template<typename T> class foo { static std::vector<std::string> v };
// the issue seems solved if the above line is changed to
// template<typename T> class foo { static std::array<std::string_view, 1> v = {"foo"}; };
foo.cpp:
#include "foo.h"
template<typename T> std::vector<std::string> foo::v = { "foo"; }
// remove the above line if the vector is replaced by inline std::array in foo.h
template class foo<float>;
template class foo<double>;
main.cpp:
#include "foo.h"
void main() { foo<float> f; }
Again the issue happens if foo.cpp is first compiled as static library and link with main.o. [Note: it is a pattern I observed where the issue happens; such a simple program does not reproduce the issue I mentioned! ]
- I come up a workaround solution: I found the issue happens if the static library is linked directly; I get the issue resolved by using -l switch, something is similar as below:
dpcpp -g -fPIC main.o libfoo.a #This will trigger the issue in 2021.2, but not in 2021.1
dpcpp -g -fPIC main.o -L. -lfoo #This way will solve the issue in 2021.2
I hope the information above could give some ideas to Intel engineer finding the root cause of myissue in 2021.2.
Regards,
Amon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for contacting Intel® Support. Let me reproduce first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you provide complete code that reproduces your issue (the simpler the better), rather than the pattern.
I tried to reproduce your issue, and tried to add something into the pattern, still couldn't reproduce your issue. So, I think the complete code is better.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I will need more information to help with this. I tried to reproduce your issue, and tried to add something into the pattern, still couldn't reproduce your issue. Could you send the entire code that can reproduce this issue?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I will need more information to help with this. Could you send the entire code that can reproduce this issue? If not, I will assume that you have found a solution on your own and I will close this issue in 5 days.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've had the same issue with this library https://github.com/llohse/libnpy, if it is included in a library that is linked the compilation fails with the error:
InvalidModule: Invalid SPIR-V module: Casts from private/local/global address space are allowed only to generic
llvm-foreach:
dpcpp: error: llvm-spirv command failed with exit code 1 (use -v to see invocation)
when it is linked to the main executable.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page