Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions offload/plugins-nextgen/amdgpu/src/rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,10 @@ struct AMDGPUKernelTy : public GenericKernelTy {
if (ThreadLimitClause[0] > 0 && ThreadLimitClause[0] != (uint32_t)-1 &&
ThreadLimitClause[0] <= static_cast<uint32_t>(ConstWGSize))
return llvm::omp::getBlockSizeAsPowerOfTwo(ThreadLimitClause[0]);
uint32_t BlockSizeOverride = GenericDevice.getOMPXXteamBlockSize();
if (BlockSizeOverride > 0 &&
BlockSizeOverride <= static_cast<int32_t>(ConstWGSize))
return llvm::omp::getBlockSizeAsPowerOfTwo(BlockSizeOverride);
assert(((ConstWGSize & (ConstWGSize - 1)) == 0) &&
"XTeam Reduction blocksize must be a power of two");
return ConstWGSize;
Expand Down Expand Up @@ -3096,6 +3100,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
"LIBOMPTARGET_AMDGPU_ADJUST_XTEAM_RED_TEAMS", 1),
OMPX_GenericSpmdUseSmallBlockSize(
"LIBOMPTARGET_AMDGPU_GENERIC_SPMD_USE_SMALL_BLOCKSIZE", 1),
OMPX_XteamBlockSize("LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE", 0),
OMPX_MaxAsyncCopyBytes("LIBOMPTARGET_AMDGPU_MAX_ASYNC_COPY_BYTES",
64 * 1024),
OMPX_InitialNumSignals("LIBOMPTARGET_AMDGPU_NUM_INITIAL_HSA_SIGNALS",
Expand Down Expand Up @@ -3235,6 +3240,9 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
virtual bool getOMPXGenericSpmdUseSmallBlockSize() const override {
return OMPX_GenericSpmdUseSmallBlockSize;
}
virtual uint32_t getOMPXXteamBlockSize() const override {
return OMPX_XteamBlockSize;
}

uint64_t getDeviceTimeStamp() override { return getSystemTimestampInNs(); }

Expand Down Expand Up @@ -4872,6 +4880,13 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
/// be reduced and the corresponding number of teams adjusted.
BoolEnvar OMPX_GenericSpmdUseSmallBlockSize;

/// Envar indicating the blocksize to be used for Xteam reduction kernels. The
/// default of 0 indicates that there is no runtime override and the value
/// indicated by CodeGen will be used. If a non-zero value is specified, the
/// runtime will attempt to use it as an override if other constraints are
/// satisfied.
UInt32Envar OMPX_XteamBlockSize;

/// Envar specifying the maximum size in bytes where the memory copies are
/// asynchronous operations. Up to this transfer size, the memory copies are
/// asynchronous operations pushed to the corresponding stream. For larger
Expand Down
3 changes: 3 additions & 0 deletions offload/plugins-nextgen/common/include/PluginInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,9 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
virtual bool getOMPXGenericSpmdUseSmallBlockSize() const {
llvm_unreachable("Unimplemented");
}
virtual uint32_t getOMPXXteamBlockSize() const {
llvm_unreachable("Unimplemented");
}

/// Get target compute unit kind (e.g., sm_80, or gfx908).
virtual std::string getComputeUnitKind() const { return "unknown"; }
Expand Down