That's a good idea to keep in mind.  In hici() in particular we assume the jumps will all predict correctly because we will be hashing elements of the same length repeatedly.

Henry Rich

On 4/10/2022 4:42 AM, Elijah Stone wrote:
hici is a decent example.  The branches at the end can be eliminated by unconditionally hashing the last two words of the input (as by v[k-2] and v[k-1], if v and k were never modified).  In the event that the number of words to be hashed is a multiple of 3 or one more than a multiple of 3, some words will be hashed more than once, but this is harmless.  At a rough estimate, this costs 10 cycles for random inputs.  (For batch inputs, such as i. on skinny matrices, the branch wins, but a transposed-ish traversal order will do better still, so it doesn't matter much.)

On Sat, 9 Apr 2022, Henry Rich wrote:

If you show me an example I'd be obliged.

Henry Rich

On 4/9/2022 10:19 PM, Elijah Stone wrote:
Duff's device is a technique for loop unrolling which involves jumping into the middle of the unrolled loop.  Overlapping access is an alternate technique also useful for loop unrolling (as well as arranging for aligned access), which involves doing a small amount of redundant work, but saves branches.  Though it is slightly less general, this tends to be more performant on modern hardware.

On Sat, 9 Apr 2022, Henry Rich wrote:

I don't understand the last sentence. 'duff'? 'overlapping access'?

Henry Rich

On 4/9/2022 9:37 PM, Elijah Stone wrote:
On Sat, 9 Apr 2022, Henry Rich wrote:

JE generally does few data-dependent branches, and I expect it would not be a good idea to use two hyperthreads in one core; but you'll have to make that decision.

Branch miss is tens of cycles; cache miss is hundreds.

Re branches: from what I've seen, there is too much duff and not enough overlapping access.  Though I guess those are metadata-dependent branches, not data-dependent branches :) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to