Skip to content

Commit 8921bcb

Browse files
Kewen12ronlieb
authored andcommitted
[OpenMP][Offload][AMDGPU] Add a new envar to enable copy regardless the value of HSA_XNACK
This patch is for SWDEV-494967. When this new envar OMPX_DGPU_MAPS=1, it will always perform copy no matter the value of HSA_XNACK when running on APUs. This envar will increase the portability of the code developed on MI300A for running on MI250X, MI300X, etc. Change-Id: I70edb8682b96bb845a6c8f0269eec910e671ab94
1 parent e015854 commit 8921bcb

File tree

1 file changed

+7
-1
lines changed
  • offload/plugins-nextgen/amdgpu/src

1 file changed

+7
-1
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2685,6 +2685,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
26852685
OMPX_APUPrefaultMemcopy("LIBOMPTARGET_APU_PREFAULT_MEMCOPY", "true"),
26862686
OMPX_APUPrefaultMemcopySize("LIBOMPTARGET_APU_PREFAULT_MEMCOPY_SIZE",
26872687
1 * 1024 * 1024), // 1MB
2688+
OMPX_DGPUMaps("OMPX_DGPU_MAPS", false),
26882689
AMDGPUStreamManager(*this, Agent), AMDGPUEventManager(*this),
26892690
AMDGPUSignalManager(*this), Agent(Agent), HostDevice(HostDevice) {}
26902691

@@ -3823,7 +3824,8 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
38233824
/// XNACK can be enabled with a kernel boot parameter or with
38243825
/// the HSA_XNACK environment variable.
38253826
bool useAutoZeroCopyImpl() override {
3826-
return ((IsAPU || OMPX_ApuMaps) && IsXnackEnabled);
3827+
return !(OMPX_DGPUMaps && IsAPU) &&
3828+
((IsAPU || OMPX_ApuMaps) && IsXnackEnabled);
38273829
}
38283830

38293831
/// Performs sanity checks on the selected zero-copy configuration and prints
@@ -4233,6 +4235,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
42334235
/// is applied.
42344236
UInt32Envar OMPX_APUPrefaultMemcopySize;
42354237

4238+
/// Value of OMPX_DGPU_MAPS. When enabled, it will always perform
4239+
/// copy on APUs regardless of the setting of HSA_XNACK.
4240+
BoolEnvar OMPX_DGPUMaps;
4241+
42364242
/// Stream manager for AMDGPU streams.
42374243
AMDGPUStreamManagerTy AMDGPUStreamManager;
42384244

0 commit comments

Comments
 (0)