asfermi vs. ptxas

259 views
Skip to first unread message

Jianbin Fang

unread,
Apr 24, 2012, 4:04:05 PM4/24/12
to asfermi
Hi all,

I have a question about the assembler: NV provides us an assembler,
named ptxas, which can transform PTX code into cubin code. When
reading the docs about asfermi, I find the materials are a little bit
confusing. The output format is also a cubin file? If so, how can we
get to know the ISA opcode? What are the input (it is a specified
format because the docs mention a lot about the 'sourceformat')?


Jianbin

Hou Yunqing

unread,
Apr 24, 2012, 11:39:02 PM4/24/12
to asf...@googlegroups.com
Hi Jianbin,

NV does put an ISA disassembler in the toolkit, cuobjdump. From there you can learn all the instruction mnemonics. But if you do mean opcode, they are here. Also, asfermi needs directives in order to work.

Yunqing

Jianbin Fang

unread,
Apr 25, 2012, 3:09:20 AM4/25/12
to asfermi
So, the output format is defined by ourselves (it really depends on
the assembler). Another question: since the NV has provided the tools
(1. ptxas; 2. cuobjdump as shown below), why do we have to develop
another assembler? What are the differences from ptxas? Are we
emulating ptxas? Could you explain a little more about that?

(1) ptx -- > ptxas --> cudabin;
(2) cudabin --> cuobjdump --> ptx


Jianbin

On Apr 25, 5:39 am, Hou Yunqing <hyq.neu...@gmail.com> wrote:
> Hi Jianbin,
>
> NV does put an ISA disassembler in the toolkit, cuobjdump. From there you
> can learn all the instruction mnemonics. But if you do mean opcode, they
> are here <http://code.google.com/p/asfermi/wiki/nanb>. Also, asfermi needs
> directives <http://code.google.com/p/asfermi/wiki/Directives> in order to

Hou Yunqing

unread,
Apr 25, 2012, 4:12:48 AM4/25/12
to asf...@googlegroups.com
PTX is a virtual ISA. The output of cuobjdump is the native ISA disassembly. If you read the output of cuobjdump you'll realise it's quite different from normal PTX. With a virtual ISA assembler, you have limited low-level access. asfermi does native ISA assembly which helps if you need to do nasty things or things that ptxas isn't happy with.

The flow thing you gave is more like this:
1. ptx -> native ISA -> cubin (the entire process is done by ptxas)
2. cubin -> cuobjdump -> native ISA disassembly (this is not ptx)

Just spend a bit time playing around with ptxas and cuobjdump and you'll get it. (it surely helps to read a bit more on the NV documents)

Jianbin Fang

unread,
Apr 25, 2012, 8:18:01 AM4/25/12
to asfermi
Thanks, It looks much clear now.

swp...@gmail.com

unread,
Aug 28, 2012, 7:27:45 AM8/28/12
to asf...@googlegroups.com
Hi all,

I have another question about the assembler. 
According to the documents of the asfermi, it seems that the compilation flow is :
     Native assembly  -------------> Native binary
                                asfermi
instead of :
     PTX -------------> Native binary
     asfermi 

If so, in order to use asfermi, we should use ptxas to translate ptx to cubin, then use cuobjdump to get native assembly, and finally use the asfermi. Or just code native assembly.

Is my thought right?


Anthony

Hou Yunqing

unread,
Aug 28, 2012, 9:15:24 AM8/28/12
to asf...@googlegroups.com
Hi Anthony,

Yes you are right. If you are comfortable with coding directly in the
native ISA, of course you can write native ISA straightaway. If you
are not, you may choose to go from
PTX--ptxas-->cubin----cuobjdump-->disassembled ISA, modify the
disassembly in the way you want, and then reassemble it using asfermi.
If you want to code directly, it helps to read the output of cuobjdump
on your own kernels so you can familiarise yourself with the ISA.

But it's worth noting that asfermi doesn't support every Fermi
instruction, and so far we haven't gathered the information we need to
enable software scheduling for Kepler, without which the code on
Kepler runs significantly slower.

Cheers,
Yunqing

swp...@gmail.com

unread,
Aug 29, 2012, 2:55:13 AM8/29/12
to asf...@googlegroups.com
Thanks! I get it.

Well....

Actually, I'm looking for the open source assembler like ptxas that translates ptx into cubin. It seems that the 
asfermi is not sutiable for me. Is it another way or another tool that can help me?


Anthony

Hou Yunqing於 2012年8月28日星期二UTC+8下午9時15分25秒寫道:
Reply all
Reply to author
Forward
0 new messages