1 / 19

VMF Detailed Design Version 3

VMF Detailed Design Version 3. by Yehuda Afek Alexander Matveev. Subjects. Abstract Idea Transactional Memory: Memory Model Transaction Illustration Requirements: VMF Transactional Memory Hardware Implementation: Overview VMF Prediction Table Concept Algorithm VMF Stripe Cache

marge
Télécharger la présentation

VMF Detailed Design Version 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VMF Detailed DesignVersion 3 by Yehuda Afek Alexander Matveev VMF Dettailed Dezign ver2

  2. Subjects • Abstract Idea • Transactional Memory: • Memory Model • Transaction • Illustration • Requirements: • VMF • Transactional Memory • Hardware Implementation: • Overview • VMF Prediction Table • Concept • Algorithm • VMF Stripe Cache • Concept • Algorithm • VMF Call Invoke Trigger • VMF Miss Prediction Handling • VMF Call Invoke implementation • TLB Modifications • VMF Code Segment: VMF_Start and VMF_End • Context Switch Handling VMF Dettailed Dezign ver2

  3. Abstract idea • To automate the transactification process. • Drastically simplify the compiler. • The HW will automatically do the STM. • It is like HW assisted STM VMF Dettailed Dezign ver2

  4. TM Memory Model • Virtual memory pages are divided to stripes • stripecan have an object inside or multiple objects. Also the objects can be splitted between the stripes. • TM algorithm granularity will be stripe. Therefore, the read-set and write-set entries are stripes. • TM algorithm is applied only for memory accesses to the shared memory. • The user marks which memory pages are shared and which are not-shared. VMF Dettailed Dezign ver2

  5. TM Transaction • Transaction is a block of code annotated by • {TxBegin, … block of code … , TxEnd}. • Inside the transaction: • shared memory accesses: must be preceded by a TxLD or TxST function call. • non-shared memory accesses: proceed regularly • TxLDorTxST: call will record the shared memory access (to read-set or write-set) and will perform the TM algorithm specific code. VMF Dettailed Dezign ver2

  6. TM Illustration Virtual Memory CODE Non-Shared Page TxBegin TxLD invoked Shared Page LD r, X1 stripe LD r, X1+1 TxLD invoked Transaction TxST invoked ST Y, r Non-Shared Page LD r, X2 no invokation TxEnd . . Non-Shared Page VMF Dettailed Dezign ver2

  7. VMF - Requirements • VMF Code Segment: block of code annotated as: • {VMF_Start, … block of code …, VMF_End) • VMF_Start and VMF_End are defined in next slides • VMF Invocation Trigger: For VMF code segment, VMF Call is invoked for LD or ST instruction if all the following conditions are true: • memory access address page is marked as shared • If LD: memory access address stripe was not accessed before for LD (After the VMF_Start call) • If ST: memory access address stripe was not accessed before for ST (After the VMF_Start call) • VMF Call Invoke: If LD/ST instruction invoked VMF then the order of execution is: • VMF function (given the read/write memory address) • The original LD/ST instruction VMF Dettailed Dezign ver2

  8. TM - Requirements • VMF Call = TxLD/TxST for LD/ST instruction • VMF Code Segment is: • START = TxBegin • END = TxEnd • TxBegin: • Execute VMF_Start (Defined in next slides) • Execute the TM_Start • TxEnd: • Execute the TM_Commit using the constructed READ-SET and WRITE-SET. • Execute VMF_End (Defined in next slides) VMF Dettailed Dezign ver2

  9. Hardware Implementation Overview • VMF Call Invoke will be done once per read or write access to every stripe during the transaction. In order to support this the following changes will done to the pipeline: • Fetch Stage:VMF Prediction Table (VMF PT) will be used to predict VMF Call Invoke based on previous results for current LD/ST instruction. • MEM Stage:VMF Stripe Cache (VMF SC) will be used to cache stripes that have been already accessed. • New Registers: Upon VMF Call we want to store: • VMF_ADDR_REG: The memory address accessed by the LD/ST instruction that invoked the VMF • VMF_PC_REG: The PC of the current LD/ST instruction so we can return back • New Instructions: • VMF_Start opcode • VMF_End opcode VMF Dettailed Dezign ver2

  10. PC Reg Inst PC VMF Ctrl AddrReg PC Reg Access Addr SC TLB instaddr vmf F VMF PT VMF Dettailed Dezign ver2

  11. VMF Prediction TableConcept • CONCEPT: We distinguish between three types of instruction occurrences which access shared data: • Multiple Invoke: Instruction that access a different stripe in each occurrence of the instruction in a transaction. • Once Invoke: Instruction accessing the same stripe throughout a transaction. • First Time: • Repeated: Instruction accessing the same stripe during the transaction AND it is accessing a stripe that was accessed before by some LD/ST instruction during THE SAME transaction. • Table entry is: • ( instruction address , flags ) can be squeezed into 32 bits. (The last 2 bits of 32 bit instruction address can be used). • Flags (2 bit): • 0: Once invoke type (Not yet invoked) • 1: Once invoke type (Repeated) • 2: Multiple invoke type (Not invoked yet) • 3: Multiple invoke type (Already invoked) VMF Dettailed Dezign ver2

  12. VMF Prediction TableAlgorithm • COMMON CASE: If instruction triggered VMF Call and VMF Call was predicted: • If instruction’s entry flags == 0(Once Invoke – Not invoked yet) then • Update the instruction’s entry flags to 1 (Once Invoke – Already invoked) • Else if instruction’s entry flags == 2 (Multiple Invoke – Not invoked yet) then • Update the instruction’s entry flags to 3 (Multiple Invoke – Already invoked) • Else, • The instruction’s entry flags is 3 (Multiple Invoke – Already invoked). Do no changes to the entry. • STUDY CASE - Once Invoke: If instruction triggered VMF Call and VMF call was not predicted: • Create entry with ( current instruction address , flags = 1 ) • STUDY CASE – Multiple Invoke: If instruction triggered VMF Call and VMF call was not predicted because flags == 1 for the entry: • Set entry’s flags to 3 (Multiple Invoke – Already invoked ) • RESTUDY CASE – NOT COMMON: If instruction did not triggered VMF Call and VMF call was predicted: • Remove instruction’s entry VMF Dettailed Dezign ver2

  13. VMF Stripe Cache • CONCEPT: The purpose of the VMF Stripe Cache is to record the stripes that were already accessed in the current transaction. • ALGORITHM: • Every entry has: • ( stripe address , flags) • Flags can be: • 0 – read access was performed • 1 – write access was performed • If shared memory access triggers VMF Call Invoke and the VMF PT flags is not equal to 3 (Multiple Invoke – Already Called) then: • Entry is created in the table holding the stripe’s address and the access type information (0 for LD, 1 for ST) VMF Dettailed Dezign ver2

  14. VMF Call Invoke Trigger • VMF Call Invoke Trigger: VMF Call Invoke is triggered if all following conditions are met for current LD/ST instruction: • Memory access address page is marked as shared • Memory access address stripe entry = (stripe address, flags = 0 for LD or 1 for ST) is not in VMF Stripe Cache • Updates Upon Trigger: If VMF Call Invoke Trigger is True then: • VMF Stripe Cache is updated: new entry is added • VMF Prediction Table is updated: new entry is added, or entry’s flags is switched from 0 to 1 or from 1 to 2 or from 2 to 3. VMF Dettailed Dezign ver2

  15. VMF Miss Prediction Handling • If current LD/ST instruction triggers VMF Call Invoke and VMF PT did not predict it then: • Store current LD/ST instruction: • Memory access address (to special register) • Instruction PC (to special register) • Flush the pipeline • Restart execution at PC = VMF Call Base Address VMF Dettailed Dezign ver2

  16. VMF Call Invoke Hardware Implementation • In order to invoke the VMF Call we need to pass parameters to it. The basic parameters are current instruction’s: • Memory access address • Instruction PC • Therefore upon VMF Call Invoke Trigger: • Memory access address is forwarded to the VMF_ADDR_REG • Instruction PC is forwarded to the VMF_PC_REG • Current LD/ST instruction is aborted • (If was VMF miss prediction then pipeline flush is performed) • VMF Call Procedure is executed normally VMF Dettailed Dezign ver2

  17. TLB Modifications • Every page has additional bit • 0 – not marked (not shared) • 1 – marked (shared) page addr S Flag Option Flags VMF Dettailed Dezign ver2

  18. VMF Code Segment • VMF_Start: • VMF PT: • If entry’s flag is 1 then reset it to 0 • If entry’s flag is 3 then reset it to 2 • VMF SC (Stripe Cache): remove entries • Trigger VMF on • VMF_End: • Trigger VMF off VMF Dettailed Dezign ver2

  19. Context Switch • Upon context switch: • Flush the VMF tables (to preserve correctness) VMF Detailed Design ver3

More Related