[PATCH] D63639: [AMDGPU] Prevent backend override of WGP when using PAL

David Stuttard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 01:31:08 PDT 2019


dstuttard marked an inline comment as done.
dstuttard added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:970-974
+    // Leave WgpMode as default (0) for PAL - PAL will set this bit and should
+    // not be overridden here
+    ProgInfo.WgpMode = (STM.isCuModeEnabled() ||
+                        TM.getTargetTriple().getOS() == Triple::AMDPAL)
+                           ? 0 : 1;
----------------
arsenm wrote:
> nhaehnle wrote:
> > dstuttard wrote:
> > > arsenm wrote:
> > > > arsenm wrote:
> > > > > This seems like a workaround. Why isn't PAL setting what it wants initially and overriding it later?
> > > > I'm also thinking this should be an attribute rather than a sub target feature
> > > Not sure what you're getting at here.
> > > Currently PAL does set the value in the ComputePGMRSrc1 register. Policy is to OR any changes into the control registers that are input - but in this case that only works if you happen to enable CuMode (the default for the backend is to not be in CuMode, so WGP is always set to 1).
> > > 
> > > We could work around this by always setting the CuMode sub target feature in any PAL front-end - then the value passed in from PAL would always be honoured, but that seems more hacky to me.
> > > 
> > > We can change CuMode to be an attribute rather than sub target feature as a separate change, but that pre-exists this work.
> > > 
> > > I'll put a test together if we can agree an approach.
> > Always setting the subtarget feature does seem like the right approach to me.
> > 
> > Changing it to a target attribute may be something to consider. It's one of those non-trivial things because it would have to be added to all functions, not just the kernel entry point, but...
> This seems like something we should handle consistently for all OS types, not just AMDPAL
I think I'll go with always setting the sub target feature for now, so I'll abandon this change.




Repository:
  rL LLVM

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

https://reviews.llvm.org/D63639





More information about the llvm-commits mailing list