- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am looking at the list of branch events for Ivy Bridge and when finding their descriptions I come across the following terms:
"near branches"
"macro branches"
"taken speculative"
What are the first two and what does the third mean? I thought the idea is to "predict" a branch, so I am unsure what the "speculative" means here?
The events in question are:
BR_MISP_RETIRED.NEAR_TAKEN
BR_MISP_RETIRED.ALL_BRANCHES
BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BR_MISP_RETIRED.ALL_BRANCHES - count all mispredicted macro branch instruction retired. Here "macro branch" means include all branch instructions and you can understand "macro" which is on instruction level.
BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL - count mispredicted indirect call branch instruction retired. Usually "indirect call", means there is no call address provided in compiling time, it depends on previous instructions' operation, for example "call address" will be stored in register, or address in memory. So if "call address" is known early - CPU can speculatively do "call"
BR_MISP_RETIRED.NEAR_TAKEN - count near call misprediction for instructions retired, "near call" means target address is in same segment of caller, just do 1: push EIP+1 to CS for return use 2. put EIP+offset as new EIP 3. execute EIP. Sometime, CPU can speculatively run "near call" early if call address is presented.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iliyapolak wrote:
"near branches"
Near branches are related to near conditional jump inside the same segment.
Hi there, thanks for replying.
What do you mean by "related to" exactly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Peter Wang (Intel) wrote:
BR_MISP_RETIRED.ALL_BRANCHES - count all mispredicted macro branch instruction retired. Here "macro branch" means include all branch instructions and you can understand "macro" which is on instruction level.
Hi. Could you clarify what you mean by "macro on an instruction level" please? I could only find this, which didn't seem relevant to our context:
http://en.wikipedia.org/wiki/Macro_instruction
Peter Wang (Intel) wrote:
BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL - count mispredicted indirect call branch instruction retired. Usually "indirect call", means there is no call address provided in compiling time, it depends on previous instructions' operation, for example "call address" will be stored in register, or address in memory. So if "call address" is known early - CPU can speculatively do "call"
Are you saying "speculative" refers to the CPU speculatively executing the code for the branch it predicts?
What is the correct term for instructions executed for a mispredicted branch? They are not "retired" right, because they weren't required? Is there an official term to describe those instructions which are speculatively executed and discarded?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
T C wrote:
Quote:
iliyapolak wrote:"near branches"
Near branches are related to near conditional jump inside the same segment.
Hi there, thanks for replying.
What do you mean by "related to" exactly?
Near branches are unconditional or conditional jumps inside the same segment. For example unconditional branch inside cs segment: jmp near <some label> or jmp dword cs:[eax+10h].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
T C wrote:
Quote:
Peter Wang (Intel) wrote:BR_MISP_RETIRED.ALL_BRANCHES - count all mispredicted macro branch instruction retired. Here "macro branch" means include all branch instructions and you can understand "macro" which is on instruction level.
Hi. Could you clarify what you mean by "macro on an instruction level" please? I could only find this, which didn't seem relevant to our context:
http://en.wikipedia.org/wiki/Macro_instruction
Quote:
Peter Wang (Intel) wrote:BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL - count mispredicted indirect call branch instruction retired. Usually "indirect call", means there is no call address provided in compiling time, it depends on previous instructions' operation, for example "call address" will be stored in register, or address in memory. So if "call address" is known early - CPU can speculatively do "call"Are you saying "speculative" refers to the CPU speculatively executing the code for the branch it predicts?
What is the correct term for instructions executed for a mispredicted branch? They are not "retired" right, because they weren't required? Is there an official term to describe those instructions which are speculatively executed and discarded?
> Could you clarify what you mean by "macro on an instruction level" please?
I don't know exact term that you provide doc, but I meant that Macro Instruction (I said here) will be decoded by CPU, it is approximated to "machine code".
> Are you saying "speculative" refers to the CPU speculatively executing the code for the branch it predicts?
Exactly. BTB (Branch Target Buffer) stores fetched branch code, which will be executed speculatively - it may/ may not be retired.
> Is there an official term to describe those instructions which are speculatively executed and discarded?
I recommend you to know all terms from this article
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iliyapolak wrote:
Quote:
T C wrote:Quote:
iliyapolak wrote:
"near branches"
Near branches are related to near conditional jump inside the same segment.
An example of far jump can be this in pseudocode: jmp far ds:// where code is jumping from ss:
Hi there, thanks for replying.
What do you mean by "related to" exactly?
Near branches are unconditional or conditional jumps inside the same segment. For example unconditional branch inside cs segment: jmp near <some label> or jmp dword cs:[eax+10h].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>I don't know exact term that you provide doc, but I meant that Macro Instruction (I said here) will be decoded by CPU, it is approximated to "machine code".>>>
AFAIK "macro instruction" is a machine code instruction (x86-64 assembly opcodes).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks guys!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>An example of far jump in x86 pseudocode:
jmp far ds.:>>>
jmp far ds:<some label>
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page