OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the...

6
OCR User Hints API Rob, Sanjay, Zoran

Transcript of OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the...

Page 1: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

OCR User Hints APIRob, Sanjay, Zoran

Page 2: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

Motivation for OCR user hints API

• Create a facility for the OCR application developer to provide application specific information to the runtime as hints• A valid OCR program does not depend on the presence of hints• OCR hints are always optional

• The runtime may use OCR user hints to help with the execution of the program• E.g: the scheduler may choose to ignore some user hints

Page 3: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

OCR User Hints API Overview

Example usage:

ocrHint_t myHint;ocrHintInit(&myHint);ocrSetHintProperty(&myHint, ….);ocrSetHint(destGuid, &myHint);

• User hints in OCR are variables of type ocrHint_t ( e.g. ocrHint_t myHint; )• u8 ocrHintInit(ocrHint_t *hint);

• Initializes hint

• u8 ocrSetHintProperty(ocrHint_t *hint, ocrHintProp_t hintProperty, void *value);• sets a specific property to the hint

• u8 ocrGetHintProperty(ocrHint_t *hint, ocrHintProp_t hintProperty, void *value);• reads a specific property from the hint

• u8 ocrSetHint(ocrGuid_t guid, ocrHint_t *hint);• sets the hint for an OCR guid object

• u8 ocrGetHint(ocrGuid_t guid, ocrHint_t *hint);• Gets the hints from an OCR guid object

Page 4: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

OCR Affinity Groups• OCR affinity groups are containers for a group of EDTs / DBs / Events and

other affinity groups• The user can specify hints for all members belonging to that affinity group

• API• u8 ocrAffinityCreate(ocrGuid_t * affinityGuid, ocrGuid_t parentGuid, u32 property);

• Create an affinity guid• u8 ocrSetAffinity(ocrGuid_t dstDuid, ocrGuid_t affinityGuid);

• Sets the affinity for another EDT/DB/Event (dstGuid)• If dstGuid is another affinity guid, then dstGuid’s parent is set to be affinityGuid

• u8 ocrGetAffinity(ocrGuid_t dstGuid, ocrGuid_t * affinityGuid);• Get the associated affinity guid from dstGuid• If dstGuid is of affinity type, then its parent is returned

Page 5: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

OCR hints for temporal locality and

bandwidth/compute boundsZoran

Page 6: OCR User Hints API Rob, Sanjay, Zoran. Motivation for OCR user hints API Create a facility for the OCR application developer to provide application specific.

Temporal locality• Grouping EDTs that work on the same data “together” to take advantage of warm caches only makes sense if they

are close in BOTH space and time• Introduce a notion of time: phases

ocrGuid_t affinityGuid, edt1, edt2, thisguid;ocrHint_t myHint, thisHint;u64 curPhase;ocrHintInit(&myHint);ocrGetHint(thisguid, &thisHint);ocrGetHintProperty(&thisHint, OCR_HINT_PROP_AFFINITY_PHASE, (void*)&curPhase);// create a phase hint for current phase + 5u64 newPhase = curPhase + 5; // phase is always relativeocrSetHintProperty(&myHint, OCR_HINT_PROP_AFFINITY_PHASE, (void*)&newPhase);

ocrAffinityCreate(&affinityGuid, NULL_GUID, 0);ocrSetHint(affinityGuid, &myHint);ocrEdtCreate(&edt1,…, affinityGuid, …);ocrEdtCreate(&edt2,…, affinityGuid, …);