コード例 #1
0
bool executive::ReconvergenceTFSortedStack::eval_Bra(
	executive::CTAContext &context, 
	const ir::PTXInstruction &instr, 
	const boost::dynamic_bitset<> & branch, 
	const boost::dynamic_bitset<> & fallthrough) {

	bool divergent = false;

	CTAContext branchContext(context), fallthroughContext(context);
	
	stack.back().erase(stack.back().begin());

	// TODO: set the check condition correctly

	if (branch.any()) {
		branchContext.active = branch;
		branchContext.PC = instr.branchTargetInstruction;
		
		RuntimeStack::iterator existing = stack.back().find(
			branchContext.PC);
		
		if (existing != stack.back().end()) {
			existing->second.active |= branchContext.active;
			++reconvergeEvents;
		}
		else {
			stack.back().insert(std::make_pair(
				branchContext.PC, branchContext));
		}
	}

	if (fallthrough.any())
	{
		fallthroughContext.active = fallthrough;
		fallthroughContext.PC++;
	
		RuntimeStack::iterator existing = stack.back().find(
			fallthroughContext.PC);
		
		if (existing != stack.back().end()) {
			existing->second.active |= fallthroughContext.active;
			++reconvergeEvents;
		}
		else {
			stack.back().insert(std::make_pair(
				fallthroughContext.PC, fallthroughContext));
		}
	}
	
	divergent = true;
	
	return divergent;
}
コード例 #2
0
bool executive::ReconvergenceTFSoftware::eval_Bra(
	executive::CTAContext &context, 
	const ir::PTXInstruction &instr, 
	const boost::dynamic_bitset<> & branch, 
	const boost::dynamic_bitset<> & fallthrough) {

	if (branch.any()) {
		context.PC = instr.branchTargetInstruction;
	}
	else if (fallthrough.any()) {
		context.PC++;
	}
	
	return false;
}