Ejemplo n.º 1
0
static void print_dst(sb_ostream &s, bc_alu &alu)
{
	unsigned sel = alu.dst_gpr;
	char reg_char = 'R';
	if (sel >= 128 - 4) { // clause temporary gpr
		sel -= 128 - 4;
		reg_char = 'T';
	}

	if (alu.write_mask || alu.op_ptr->src_count == 3) {
		s << reg_char;
		print_sel(s, sel, alu.dst_rel, alu.index_mode, 0);
	} else {
		s << "__";
	}
	s << ".";
	s << chans[alu.dst_chan];
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]) 
{
	int i = 0;
	int *key;
	record *value;
	filedata_t *fd;
	final_data_t op_results;
	final_data_t op_results0;
	final_data_t op_results2;
	final_data_t op_results3;
	final_data_t op_results4;
	final_data_t op_results5;
	final_data_t op_results6;
	final_data_t op_results7;

	struct timeval starttime,endtime;
	char * fname, * op_num_str;
	int op_num;

	struct timeval begin_total, end_total;


	// Make sure a filename is specified
	if (argv[1] == NULL)
	{
		printf("USAGE: %s <filename> [ # of operator to use (1:sel 2:prj 3:srt 4:prt 5:agg) ]\n", argv[0]);
		exit(1);
	}

	fname = argv[1];
	op_num_str = argv[2];

	// Get the number of operator to run
	CHECK_ERROR((op_num = (op_num_str == NULL) ? 10 : atoi(op_num_str)) < 0);



	fd=load_op (fname, sizeof(record));	
		//printLoads(fd);
	
	if ((op_num  != 6) && (op_num != 0)){
		prepare_op(fd, &op_results, 0);
		dprintf("\nop_results length  %d:\n", op_results.length);
	}
	get_time (&begin_total);

	switch(op_num){
		case 0:
			prepare_op(fd, &op_results0, 1);

			break;
		case 1:
			select_op(&op_results, cmp12, &op_results2, 1);
				print_sel(op_results2);
			break;
		case 2:
			project_op(&op_results, prj5, &op_results3, 1);
				print_prj(op_results3);
			break;
		case 3:
			sort_op(&op_results, stringcmp, key_ptr, keysize, &op_results4, 1);
				print_srt(op_results4);
			break;
		case 4:
			partition_op(&op_results, hsh_prt, &op_results5, 1);
				print_prt(op_results5);

			//	partition_2op(&op_results, prt, &op_results5, 0);
			break;
		case 5:
			aggregate_op(&op_results, aggr, key_ptr, keysize, &op_results6, 1);
				printAggr(op_results6);
			break;
		case 6:
			select_op_old(fd,cmp12, &op_results7, 1);
				print_sel(op_results7);
			break;
		default:
			printf("No operator selected\n");
			break;
	}

	get_time (&end_total);
	unload_op(fd);


#ifdef TIMING
	fprintf (stderr, "\n\nOverall time: %u\n\n\n", time_diff (&end_total, &begin_total));
#endif
	return 1;
}
Ejemplo n.º 3
0
void bc_dump::dump(fetch_node& n) {
	sb_ostringstream s;
	static const char * fetch_type[] = {"VERTEX", "INSTANCE", ""};

	s << n.bc.op_ptr->name;
	fill_to(s, 20);

	s << "R";
	print_sel(s, n.bc.dst_gpr, n.bc.dst_rel, INDEX_LOOP, 0);
	s << ".";
	for (int k = 0; k < 4; ++k)
		s << chans[n.bc.dst_sel[k]];
	s << ", ";

	s << "R";
	print_sel(s, n.bc.src_gpr, n.bc.src_rel, INDEX_LOOP, 0);
	s << ".";

	unsigned vtx = n.bc.op_ptr->flags & FF_VTX;
	unsigned num_src_comp = vtx ? ctx.is_cayman() ? 2 : 1 : 4;

	for (unsigned k = 0; k < num_src_comp; ++k)
		s << chans[n.bc.src_sel[k]];

	if (vtx && n.bc.offset[0]) {
		s << " + " << n.bc.offset[0] << "b ";
	}

	s << ",   RID:" << n.bc.resource_id;

	if (vtx) {
		s << "  " << fetch_type[n.bc.fetch_type];
		if (!ctx.is_cayman() && n.bc.mega_fetch_count)
			s << " MFC:" << n.bc.mega_fetch_count;
		if (n.bc.fetch_whole_quad)
			s << " FWQ";
		if (ctx.is_egcm() && n.bc.resource_index_mode)
			s << " RIM:SQ_CF_INDEX_" << n.bc.resource_index_mode;
		if (ctx.is_egcm() && n.bc.sampler_index_mode)
			s << " SID:SQ_CF_INDEX_" << n.bc.sampler_index_mode;

		s << " UCF:" << n.bc.use_const_fields
				<< " FMT(DTA:" << n.bc.data_format
				<< " NUM:" << n.bc.num_format_all
				<< " COMP:" << n.bc.format_comp_all
				<< " MODE:" << n.bc.srf_mode_all << ")";
	} else {
		s << ", SID:" << n.bc.sampler_id;
		if (n.bc.lod_bias)
			s << " LB:" << n.bc.lod_bias;
		s << " CT:";
		for (unsigned k = 0; k < 4; ++k)
			s << (n.bc.coord_type[k] ? "N" : "U");
		for (unsigned k = 0; k < 3; ++k)
			if (n.bc.offset[k])
				s << " O" << chans[k] << ":" << n.bc.offset[k];
		if (ctx.is_egcm() && n.bc.resource_index_mode)
			s << " RIM:SQ_CF_INDEX_" << n.bc.resource_index_mode;
		if (ctx.is_egcm() && n.bc.sampler_index_mode)
			s << " SID:SQ_CF_INDEX_" << n.bc.sampler_index_mode;
	}

	sblog << s.str() << "\n";
}
Ejemplo n.º 4
0
static void print_src(sb_ostream &s, bc_alu &alu, unsigned idx)
{
	bc_alu_src *src = &alu.src[idx];
	unsigned sel = src->sel, need_sel = 1, need_chan = 1, need_brackets = 0;

	if (src->neg)
		s <<"-";
	if (src->abs)
		s <<"|";

	if (sel < 128 - 4) {
		s << "R";
	} else if (sel < 128) {
		s << "T";
		sel -= 128 - 4;
	} else if (sel < 160) {
		s << "KC0";
		need_brackets = 1;
		sel -= 128;
	} else if (sel < 192) {
		s << "KC1";
		need_brackets = 1;
		sel -= 160;
	} else if (sel >= 448) {
		s << "Param";
		sel -= 448;
	} else if (sel >= 288) {
		s << "KC3";
		need_brackets = 1;
		sel -= 288;
	} else if (sel >= 256) {
		s << "KC2";
		need_brackets = 1;
		sel -= 256;
	} else {
		need_sel = 0;
		need_chan = 0;
		switch (sel) {
		case ALU_SRC_PS:
			s << "PS";
			break;
		case ALU_SRC_PV:
			s << "PV";
			need_chan = 1;
			break;
		case ALU_SRC_LITERAL:
			s << "[0x";
			s.print_zw_hex(src->value.u, 8);
			s << " " << src->value.f << "]";
			need_chan = 1;
			break;
		case ALU_SRC_0_5:
			s << "0.5";
			break;
		case ALU_SRC_M_1_INT:
			s << "-1";
			break;
		case ALU_SRC_1_INT:
			s << "1";
			break;
		case ALU_SRC_1:
			s << "1.0";
			break;
		case ALU_SRC_0:
			s << "0";
			break;
		default:
			s << "??IMM_" <<  sel;
			break;
		}
	}

	if (need_sel)
		print_sel(s, sel, src->rel, alu.index_mode, need_brackets);

	if (need_chan) {
		s << "." << chans[src->chan];
	}

	if (src->abs)
		s << "|";
}