Hello, I have a question about the register in ptx.
According to the documentation Registers are not addressable in this case I do not know exactly what it means
my question would be is it possible to create arrays in ptx as we can do with Assembly registers by using .align and incrementing the pointers ?
second question, if you can’t do it, should you unbind the loops in your code to explicitly call the variables?
this does not lead to much latency in the transfer of instructions ?
No. Not in PTX. That’s an example of what it means to say it is not addressable.
Yes, this would be an example of loop unrolling, and why the compiler unrolls loops, in many cases.
The compiler often does it, because the compiler believes in many cases it is preferable for performance. I can’t give any more authoritative answer than that. The specific case may matter.
thank you very much for your answer, this becomes clearer for me
by curiosity for the Sass language is it not possible to create Array ?
that I don’t master yet even if this one interests me even if I’m not sure that it brings something more than ptx
SASS is not something that you have direct source control over. There is no user-enabled SASS programming toolchain. You can create source code for CUDA C++ or CUDA PTX. These (eventually) get compiled to SASS to actually execute.
AFAIK there is no ability to take the address of a register in SASS. I’m not sure this sort of statement is documented anywhere.
FWIW I have done a small amount of x86 assembly programming, but I never used the methodology you speak of, so I’m unfamiliar with it. You can take the address of EAX (for example) in x86 assembly? Interesting.
This seems to be conflating two issues:
(1) Can one index into the register file? One cannot do that in PTX, or the assembly languages of x86, or ARM, or PowerPC, etc processors. The only processor architecture I am aware of that had (limited) indexed access to its register file was one of DEC’s PDP platforms (I think the PDP-8. Fifty years ago).
(2) Can one index into an array of data in memory, using a register as a pointer? One can do that in PTX, and x86, and ARM, and PowerPC, etc. The available addressing modes are architecture specific. For PTX, see section “6.4. Using Addresses, Arrays, and Vectors” of the PTX manual.
I have no idea what this means. “unbinding loops”: doesn’t parse. “call variables”: doesn’t parse.
On a more general note: I would strongly advise against programming at PTX level. As opposed to classical ISAs with their associated assembly languages, which (with possible exception of certain pseudo-onstructions or synthetic instructions) offer 1-to-1 translation of assembly code to machine code, PTX is a virtual ISA and intermediate compiler representation that is compiled into machine code by an optimizing compiler. To paraphrase D. Knuth, the two rules of PTX programming are:
- Don’t do it.
- (Experts only!) Don’ do it yet.
thank you for your expertise it was what I miss to have a good understanding of the ptx
Sorry if I’m not clear I don’t speak English