Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we eliminate all negative numbers in the weight matrixs? #19

Open
gongxiaozhang opened this issue Sep 18, 2023 · 3 comments
Open

Comments

@gongxiaozhang
Copy link

gongxiaozhang commented Sep 18, 2023

I found that there are many negative numbers in the weight matrixs. From what I see, this is because a certain modifier is omitted for some instruction . Such as the F2I_R_R instruction of SM_70, it has many data type modifers , for example "U64, S64, U32, S16, U8, S8", but the default "S32" type is omitted. If we add the "S32" modifier back,then after resolving the weight, we will get a matrix without negative number. Is there a reliable way to achieve this function?

@cloudcores
Copy link
Owner

Surely it's possible and doable, all you need is a table to append those default modifiers back, and updating result of CuInsParser.parse accordingly. You may even get all distinct bit fields of those groups of modifiers!

However, due to variaries of SASS instructions, this usually means quite amount of human work. Since most end users does not care about encodings and weights, current approach is a reliable way to assemble those back. IMHO, the only benificial scenario for doing this is you need to make a simulator according to binary encodings.

If you really need this, you may check current weight matrix for instructions that may have default modifiers. But be cautious for those dummy modifiers with zero weights, such as IADD in IMAD. And there are some modifiers always appears simultaneously.

@gongxiaozhang
Copy link
Author

Thanks for reply. We do working on a simulator of the Volta arch indeed.
What about this assumption ?
(1)Firstly,If the weight matrix contains negative number,then the instruction should have only one default modifier.
(2)Secondly,IF an Instance of that instruction does not contain any modifer which corresponding to a negetive weight value,it should include the default modifier.
IF both,based on current weight matrix, we update the value V (dimension + 1), then solve the weight matrix(dimension + 1) for a second time. If this were possible,we can reduce lots of human work.

@cloudcores
Copy link
Owner

  1. It's not guaranteed that an instruction have at most ONE default modifier. For example, 'F2I' means 'F2I.S32.F32', and since 'F2I' will use a different opcode for 64bit types, you may consider it also contains a default modifier to specify it's a 32bit conversion.

  2. Default modifier does not mean other weights of same modifier bitfield should be negative, only the difference matters. If the weight of default modifier is the smallest(usually zero), then the weights of modifiers in the same bitfield will also be positive.

In a word, to make the decoding procedure complete and robust, a lot of human work seems not avoidable. Our current system is not aiming this target, thus it will not be trivial to achieve this goal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants