void UPC_KBridge_Signal_Deliver(int sig) { int core = ProcessorCoreID(); int hwtid = ProcessorThreadID(); CoreState_t *pCS = &(NodeState.CoreState[core]); HWThreadState_t *pHWT = &(pCS->HWThreads[hwtid]); if (pHWT->pUpci_ActiveKThread) { Signal_Deliver(pHWT->pUpci_ActiveKThread->pAppProc, GetTID(pHWT->pUpci_ActiveKThread), sig); } }
codegen::Value TileGroup::TileGroupAccess::Row::LoadColumn( CodeGen &codegen, uint32_t col_idx) const { PL_ASSERT(col_idx < layout_.size()); return tile_group_.LoadColumn(codegen, GetTID(), layout_[col_idx]); }
static int Futex_WakeQueue(Futex_State_t* futexTableEntry, int maxToWake, Futex_State_t* secondaryFutexTableEntry, uint16_t *unblockList) { int numberAwoken = 0; int thd_index = ProcessorID(); TRACE( TRACE_Futex, ("(I) %s[%d]: table:%p (vaddr:%p) num2wake:%d secondary:%p\n", __func__, thd_index, futexTableEntry, (futexTableEntry ? futexTableEntry->futex_vaddr : 0LL), maxToWake, secondaryFutexTableEntry)); if (!futexTableEntry) { TRACE( TRACE_Futex, ("(I) %s[%d]: futexTableEntry == NULL\n", __func__, thd_index)); return numberAwoken; } KThread_t* thread; for (thread = futexTableEntry->pKThr_Waiter_Next; thread; thread = futexTableEntry->pKThr_Waiter_Next) { // TRACE( TRACE_Futex, ("(D) %s[%d]: process thread:%08x (next->%08x\n", __func__, core, (unsigned)thread, (unsigned)(thread->FutexQueueNext))); // If we haven't hit the limit, wake up the thread: if ( numberAwoken < maxToWake ) { // Advance the futex table to the next entry now because we will be destroying the link // in the current entry: futexTableEntry->pKThr_Waiter_Next = thread->FutexQueueNext; TRACE( TRACE_Futex, ("(I) %s[%d]: waking kthread:%p processorid:%d for futex:%p\n", __func__, thd_index, thread, thread->ProcessorID, thread->FutexVAddr)); thread->Reg_State.gpr[3] = 0; // this is the result of the futex syscall thread->FutexQueueNext = (KThread_t *)0; thread->FutexVAddr = NULL; thread->FutexValue = 0; thread->FutexTimeout = 0; thread->FutexIsShared = 0; //thread->pad3 = 1; // TEMP PROBLEM ANALYSIS unblockList[numberAwoken] = GetTID(thread); // save the kthread in an abbreviated 2-byte format. numberAwoken++; ppc_msync(); } else if ( secondaryFutexTableEntry ) { // We are requeueing ... move the entire FIFO to the secondary // futex queue. Since the FIFO is a linked list, we can do // this by simply snipping off the remaining chain and pasting // it onto the secondary: KThread_t** tail; for (tail = &(secondaryFutexTableEntry->pKThr_Waiter_Next); *tail; tail = &((*tail)->FutexQueueNext)); // find the end of the secondary queue futexTableEntry->pKThr_Waiter_Next = 0; // The old queue is now empty *tail = thread; // Paste the queue remainder onto the end of the existing queue // Now update the entries for ( ; thread; thread = thread->FutexQueueNext ) { thread->FutexVAddr = secondaryFutexTableEntry->futex_vaddr; thread->FutexValue = *thread->FutexVAddr; ppc_msync(); } TRACE( TRACE_Futex, ("(I) %s[%d]: some waiters requeued to futex:%016lx (sys:%p) \n", __func__, thd_index, (uint64_t)secondaryFutexTableEntry->futex_vaddr, secondaryFutexTableEntry )); } else { break; } } // If the waiter list is now empty, then remove the entry from the table: if ( futexTableEntry->pKThr_Waiter_Next == NULL ) { futexTableEntry->futex_vaddr = 0; ppc_msync(); } if ( secondaryFutexTableEntry && (secondaryFutexTableEntry->pKThr_Waiter_Next == NULL) ) { secondaryFutexTableEntry->futex_vaddr = 0; ppc_msync(); } // TRACE( TRACE_Futex, ("(<) %s[%d]\n", __func__, core)); return numberAwoken; }