cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

cuijing
Journeyman III

clLinkProgram crashes when trying to create program from bitcode file. An unhandled exception is thrown out from "amdocl12cl64.dll"

I tried to create opencl program from bitcode file. I used clang to convert *.cl file to *.bc file by calling command

clang -cc1 -emit-llvm-bc -triple spir64-unknown-unknown -cl-std=CL1.2 -cl-spir-compile-options "-cl-std=CL1.2" -include opencl_spir.h test1.cl -o test1.bc

In host program, I loaded test1.bc and created program by clCreateProgramWithBinary. Then, I compiled program by clCompileProgram. So far so good. However, when I called clLinkProgram to link compiled program, an unhandled exception was thrown out from "amdocl12cl64.dll". I attached error message screen shot, cl file and bitcode file.

For some other cl files with simple implementation, such as adding two images, it worked all well. But for the implementations as shown in test1.cl (unsharp mask calculation) which iterates 2D neighborhood, crash would happen. I've been stuck here for three days.

Does anybody know any clue about this? Please help me.

0 Likes
11 Replies
dipak
Big Boss

Hi Jing,

My apologies for this delayed reply.  I'll check the binary and get back to shortly. Meanwhile, it would be helpful if you can share your setup details and relevant host-side code. Btw, do you see the same error if you use clBuildProgram instead of separate compile and link?

Regards,

0 Likes

Dear dipak,

Thanks for you reply. My GPU card is AMD FirePro V3900. The OpenCL version

is 1.2. "cl_khr_spir" is supported. Actually, I first used clBuildProgram.

It crashed with the same message. Then I changed to clCompileProgram and

clLinkProgram. I found it actually crashed at clLinkProgram. The host side

code is as follows:

std::ifstream ifs(".
Shaders
test1.bc", std::ios_base::in |

std::ios_base::binary);

if (!ifs.good())

{

FDebugPrintf("cannot open file: %s", "
Shaders
test1.bc");

return ERROR_FILE_NOT_FOUND;

}

ifs.seekg(0, std::ios_base::end);

size_t stBinary = ifs.tellg();

ifs.seekg(0, std::ios_base::beg);

char* pData = new char[stBinary];

ifs.read(pData, stBinary);

ifs.close();

clProgram = clCreateProgramWithBinary(openCLApp.context, 1, &openCLApp.device,

(const size_t) &stBinary, (const unsigned char*) &pData, NULL, &status);

delete[] pData;

status = clCompileProgram(clProgram, 1, &openCLApp.device, "-x spir", 0,

NULL, NULL, NULL, NULL);

clProgram = clLinkProgram(openCLApp.context, 0, 0, 0, 1, &clProgram, NULL,

NULL, &status);

//status = clBuildProgram(clProgram, 1, &openCLApp.device, "-x spir

-cl-std=CL1.2 -cl-opt-disable", NULL, NULL);

Thank you very much.

Jing

0 Likes

Hi,

I was able to build your binary code successfully using one of our SDK samples (AMD APP SDK\3.0\samples\opencl\cl\1.x\SimpleSPIR). I just replaced existing SPIR file (MatrixTranspose_SPIR.fe.bc) with your binary file and the code worked fine (got error CL_INVALID_KERNEL_NAME which is expected). Could you please check that sample and share your findings?

Regards,

0 Likes

Dipak,

Thank you for your suggestion. I tried to replace the

"MatrixTranspose_SPIR.fe.bc" with "test1.bc" (the binary file I uploaded)

in simpleSPIR project. It still crashed with the same error message. I

attached the screen shot.

If I replace "test1.bc" with "MatrixTranspose_SPIR.fe.bc" in my host code.

It can be built successfully.

My GPU card is AMD Firepro V3900. Following is the driver version which

supports OpenCL 1.2 and spir. I am wondering whether this is a special

issue only associated with this GPU card on some particular OpenCL C

statements. I think this is the latest driver for this GPU card. Is that

right?

Thank you.

Jing

0 Likes

Yes, 15.201.2401 is the latest driver available for FirePro V3900.

Today I tried with this driver on a FirePro V5900 card (as I couldn't manage the FirePro V3900 card here) and it still worked fine. Last time, I checked it on two Radeon cards with two different drivers.

At this moment, I'm not sure whether the issue is specific to your card (or setup) or something else. I'll check with the concerned team. Also, I'll try to manage a FirePro V3900 card. Please share your clinfo output and system details.

If you've other cards,  you may check the same to see whether you still observe the error or not. Btw, is it working if you build the binary for CPU device?

Regards,

0 Likes

Dear Dipak,

Sorry for my late reply. This week I was busy with other emergent tasks. As

what you suggested, I tried to build the binary code on CPU device. It

worked fine. I just bought another AMD GPU card, Radeon R9 390. After I

install the new GPU card on my PC, I will build the binary code and let you

know the results.

I tried to build the binary code (test1.bc) in the SimpleSPIR project in

SDK by replacing "MatrixTranspose_SPIR.fe.bc" with "test1.bc".

CLBuildProgram crashes with the same error msg. If I replace

"test1.bc" with "MatrixTranspose_SPIR.fe.bc" in my project, it worked

fine. CLBuildProgram can build successfully. So I guess my setting should

be fine.

If you can find FirePro V3900 GPU card, please try to build "test1.bc" on

it. It seems this crash only happens with this piece of code and FirePro

V3900. If you have any findings, please let me know.

Thank you.

Jing

0 Likes

Hi Jing,

Could you please check the attached spir binary files I generated from your kernel file?

As I checked with the SimpleSPIR project, both the files worked fine.

Regards,

0 Likes

Dear Dipak,

Yes. Could you please send me the binary file?

Thank you.

Jing

0 Likes

I already sent you the binary files. Please find the attached files (test1_1.bc.zip, test1_2.bc.zip) from my previous reply.

0 Likes

Dear dipak,

Sorry for my late reply. I got the binary files (test1_1.bc and test1_2.bc)

and tried to build them in simpleSPIR project. Both of them worked fine.

But when I tried to build them in my project, crash still happened. I don't

know the reason. Do you have any clue about this?

Thank you.

Jing

0 Likes

Sorry for this delayed reply. I was on vacation so couldn't check the project.

It seems that build option "-cl-opt-disable" (or "-O0") might be the reason. Could you please remove the build option "-cl-opt-disable" (shown below) and check?

status = clBuildProgram(clProgram, 1, &openCLApp.device, "-x spir -cl-std=CL1.2 -cl-opt-disable", NULL, NULL);

Regards,