@@ -4380,16 +4380,43 @@ void G4_Kernel::emit_asm(std::ostream& output, bool beforeRegAlloc, void * binar
43804380 }
43814381 output << std::endl;
43824382
4383+ auto fmtHex = [](int i) {
4384+ std::stringstream ss;
4385+ ss << " 0x" << std::hex << std::uppercase << i;
4386+ return ss.str ();
4387+ };
4388+
43834389 // emit input location and size
43844390 output << " //.kernel_reordering_info_start" << std::endl;
4391+ static const int COLW_ID = 8 ;
4392+ static const int COLW_TYPE = 8 ;
4393+ static const int COLW_SIZE = 6 ;
4394+ static const int COLW_AT = 8 ;
4395+ static const int COLW_CLASS = 10 ;
4396+ static const int COLW_KIND = 12 ;
4397+
4398+ std::stringstream bordss;
4399+ bordss << " // " ;
4400+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_ID + 2 ) << " " ;
4401+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_TYPE + 2 ) << " " ;
4402+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_SIZE + 2 ) << " " ;
4403+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_AT + 2 ) << " " ;
4404+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_CLASS + 2 ) << " " ;
4405+ bordss << ' +' ; bordss << std::setfill (' -' ) << std::setw (COLW_KIND + 2 ) << " " ;
4406+ bordss << ' +' << std::endl;
4407+ std::string border = bordss.str ();
4408+
4409+ output << border;
43854410 output <<
43864411 " //" <<
4387- " " << std::setw (12 ) << " id" <<
4388- " " << std::setw (12 ) << " location" <<
4389- " " << std::setw (12 ) << " bytes" <<
4390- " " << std::setw (12 ) << " class" <<
4391- " " << std::setw (12 ) << " kind" <<
4392- std::endl;
4412+ " | " << std::left << std::setw (COLW_ID) << " id" <<
4413+ " | " << std::left << std::setw (COLW_TYPE) << " type" <<
4414+ " | " << std::right << std::setw (COLW_SIZE) << " bytes" <<
4415+ " | " << std::left << std::setw (COLW_AT) << " at" <<
4416+ " | " << std::left << std::setw (COLW_CLASS) << " class" <<
4417+ " | " << std::left << std::setw (COLW_KIND) << " kind" <<
4418+ " |" << std::endl;
4419+ output << border;
43934420
43944421 const unsigned grfSize = getGRFSize ();
43954422 unsigned int inputCount = fg.builder ->getInputCount ();
@@ -4400,44 +4427,79 @@ void G4_Kernel::emit_asm(std::ostream& output, bool beforeRegAlloc, void * binar
44004427 output << " //" ;
44014428 //
44024429 // id
4403- std::stringstream ss ;
4404- ss << " .arg_" << (id + 1 );
4430+ std::stringstream ssid ;
4431+ ssid << " .arg_" << (id + 1 );
44054432 output <<
4406- " " << std::setw (12 ) << ss.str ();
4433+ " | " << std::left << std::setw (COLW_ID) << ssid.str ();
4434+ //
4435+ // type and length
4436+ // e.g. :uq x 16
4437+ const G4_Declare *dcl = input_info->dcl ;
4438+ std::stringstream sstype;
4439+ if (dcl) {
4440+ switch (dcl->getElemType ()) {
4441+ case Type_B: sstype << " :b" ; break ;
4442+ case Type_W: sstype << " :w" ; break ;
4443+ case Type_D: sstype << " :d" ; break ;
4444+ case Type_Q: sstype << " :q" ; break ;
4445+ case Type_V: sstype << " :v" ; break ;
4446+ case Type_UB: sstype << " :ub" ; break ;
4447+ case Type_UW: sstype << " :uw" ; break ;
4448+ case Type_UD: sstype << " :ud" ; break ;
4449+ case Type_UQ: sstype << " :uq" ; break ;
4450+ case Type_UV: sstype << " :uv" ; break ;
4451+ //
4452+ case Type_F: sstype << " :f" ; break ;
4453+ case Type_HF: sstype << " :hf" ; break ;
4454+ case Type_DF: sstype << " :df" ; break ;
4455+ case Type_NF: sstype << " :nf" ; break ;
4456+ default :
4457+ sstype << fmtHex ((int )dcl->getElemType ()) << " ?" ;
4458+ break ;
4459+ }
4460+ if (dcl->getTotalElems () != 1 )
4461+ sstype << " x " << dcl->getTotalElems ();
4462+ } else {
4463+ sstype << " ?" ;
4464+ }
4465+ output << " | " << std::left << std::setw (COLW_TYPE) << sstype.str ();
4466+ //
4467+ // size
4468+ output << " | " << std::right << std::setw (COLW_SIZE) << std::dec << input_info->size ;
44074469
44084470 // location
44094471 unsigned reg = input_info->offset / grfSize,
44104472 subRegBytes = input_info->offset % grfSize;
4411- std::stringstream ss2 ;
4412- ss2 << " r" << reg;
4473+ std::stringstream ssloc ;
4474+ ssloc << " r" << reg;
44134475 if (subRegBytes != 0 )
4414- ss2 << " +" << subRegBytes;
4415- //
4416- // offset and size
4417- output <<
4418- " " << std::setw (12 ) << ss2.str () <<
4419- " " << std::setw (12 ) << input_info->size ;
4476+ ssloc << " +" << subRegBytes;
4477+ output << " | " << std::left << std::setw (COLW_AT) << ssloc.str ();
44204478
44214479 // class and kind
4422- output << " " ;
4480+ std::string inpcls ;
44234481 switch (input_info->getInputClass ()) {
4424- case INPUT_GENERAL: output << std::setw ( 12 ) << " general" ; break ;
4425- case INPUT_SAMPLER: output << std::setw ( 12 ) << " sampler" ; break ;
4426- case INPUT_SURFACE: output << std::setw ( 12 ) << " surface" ; break ;
4427- default : output << std::setw ( 12 ) << (int )input_info->getInputClass (); break ;
4482+ case INPUT_GENERAL: inpcls = " general" ; break ;
4483+ case INPUT_SAMPLER: inpcls = " sampler" ; break ;
4484+ case INPUT_SURFACE: inpcls = " surface" ; break ;
4485+ default : inpcls = fmtHex ( (int )input_info->getInputClass () ); break ;
44284486 }
4487+ output << " | " << std::left << std::setw (COLW_CLASS) << inpcls;
44294488 //
4430- output << " " ;
4489+ std::string kind ;
44314490 switch ((int )input_info->getImplicitKind ()) {
4432- case 0x00 : output << std::setw ( 12 ) << " explicit" ; break ;
4433- case 0x01 : output << std::setw ( 12 ) << " local_size" ; break ;
4434- case 0x02 : output << std::setw ( 12 ) << " group_count" ; break ;
4435- case 0x03 : output << std::setw ( 12 ) << " local_id" ; break ;
4436- case 0x10 : output << std::setw ( 12 ) << " pseudo_input" ; break ;
4437- default : output << std::setw ( 12 ) << (int )input_info->getImplicitKind (); break ;
4491+ case 0x00 : kind = " explicit" ; break ;
4492+ case 0x01 : kind = " local_size" ; break ;
4493+ case 0x02 : kind = " group_count" ; break ;
4494+ case 0x03 : kind = " local_id" ; break ;
4495+ case 0x10 : kind = " pseudo_input" ; break ;
4496+ default : kind = fmtHex ( (int )input_info->getImplicitKind () ); break ;
44384497 }
4439- output << std::endl;
4498+ output << " | " << std::left << std::setw (COLW_KIND) << kind;
4499+
4500+ output << " |" << std::endl;
44404501 }
4502+ output << border;
44414503
44424504 output << " //.kernel_reordering_info_end" << std::endl;
44434505 if (getPlatformGeneration (getGenxPlatform ()) < PlatformGen::GEN12)
@@ -4626,8 +4688,10 @@ void G4_Kernel::emit_asm(std::ostream& output, bool beforeRegAlloc, void * binar
46264688 output << " // " << errString->second .c_str () << std::endl;
46274689 output << " // Text representation might not be correct" << std::endl;
46284690 }
4629-
4630- kView .getInstSyntax (pc, stringBuffer, 512 , labelerLambda, (void *)&lambdaArg);
4691+ kView .getInstSyntax (
4692+ pc,
4693+ stringBuffer, 512 ,
4694+ labelerLambda, (void *)&lambdaArg);
46314695 pc += kView .getInstSize (pc);
46324696
46334697 (*itBB)->emitBasicInstructionIga (stringBuffer, output, itInst, suppressRegs, lastRegs);
@@ -4754,7 +4818,7 @@ void G4_BB::emitInstructionInfo(std::ostream& output, INST_LIST_ITER &it)
47544818
47554819 if (emitFile)
47564820 {
4757- output << " // File: " << curFilename << " \n " ;
4821+ output << " \n // File: " << curFilename << " \n " ;
47584822 }
47594823
47604824 if (emitLineNo)
0 commit comments