cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

realhet
Miniboss

Re: 13.4 -save-temp compiler option doesn't do anything

You can upload anything with clCreateProgram* including: - OpenCL source, .elf with only IL section in it.

Then you can use clBuildProgram with the flags -fno-bin-source -fno-bin-llvmir -fno-bin-amdil -fbin-exe to generate an Executable only .elf. At this point if you use -save-temps, it will generate the opencl, il and isa files.

After that you have an .elf that only contains the executable section. If you load it with clCreateProgram, and then ask clBuildProgram with -save-temps, it will not generate the .isa disasm (13.4 fails, 12.10 works fine).

The example files I linked:

test_il.elf -> it's an elf containing a small amd_il code, 10 lines of code.

test.elf -> whis is what clCreateProgramWithBinary() and clBuildProgram() compiled from test_il.elf with the -no-source -no-llvmir -no-amdil -yes-exe flags.

Both .elfs are tested and running prefectly but on 13.4 but only the amd_il elf can be disassembled (even there is no isa in it). The isa-only elf cannot be disassembled.

Important! These test.elf is for 13.4 and incompatible with previous catalysts!!!

On 12.10 everything I'm talking about is working good, don't even need to check it.


So the simplest test sequence is: OpenCL test program -> compile to executable only .elf -> save the .elf -> load it with a new clCreateProgram/clBuildProgram with -save-temps -> NO .ISA file generated on cat 13.4.


Thank you!

0 Likes
realhet
Miniboss

Re: 13.4 -save-temp compiler option doesn't do anything

I reinstalled 10.12 and generated an executable only test.elf. http://x.pgy.hu/~worm/het/test_12.10_gcn.elf

If you load it with clCreatePrg() and clBuildPrg( -save-temps ) you should find this disasm in the save-temps path:

; -------- Disassembly --------------------

shader main

  asic(SI_ASIC)

  type(CS)

  s_mulk_i32    s16, 0x0100                                 // 00000000: B8100100

  v_add_i32     v0, vcc, s16, v0                            // 00000004: 4A000010

  s_buffer_load_dword  s0, s[8:11], 0x00                    // 00000008: C2000900

  s_buffer_load_dword  s1, s[12:15], 0x00                   // 0000000C: C2008D00

  s_waitcnt     lgkmcnt(0)                                  // 00000010: BF8C007F

  v_mad_u32_u24  v2, v0, 4, s0                              // 00000014: D2860002 00010900

  v_add_i32     v3, vcc, s1, v0                             // 0000001C: 4A060001

  tbuffer_store_format_x  v3, v2, s[4:7], 0 offen format:[BUF_DATA_FORMAT_32,BUF_NUM_FORMAT_FLOAT] // 00000020: EBA41000 80010302

  s_endpgm                                                  // 00000028: BF810000

end

0 Likes
himanshu_gautam
Grandmaster

Re: 13.4 -save-temp compiler option doesn't do anything

Thanks. Will try it tomorrow

0 Likes
himanshu_gautam
Grandmaster

Re: 13.4 -save-temp compiler option doesn't do anything

Hi realhet,

Worked on it, and i do see the issue. I will attach my code soon.

Anyways I was thinking why were you trying to generate Dis-assembled files from binary only elf files?

0 Likes
realhet
Miniboss

Re: 13.4 -save-temp compiler option doesn't do anything

Hi and thanks!

Why: My GCN ISA assembler produces binary only files and the disassembler is the best feedback on what it does. Good to see the code disassembled by an official(!) tool before I send it to the card. In other words the disasm it's the most accurate 'documentation' on the GCN architecture. When there was no ISA documentation out yet (in 2012 1st half) the disassembler was the actual Southern Islands ISA documentation.

Also there are some other people out there who like to use your excellent hardware in the most efficient way (in binary ISA), but this disassembler restriction just makes us blind.

It's a choice between:

- Not using the latest driver

- Writing an own disasm (which would be a waste of time as AMD already has a good one )