KhronosGroup/SPIR

#spirv-1.0 Undeclared identifier 'createSPIRVWriterPass'

Closed this issue · 5 comments

I encountered the following error while trying to compile branch spirv-1.0:

[1424/1526] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/BackendUtil.cpp.o
FAILED: /usr/bin/clang++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/lib/CodeGen -I../tools/clang/lib/CodeGen -I../tools/clang/include -Itools/clang/include -Iinclude -I../include -D_GLIBCXX_USE_CXX11_ABI=0  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -Wno-nested-anon-types -g -fPIC   -fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/BackendUtil.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/BackendUtil.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/BackendUtil.cpp.o -c ../tools/clang/lib/CodeGen/BackendUtil.cpp
In file included from ../tools/clang/lib/CodeGen/BackendUtil.cpp:21:
In file included from ../include/llvm/IR/DataLayout.h:25:
In file included from ../include/llvm/IR/DerivedTypes.h:21:
In file included from ../include/llvm/IR/Type.h:19:
../include/llvm/ADT/APFloat.h:352:12: warning: redundant move in return statement [-Wredundant-move]
    return std::move(Value);
           ^
../include/llvm/ADT/APFloat.h:352:12: note: remove std::move call here
    return std::move(Value);
           ^~~~~~~~~~     ~
../tools/clang/lib/CodeGen/BackendUtil.cpp:601:31: error: use of undeclared identifier 'createSPIRVWriterPass'
    getPerModulePasses()->add(createSPIRVWriterPass(*OS));

Oh! Found 'createSPIRVWriterPass': I was using the spirv-backend branch from LLVM, but it is only defined on branch khronos/spirv-3.6.1. Which LLVM branch is it best to use alongside branch spirv-1.0 from this repo?

The one described in the README obviously… --" Nevermind!

bader commented

Hi Pierre, indeed I didn't test it with spirv-backend.
So far the main development branch was khronos/spirv-3.6.1.
spirv-backed seems to be a bit outdated.
I'm have no preference to which interface to use as long as it can integrated with clang. We can either switch to spirv-backend branch or merge it to khronos/spirv-3.6.1.

I will try to keep spirv-backend up to date. Currently it is mainly for prototyping so there may be some delay.

Whatever you think is best suited for the task. If it is decided to go for spirv-backend, the READMEs would need some update. :-)