Skip to content

[SYCL] LLVM ERROR: OCL version mismatch while building test application #3

Closed
@kpet

Description

@kpet

Building the simple test application using the 1-step flow results in the following behaviour:

$ ./bin/clang++ -std=c++11 -fsycl -I/path/to/OpenCL-Headers/ simple-sycl-app.cpp -o simple-sycl-app -lsycl  /path/to/opencllib.so
LLVM ERROR: OCL version mismatch
/tmp/simple-sycl-app-e14b6d.o: file not recognised: File truncated
clang-8: error: sycl-link command failed with exit code 1 (use -v to see invocation)
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)

FYI /path/to/opencllib.so contains a version of the SPIRV-LLVM translator.

With the following hack:

--- a/llvm-spirv/lib/SPIRV/OCLUtil.cpp
+++ b/llvm-spirv/lib/SPIRV/OCLUtil.cpp
@@ -231,11 +231,14 @@ unsigned getOCLVersion(Module *M, bool AllowMulti) {
     return std::make_pair(getMDOperandAsInt(MD, 0), getMDOperandAsInt(MD, 1));
   };
   auto Ver = GetVer(0);
+#if 0
   for (unsigned I = 1, E = NamedMD->getNumOperands(); I != E; ++I)
     if (Ver != GetVer(I))
       report_fatal_error("OCL version mismatch");
-
   return encodeOCLVer(Ver.first, Ver.second, 0);
+#else
+  return encodeOCLVer(2, 1, 0);
+#endif
 }

 void decodeMDNode(MDNode *N, unsigned &X, unsigned &Y, unsigned &Z) {

the build succeeds.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions