I’m not aware of any explicit documentation defining “vector expression”, however there are numerous mentions of vectors in the ptx guide.
Probably the most relevant section is here, from which we can surmise that a PTX vector expression is either:
- a PTX vector (variable in the) register (space)
(or) - a brace enclosed list of scalar registers of appropriate length and type
For example, this is evidently a vector expression:
{%4, %5, %6, %7}
in the context of inline PTX.
You can always file a bug to request doc clarifications.
I’m not aware of any issues there. The ptxas tool should flag illegal usage or combinations.
Again, no issues that I am aware of. The inline PTX manual specifically states that this is acceptable:
You can also repeat a reference, e.g.:
asm("add.s32 %0, %1, %1;" : "=r"(i) : "r"(k));
In all of this, it may be useful to keep in mind that PTX applies to a virtual machine model. The actual machine (i.e. SASS) certainly has a notion of vector registers also, and I believe that in that case, the SASS instruction operands must align to a linear register order for the base registers that “compose” a vector register. But SASS is not documented to this level, so that is just my conjecture based on observations. The key point is that a “seemingly” unordered set of registers in a PTX vector expression is probably meaningless (my guess). When the ptxas tool compiles your PTX code to SASS, it is probably going to use actual machine registers of its own choosing, and it may well do some amount of register “swizzling” (i.e. explicit data exchanges) to make everything work. Again, a purely observational notion of mine.