Detailed explanation for instructions

177 views
Skip to first unread message

Ming Wei

unread,
Mar 10, 2016, 1:31:14 AM3/10/16
to MaxAs
Hi Scott,

I am trying to use MaxAs to write highly optimized kernels for CUDA. MaxAs is a fascinating tool, but I fail to find a detailed "instruction reference manual" for it. For example, what does "XMAD.PSL.CBCC" mean? Skimming through CUDA Binary Utilities Document, I can only find XMAD means Integer Short Multiply Add, but no knowledge about "PSL.CBCC".

Could you help me with that? Where can I find the information that I need?

Thanks in advance.

Best Regards,
Ming

Scott Gray

unread,
Mar 10, 2016, 3:08:16 PM3/10/16
to Ming Wei, MaxAs
Maxas is designed for experienced cuda programmers who aren't shy about examining compiled sass.  With enough of this you're already a good ways towards understanding the ISA.

XMAD is one of the more complicated instructions.  It's a 16 bit multiply 32 bit accumulate which has several modes to let you combine instructions to achieve wider bit multiplication.

I typically use 3 sequences:

A single unsigned 16bit mad (flags for signed mode are available):

XMAD d, a, b, c;


A 16 bit times a 32 bit:

XMAD d, a, b, c;
XMAD.PSL d, a.H1, b, d;
or
XMAD d, a, b, c;
XMAD.PSL d, a, b.H1, d;


A 32 bit times a 32 bit and just keeping the lower 32 bits of result:

XMAD.MRG x, a, b.H1, RZ;
XMAD d, a, b, c;
XMAD.PSL.CBCC d, a.H1, x.H1, d;

But there are many other modes to explore, and VMAD is also a similar instruction but lets you add sign operations.

Basically you'll need to study the MaxasGrammar file.  I look at that file pretty frequently to find instructions and their flags.


--
You received this message because you are subscribed to the Google Groups "MaxAs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxas-discus...@googlegroups.com.
To post to this group, send email to maxas-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/maxas-discuss/ad5de728-413d-4f74-8547-5a0348aa9135%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ming Wei

unread,
Mar 24, 2016, 3:46:52 AM3/24/16
to MaxAs, wei...@megvii.com
Sorry for the late response. I'll try to figure it out from looking into MaxasGrammar file and the compiled sass, thanks :) 
Reply all
Reply to author
Forward
0 new messages