Skip to content

Commit a3deb8a

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 524abee commit a3deb8a

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
@@ -2855,6 +2855,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
28552855
OMPX_APUPrefaultMemcopy("LIBOMPTARGET_APU_PREFAULT_MEMCOPY", "true"),
28562856
OMPX_APUPrefaultMemcopySize("LIBOMPTARGET_APU_PREFAULT_MEMCOPY_SIZE",
28572857
1 * 1024 * 1024), // 1MB
2858+
OMPX_DGPUMaps("OMPX_DGPU_MAPS", false),
28582859
AMDGPUStreamManager(*this, Agent), AMDGPUEventManager(*this),
28592860
AMDGPUSignalManager(*this), Agent(Agent), HostDevice(HostDevice) {}
28602861

@@ -3994,7 +3995,8 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
39943995
/// XNACK can be enabled with a kernel boot parameter or with
39953996
/// the HSA_XNACK environment variable.
39963997
bool useAutoZeroCopyImpl() override {
3997-
return ((IsAPU || OMPX_ApuMaps) && IsXnackEnabled);
3998+
return !(OMPX_DGPUMaps && IsAPU) &&
3999+
((IsAPU || OMPX_ApuMaps) && IsXnackEnabled);
39984000
}
39994001

40004002
/// Performs sanity checks on the selected zero-copy configuration and prints
@@ -4407,6 +4409,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
44074409
/// is applied.
44084410
UInt32Envar OMPX_APUPrefaultMemcopySize;
44094411

4412+
/// Value of OMPX_DGPU_MAPS. When enabled, it will always perform
4413+
/// copy on APUs regardless of the setting of HSA_XNACK.
4414+
BoolEnvar OMPX_DGPUMaps;
4415+
44104416
/// Stream manager for AMDGPU streams.
44114417
AMDGPUStreamManagerTy AMDGPUStreamManager;
44124418

0 commit comments

Comments
 (0)