Thread #108599109
File: 1759681527GcyKI5nXEf_hdg.png (87.1 KB)
87.1 KB PNG
>but chud branch predictor, what if-
>it won't
54 RepliesView Thread
>>
File: chuddy.png (275.9 KB)
275.9 KB PNG
>the loop... has ended...
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
File: 17375159400163.png (48.5 KB)
48.5 KB PNG
>s[i] == '\0'
>>
>>
>>
>>
File: spectre.png (136.4 KB)
136.4 KB PNG
>but chud branch predictor, you're accessing memory at an address that's a function of privileged data without bound checking!
>If something happens, you'll load a specific byte to cache which the current thread can extract via a timing attack, inferring the contents of the privileged memory!
>>
File: 1743628183976710.jpg (105 KB)
105 KB JPG
>>108599109
The Linux kernel code is full of theseif (unlikely(ptr))
return 0;
>>
>>
>>
>>
>>
>>
>>
>>
>>108601730
If you use self modifying code to skip branches, then I assume you mean removing branches from the machine code in memory, right?
The problem is that this invalidates the instruction cache line for the branch, which will cause a far worse stall than a mispredicted branch.
If you determine at runtime that your code always or never takes a branch, then it's probably marginally better to pay the stall penalty once, rather than use up space in the branch predictor.
If your branch is sometimes taken, then it's basically never worth it to modify the instruction on that condition. The branch predictor will essentially do that for you in a much faster way.
>>
>>
>>108601622
You backpatch at least 64 bytes behind if you’re worried about your precious cache line.
> my code fits in a cache line
Good, but unroll the first iteration of it. The first iteration patches the next before the prefetch, and the subsequent iteration(s) patch the first or previous unrolled iteration.
>>
File: 1775926991428056.jpg (11.1 KB)
11.1 KB JPG
>>108600155
Just finished modding some extra L1 onto my rig, taking my girl out to celebrate. Now my shit is SO cache
>>
>>
>>
>>
File: 1775862879889090.jpg (175.8 KB)
175.8 KB JPG
>>108599109
>Branch predictor chad trying to create certainty in an uncertain future, succeeding 99% of the time
>>
File: 1763983553179346.jpg (2.8 MB)
2.8 MB JPG
>>108599810
The pipeline has stalled...
>>
>>
>>
>>
>>
>>
File: billions_must_fly.png (161.4 KB)
161.4 KB PNG
>>108607644
He just has great pattern recognition.
>>
>>
File: IMG_0620.jpg (40.5 KB)
40.5 KB JPG
>>108607644
Cache is getting warm bros
>>
>>
>>
>>
File: 1775944940836194.gif (2.4 MB)
2.4 MB GIF
open the port. now.
>>
File: 1770650800708598.png (371 KB)
371 KB PNG
>>108599109
op from original thread here. nice to see that this joke is still funny to some people
>>
>>
File: chud time.jpg (244.4 KB)
244.4 KB JPG
BILLIONS of instructions must execute.
Per second.
Total Instruction Execution
>>
>>
File: giga_chad.jpg (58.9 KB)
58.9 KB JPG
Megabytes?
>>
File: 61DzCZUwryL.jpg (78.5 KB)
78.5 KB JPG
>>108599109
0x90 ever happens
>>