Experimental SPIR-V back-end using OpenCL 2.1

Dear Daniel,

I was very interested in getting to know your work. I realized that a visual inspection is not enough, so I decided to build the tools to inspect how you are generating code for spir-v. I downloaded clang, llvm and openmp indicated by you in the email and start the build process. It happened that in this process I encountered a series of inconsistencies, and differences in functions signature, etc. I tried to solve them by modifying some of the files I set out below. This allowed me to continue a little, but as the changes started to require more meaningful changes, I decided to write to you counting with your help. I’m sorry if the email is large but I tried to describe the problems and solution alternatives I used. To facilitate your analysis, I used the git diff tool that explains my modifications. At the end of the text, I put the final result of the make process in two situations (for 1 thread and 4 threads). I would greatly appreciate feedback from you to complete this build process.

Follow the informations:

Hi Marcio,

thanks for your interest!

The compilation errors you get seem to result from LLVM and Clang being out of sync.

Please stash your changes and
make sure, you are on the llvm compute branch from thewilsonator,

(make sure, you also cloned the recursive subproject in target/spirv)

remote add and pull/merge upstream.

Do the same with my clang fork.
Delete your build folder and try again :blush:

If this still doesn’t work, please let me know and I will look tomorrow what is wrong.

Kind regards,


Thanks so much for the feedback Daniel!

In fact, I was not in the correct llvm branch. I changed it to the computer branch and also I cloned the https://github.com/thewilsonator/llvm-target-spirv.git into llvm/lib/target/SPIRV folder. Is that correct? I could not figure out which is the correct branch for your clang. So I kept the master branch, making sure that it is updated (via git pull) and I started the build process again. Now I have the error below. Do I still have sync issues between the tools? Thanks in advance.


[ 78%] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGBuiltin.cpp.o
/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9769:37: error:
no member named ‘nvvm_wmma_load_a_f16_col_stride’ in namespace
IID = isColMajor ? Intrinsic::nvvm_wmma_load_a_f16_col_stride

/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9770:37: error:
no member named 'nvvm_wmma_load_a_f16_row_stride' in namespace
: Intrinsic::nvvm_wmma_load_a_f16_row_stride;
/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9774:37: error:
no member named 'nvvm_wmma_load_b_f16_col_stride' in namespace
IID = isColMajor ? Intrinsic::nvvm_wmma_load_b_f16_col_stride

Seems like your clang and llvm still don’t fit together.
However, I rebased my clang fork, so please just force pull. The master branch is correct.
Or you can try these instructions:
git clone --recursive git checkout compute git remote add upstream git pull upstream master cd tools git clone (not necessary at the moment, but might be from time to time: git remote add upstream git pull upstream master ) Hope that works for you! Kind regards, Daniel

Thanks again Daniel.
Now I have successfully completed the build!

Kind regards,