Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
16 Views

Unable to run SPIR code with Intel's OpenCL drivers

I am unable to pass a pointer to a kernel using intel's OpenCL drivers for Intel(R) Xeon(R) CPU E3-1245 v3 @ 3.40GHz on Linux.

I was able to get the program to work using AMD's CPU OpenCL drivers instead.

Any idea what the issue could be?

Also, I've been able to execute SPIR kernels on intel that do not have pointer arguments.

I uploaded the example program and kernel I've been working with.

0 Kudos
7 Replies
Highlighted
Employee
16 Views

Hi Ryan, I didn't try your method of generating SPIR binary (using modified Clang) yet - I will try to get the status of the code in repository. On the other hand I tried to generate SPIR binary by using our offline compiler tool:
> ioc64 -input=add.cl -spir64=add.bc -bo="-cl-std=CL1.2"
And your program sucessfully consumed generated SPIR. Thanks, Yuri
0 Kudos
Highlighted
Beginner
16 Views

Thanks for the update Yuri.

Were you able to reproduce the problem with the SPIR that I supplied? and could you attach the SPIR that ioc64 generated so that I can compare? 

0 Kudos
Highlighted
Employee
16 Views

Yes, your version of SPIR file reproduces the problem. I have forwarded it to developers to have a look. Current assumption/understanding that the code in https://github.com/KhronosGroup/SPIR should be up-to-date, but it will take some time to analyze the root cause of discrepancy. I have attached SPIR generated by ioc64. BTW, this tool is a part of Intel OpenCL SDK, so you may use it to generate SPIR files. Thanks, Yuri
0 Kudos
Highlighted
Beginner
16 Views

any progress with this?

I did some investigating and it looks like you have a bug reading the binary format for LLVM IR. 

If I take the binary generated from ioc64

ioc64 -input=add.cl -spir64=add.bc -bo="-cl-std=CL1.2"

It runs. But then if I disassemble and reassemble the binary using llvm

llvm-dis add.bc -o add.ll

llvm-as add.ll -o add.bc

the program crashes.

0 Kudos
Highlighted
Employee
16 Views

Hi Ryan,

LLVM is not equal SPIR - two different things, though one is based on another. So, disassembly and reassembly of SPIR binary with LLVM tools is not supported.

0 Kudos
Highlighted
Beginner
16 Views

No, that's not at all correct. From the 1.2 SPIR spec page 6:

"""SPIR is a mapping from the OpenCL C programming language into LLVM IR""" 

This means that SPIR is conforming LLVM IR and you can use the LLVM tools llvm-as and llvm-dis which convert between textual LLVM IR and LLVM bitcode.

0 Kudos
Highlighted
Employee
16 Views

Hi Ryan,

Do you know that this works for any other vendor toolchains? Do they provide their own versions of llvm-dis and llvm-as? We don't provide llvm-as, as far as I know, so if it were to work, your version of LLVM distribution should match ours. I am trying to find out which version of LLVM we use as a base.

 

0 Kudos