@@ -3435,34 +3435,7 @@ std::string VISAKernel_format_provider::printKernelHeader(bool printVersion) {
3435
3435
}
3436
3436
sstr << " \n " ;
3437
3437
3438
- // emit var decls
3439
- // .decl V<#> name=<name> type=<type> num_elts=<num_elements> [align=<align>]
3440
- // [alias=(<alias_index>,<alias_offset>)]
3441
- for (unsigned i = 0 ; i < getVarCount (); i++) {
3442
- sstr << " \n " << printVariableDecl (this , i, options);
3443
- }
3444
- // address decls
3445
- for (unsigned i = 0 ; i < getAddrCount (); i++) {
3446
- sstr << " \n " << printAddressDecl (this , i);
3447
- }
3448
- // pred decls
3449
- for (unsigned i = 0 ; i < getPredCount (); i++) {
3450
- // P0 is reserved; starting from P1 if there is predicate decl
3451
- sstr << " \n " << printPredicateDecl (this , i);
3452
- }
3453
- // sampler
3454
- for (unsigned i = 0 ; i < getSamplerCount (); i++) {
3455
- sstr << " \n " << printSamplerDecl (this , i);
3456
- }
3457
- // surface
3458
- unsigned numPreDefinedSurfs = Get_CISA_PreDefined_Surf_Count ();
3459
- for (unsigned i = 0 ; i < getSurfaceCount (); i++) {
3460
- sstr << " \n " << printSurfaceDecl (this , i, numPreDefinedSurfs);
3461
- }
3462
- // inputs to kernel
3463
- for (unsigned i = 0 ; i < getInputCount (); i++) {
3464
- sstr << " \n " << printFuncInput (this , i, options);
3465
- }
3438
+ sstr << printDeclSection (false );
3466
3439
3467
3440
bool isTargetSet = false ;
3468
3441
for (unsigned i = 0 ; i < getAttrCount (); i++) {
@@ -3500,6 +3473,46 @@ std::string VISAKernel_format_provider::printKernelHeader(bool printVersion) {
3500
3473
return sstr.str ();
3501
3474
}
3502
3475
3476
+ std::string VISAKernel_format_provider::printDeclSection (bool printAsComment) {
3477
+ // printAsComment adds "// " at the beginning of each line
3478
+ // This is used for adding duplicated decl section at the end
3479
+ // of the dump when vISA_AddISAASMDeclarationsToEnd is enabled.
3480
+
3481
+ std::stringstream sstr;
3482
+ const Options *options = m_kernel->getOptions ();
3483
+ const char *newLine = printAsComment ? " \n // " : " \n " ;
3484
+
3485
+ // emit var decls
3486
+ // .decl V<#> name=<name> type=<type> num_elts=<num_elements> [align=<align>]
3487
+ // [alias=(<alias_index>,<alias_offset>)]
3488
+ for (unsigned i = 0 ; i < getVarCount (); i++) {
3489
+ sstr << newLine << printVariableDecl (this , i, options);
3490
+ }
3491
+ // address decls
3492
+ for (unsigned i = 0 ; i < getAddrCount (); i++) {
3493
+ sstr << newLine << printAddressDecl (this , i);
3494
+ }
3495
+ // pred decls
3496
+ for (unsigned i = 0 ; i < getPredCount (); i++) {
3497
+ // P0 is reserved; starting from P1 if there is predicate decl
3498
+ sstr << newLine << printPredicateDecl (this , i);
3499
+ }
3500
+ // sampler
3501
+ for (unsigned i = 0 ; i < getSamplerCount (); i++) {
3502
+ sstr << newLine << printSamplerDecl (this , i);
3503
+ }
3504
+ // surface
3505
+ unsigned numPreDefinedSurfs = Get_CISA_PreDefined_Surf_Count ();
3506
+ for (unsigned i = 0 ; i < getSurfaceCount (); i++) {
3507
+ sstr << newLine << printSurfaceDecl (this , i, numPreDefinedSurfs);
3508
+ }
3509
+ // inputs to kernel
3510
+ for (unsigned i = 0 ; i < getInputCount (); i++) {
3511
+ sstr << newLine << printFuncInput (this , i, options);
3512
+ }
3513
+ return sstr.str ();
3514
+ }
3515
+
3503
3516
std::string printFunctionDecl (const print_format_provider_t *header,
3504
3517
bool isKernel) {
3505
3518
std::stringstream sstr;
0 commit comments