[PATCH] D98491: [AMDGPU] Split GCN subtarget features for unaligned access

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 23 02:17:45 PDT 2021


hsmhsm added a comment.

@mbrkusanin

I see some comments from @rampitec  and @arsenm, and @rampitec had also made below comments in the related internal JIRA ticket.

  Comments from @rampitec in JIRA ticket:
  Disabling unaligned dword access is not acceptable for HSA.
  My proposal was simple: prefer ds_read2_b64 (and write) over b128 if alignment < 16. I never heard of b64 performance issues though, so the rest is the same as now: create a widest load/store possible with that one exception for b128.

>From the JIRA comments, I also see @foad is in agreement with above comments.  So, it looks like, we should avoid accessing ds_read_128/ds_write_128 when the alignment is < 16. I am not sure, what you think here, but, your comments are very valuable to make further progress here.

If we all agree with above, then looks like the the file `DSInstructions.td` has to go below changes.

The code

  let SubtargetPredicate = HasUnalignedDSAccess in {
  
  foreach vt = VReg_96.RegTypes in {
  defm : DSReadPat_mc <DS_READ_B96, vt, "load_local">;
  }
  
  foreach vt = VReg_128.RegTypes in {
  defm : DSReadPat_mc <DS_READ_B128, vt, "load_local">;
  }
  
  } // End SubtargetPredicate = HasUnalignedDSAccess

should change to

  let SubtargetPredicate = HasUnalignedDSAccess in {
  
  foreach vt = VReg_96.RegTypes in {
  defm : DSReadPat_mc <DS_READ_B96, vt, "load_local">;
  }
  
  foreach vt = VReg_128.RegTypes in {
  defm : DSReadPat_mc <DS_READ_B128, vt, "load_align16_local">;
  }
  
  } // End SubtargetPredicate = HasUnalignedDSAccess

and the code

  let SubtargetPredicate = HasUnalignedDSAccess in {
  
  foreach vt = VReg_96.RegTypes in {
  defm : DSWritePat_mc <DS_WRITE_B96, vt, "store_local">;
  }
  
  foreach vt = VReg_128.RegTypes in {
  defm : DSWritePat_mc <DS_WRITE_B128, vt, "store_local">;
  }
  
  } // End SubtargetPredicate = HasUnalignedDSAccess

should change to

  let SubtargetPredicate = HasUnalignedDSAccess in {
  
  foreach vt = VReg_96.RegTypes in {
  defm : DSWritePat_mc <DS_WRITE_B96, vt, "store_local">;
  }
  
  foreach vt = VReg_128.RegTypes in {
  defm : DSWritePat_mc <DS_WRITE_B128, vt, "store_align16_local">;
  }
  
  } // End SubtargetPredicate = HasUnalignedDSAccess


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98491/new/

https://reviews.llvm.org/D98491



More information about the llvm-commits mailing list