When launch independent kernels in different stream, how these kernels dispatch to sm, multi-streams kernel can run in one sm?
For Hopper Arch, assume block_per_sm = 2 for this kernel;
If blocks = 1, issue 132 stream, each stream launch independent kernel, each sm process one stream kernel?
If block = 132, issue 2 stream, previous 66 sm process stream0, last 66 sm process stream1? or one sm can process multi stream kernel concurrent ?
If block = 264, issue 2 stream, streams kernel is processed serially? or sm can process different streams kernel in round robin?
As to hopper cluster, how about multi-stream kernel?
Yes, threadblocks of two different kernels can occupy the same SM at the same time. In fact, it would be required for them to be in different streams, in order to witness such a thing. Kernels launched into the same stream have no possibility (almost, see the next post in the thread) to run concurrently, due to stream semantics.
I guess you are asking would the CWD/block scheduler deposit one block (each kernel has only 1 block) per SM. Yes, probably. (There might be other factors to consider for that many streams, but we can set that aside for a conceptual discussion here).
Such level of detail is not specified by CUDA. My expectation is that if the kernel launches are close enough to each other, nearly any block distribution across SMs would be possible. If the kernel launches are sufficiently separated temporally, then my expectation is that the CWD/block scheduler would distribute the blocks of the first kernel to the SMs, in an “even” fashion (because that is consistent with best performance, not because I can point to a specification or guarantee). After the first kernel is distributed, the second kernel is launched. It also has 132 blocks, and each SM in the GPU has 1 block resident, and space for 1 more. So my expectation is that the CWD/block-scheduler, on receiving the 2nd kernel, would again distribute 1 block per SM. (see example test case below for this case)
Yes, as I have stated already, one SM can have blocks deposited on it from two or more separate kernels. In order for that statement to be true, those kernels would have to belong to separate streams.
Sorry, I don’t understand the remaining questions. AFAIK there is no such thing as a “multi-stream kernel”. A single kernel launch in CUDA always has one, and only one stream that it is launched into.
If you wish to argue the point I made that “two blocks, belonging to separate kernels, and therefore separate streams, can be coresident on a SM”, since I don’t have a reference for that at my fingertips, my suggestion is that a relatively simple test can be used to prove this. Here is an example test. This was run on a L4 GPU (58 SMs). I claim it offers conclusive evidence that threadblocks of two separate kernels, launched into two separate streams, are executing at the same time, on the same SM: