SWDEV-493805 - Cleaning up launch parameters arguments. (#241)
This commit is contained in:
committed by
GitHub
parent
607f8f26fd
commit
fa55557f46
@@ -56,6 +56,10 @@ class NDRange : public EmbeddedObject {
|
||||
//! Construct a new index space of the given dimensions.
|
||||
explicit NDRange(size_t dimensions);
|
||||
|
||||
NDRange(size_t dataX, size_t dataY, size_t dataZ) : dimensions_(3) {
|
||||
data_[0] = dataX; data_[1] = dataY; data_[2] = dataZ;
|
||||
}
|
||||
|
||||
//! Copy constructor.
|
||||
NDRange(const NDRange& space);
|
||||
|
||||
@@ -112,6 +116,40 @@ class NDRange : public EmbeddedObject {
|
||||
//! Print this index space on the given stream.
|
||||
void printOn(FILE* file) const;
|
||||
#endif // DEBUG
|
||||
|
||||
const size_t* Data() const { return data_; }
|
||||
};
|
||||
|
||||
//! Stucture to store launch parameters.
|
||||
struct LaunchParams {
|
||||
NDRange global_; //!< Total number of work-items in N-dims
|
||||
NDRange local_; //!< Number of work-items in N-dims in a workgroup.
|
||||
uint32_t sharedMemBytes_; //!< Shared Memory bytes
|
||||
bool validConfig_; //!< Flag will be set to false when config is not correct.
|
||||
|
||||
LaunchParams(uint32_t globalX, uint32_t globalY, uint32_t globalZ, uint32_t localX,
|
||||
uint32_t localY, uint32_t localZ, uint32_t sharedMemBytes)
|
||||
: global_(globalX, globalY, globalZ), local_(localX, localY, localZ),
|
||||
sharedMemBytes_ (sharedMemBytes), validConfig_(true) {}
|
||||
|
||||
bool IsValidConfig() const { return validConfig_; }
|
||||
};
|
||||
|
||||
//! Structure to store launch parameters in HIP Style (global and local size needs computation).
|
||||
struct HIPLaunchParams : public LaunchParams {
|
||||
public:
|
||||
HIPLaunchParams(uint32_t gridX, uint32_t gridY, uint32_t gridZ, uint32_t blockX,
|
||||
uint32_t blockY, uint32_t blockZ, uint32_t sharedMemBytes)
|
||||
: LaunchParams(static_cast<uint32_t>(gridX) * blockX,
|
||||
static_cast<uint32_t>(gridY) * blockY,
|
||||
static_cast<uint32_t>(gridZ) * blockZ,
|
||||
blockX, blockY, blockZ, sharedMemBytes) {
|
||||
if (global_[0] > std::numeric_limits<uint32_t>::max() ||
|
||||
global_[1] > std::numeric_limits<uint32_t>::max() ||
|
||||
global_[2] > std::numeric_limits<uint32_t>::max()) {
|
||||
validConfig_ = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//! A container for the local and global worksizes.
|
||||
|
||||
Reference in New Issue
Block a user