Just as I got my system up to date with the latest driver, I noticed that -save-temp option is not doing anything. Is it removed or replaced with something else?
OS: win7 64bit
(I have to say good things too: I have two cards from different series/architectures in a single system and they're working together very well. Thumbs up! )
Here is the exact way I tried:
clBuildProgram(FProgram,1,@OwnerDevice.FDeviceId,'-save-temps='+tempDir+'\cl -fno-bin-source -fno-bin-llvmir -fno-bin-amdil',....
This builds an opencl elf wich contains only the binary section in it. And this happens:
before 13.4: It produces the disassembled .isa textfile at the specified path.
13.4: It produces no temporary files at all.
I'm not sure if it's either a security thing or a bug.
For security reasons I think it can make harder to reverse-engineer a binary_only .elf file. But it is also makes harder to develop an assembler or a machine code generator because most of the instruction encodings can be learnt from the built in disassembler feature.
From now the disassembler is only works for instructions generated by amd_il, and it can't disassemble any binary stream.
I asked some people, and it looks the option should work. I had checked " -save-temps " in clBuildProgram API, and could generate the intermediate files using the internal drivers on a linux machine. Can you please try to generate the files in the executable folder or to give the complete path for the intermediate files. I have not checked with 13.4 driver and windows yet, will try in case the issue still exists.
I'm saving it into a specified path: '-save-temps=c:\$ocl_tmp\cl -fno-bin-source -fno-bin-llvmir -fno-bin-amdil -fbin-exe'
It ONLY FAILS when I use 13.4 AND give it an .elf with only the executable section in it. If I give it an elf containing only an .il section or only an OpenCL section, then it works fine.
Sorry I can't try local directory right now, as I don't have 13.4 too.
I am able to generate intermediate files using Win7 and catalyst 13.4 for APP SDK Samples. As you mentioned the save-temps option is not working when only executable section of the ELF is passed to it. Can you tell some steps to do this?
I was thinking of using --dump option with "-fno-bin-llvmir -fno-bin-amdil" flags. And then loading the binary generated via the dump process. Can you confirm whether this method is appropriate.
Hi, thanks for spending your time on this!
Here are the steps:
0. win7 64bit, cat 13.4
1. Download this small test kernel -> http://x.pgy.hu/~worm/het/disasm_test.zip /test.elf (note this kernel is for Capeverde, and it runs perfectly)
2. Call clCreateProgramWithBinary() to upload it to OpenCL
3. Call clBuildProgram() with "-save-temps=c:\$ocl_tmp\cl -fno-bin-source -fno-bin-llvmir -fno-bin-amdil -fbin-exe" parameters. (you'll need Admin rights to do this)
4. Check c:\$ocl_tmp dir and there will be nothing.
If you do the above on cat12.10, then you'll find an .isa file containing 11 disassembled gcn assembly instructions.
Additional info: The following things still works on 13.4:
- the http://x.pgy.hu/~worm/het/disasm_test.zip /test_il.elf file is an .elf that contains only an il file. If you give it to clCreateProgramWithBinary(), clBuildProgram(with above exe-only commandline), and then -> .il, .isa files will be generated.
- also if you compile an opencl file with clCreateProgramWithSource(), clBuildProgram(with above exe-only commandline), then -> .il, .isa, .ocl files are generated
Only in cases when an executable only .elf is given to clCreateProgramWithBinary(), clBuildProgram() will refuse to generate .isa disassembled image.
Thanks for the steps. But out of curiosity, i am interested in knowing, how to create the elf file with just binary. The method i had explained was also not producing any intermediate files with 13.4 driver. Also a normal OpenCL kernel was producing il, isa files as expected.
Checking with 12.10 driver will be a bit of a work for me too.