Skip to content

Commit

Permalink
Rename from unchecked to direct_unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBurmark committed Dec 30, 2024
1 parent c4b466b commit 8680495
Show file tree
Hide file tree
Showing 41 changed files with 352 additions and 342 deletions.
79 changes: 44 additions & 35 deletions docs/sphinx/user_guide/feature/policies.rst

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/RAJA/policy/cuda/kernel/For.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ template <typename Data,
struct CudaStatementExecutor<
Data,
statement::For<ArgumentId,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types> {

Expand All @@ -60,7 +60,7 @@ struct CudaStatementExecutor<
using diff_t = segment_diff_type<ArgumentId, Data>;

using DimensionCalculator = RAJA::internal::KernelDimensionCalculator<
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>>;
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>>;

static inline RAJA_DEVICE
void exec(Data &data, bool thread_active)
Expand Down
8 changes: 4 additions & 4 deletions include/RAJA/policy/cuda/kernel/ForICount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace internal

/*
* Executor for work sharing inside CudaKernel.
* Provides an unchecked mapping.
* Provides a direct unchecked mapping.
* Assigns the loop index to offset ArgumentId
* Assigns the loop index to param ParamId
* Meets all sync requirements
Expand All @@ -47,20 +47,20 @@ template <typename Data,
struct CudaStatementExecutor<
Data,
statement::ForICount<ArgumentId, ParamId,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types>
: CudaStatementExecutor<
Data,
statement::For<ArgumentId,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types> {

using Base = CudaStatementExecutor<
Data,
statement::For<ArgumentId,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types>;

Expand Down
8 changes: 4 additions & 4 deletions include/RAJA/policy/cuda/kernel/Tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct CudaStatementExecutor<
Data,
statement::Tile<ArgumentId,
RAJA::tile_fixed<chunk_size>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types>
{
Expand All @@ -69,7 +69,7 @@ struct CudaStatementExecutor<

using diff_t = segment_diff_type<ArgumentId, Data>;

using DimensionCalculator = KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>>;
using DimensionCalculator = KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>>;

static inline RAJA_DEVICE
void exec(Data &data, bool thread_active)
Expand Down Expand Up @@ -116,8 +116,8 @@ struct CudaStatementExecutor<
// restrict to first tile
segment = segment.slice(0, static_cast<diff_t>(chunk_size));

// NOTE: We do not detect improper uses of unchecked policies under tiling.
// This happens when using an unchecked policy on a tiled range that is not
// NOTE: We do not detect improper uses of direct_unchecked policies under tiling.
// This happens when using a direct unchecked policy on a tiled range that is not
// evenly divisible by chunk_size.
LaunchDims enclosed_dims =
enclosed_stmts_t::calculateDimensions(private_data);
Expand Down
6 changes: 3 additions & 3 deletions include/RAJA/policy/cuda/kernel/TileTCount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ struct CudaStatementExecutor<
Data,
statement::TileTCount<ArgumentId, ParamId,
RAJA::tile_fixed<chunk_size>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types>
: public CudaStatementExecutor<
Data,
statement::Tile<ArgumentId,
RAJA::tile_fixed<chunk_size>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types> {

using Base = CudaStatementExecutor<
Data,
statement::Tile<ArgumentId,
RAJA::tile_fixed<chunk_size>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked, sync, IndexMapper>,
RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked, sync, IndexMapper>,
EnclosedStmts...>,
Types>;

Expand Down
36 changes: 18 additions & 18 deletions include/RAJA/policy/cuda/kernel/internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ using cuda_statement_list_executor_t = CudaStatementListExecutor<
template<typename kernel_indexer>
struct KernelDimensionCalculator;

// specialization for unchecked sequential policies
// specialization for direct unchecked sequential policies
template<named_dim dim, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::ignored, named_usage::ignored>>>
{
Expand All @@ -232,9 +232,9 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
}
};

// specialization for unchecked thread policies
// specialization for direct unchecked thread policies
template<named_dim dim, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::unspecified, named_usage::ignored>>>
{
Expand All @@ -250,7 +250,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
};
///
template<named_dim dim, int BLOCK_SIZE, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, BLOCK_SIZE, named_usage::ignored>>>
{
Expand All @@ -262,16 +262,16 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
static void set_dimensions(CudaDims& dims, CudaDims& min_dims, IdxT len)
{
if ( len != static_cast<IdxT>(IndexMapper::block_size) ) {
RAJA_ABORT_OR_THROW("len does not match the size of the unchecked mapped index space");
RAJA_ABORT_OR_THROW("len does not match the size of the direct_unchecked mapped index space");
}
set_cuda_dim<dim>(dims.threads, static_cast<IdxT>(IndexMapper::block_size));
set_cuda_dim<dim>(min_dims.threads, static_cast<IdxT>(IndexMapper::block_size));
}
};

// specialization for unchecked block policies
// specialization for direct unchecked block policies
template<named_dim dim, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::ignored, named_usage::unspecified>>>
{
Expand All @@ -286,7 +286,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
};
///
template<named_dim dim, int GRID_SIZE, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::ignored, GRID_SIZE>>>
{
Expand All @@ -298,16 +298,16 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
static void set_dimensions(CudaDims& dims, CudaDims& min_dims, IdxT len)
{
if ( len != static_cast<IdxT>(IndexMapper::grid_size) ) {
RAJA_ABORT_OR_THROW("len does not match the size of the unchecked mapped index space");
RAJA_ABORT_OR_THROW("len does not match the size of the direct_unchecked mapped index space");
}
set_cuda_dim<dim>(dims.blocks, static_cast<IdxT>(IndexMapper::grid_size));
set_cuda_dim<dim>(min_dims.blocks, static_cast<IdxT>(IndexMapper::grid_size));
}
};

// specialization for unchecked global policies
// specialization for direct unchecked global policies
template<named_dim dim, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::unspecified, named_usage::unspecified>>>
{
Expand All @@ -323,7 +323,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
};
///
template<named_dim dim, int GRID_SIZE, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, named_usage::unspecified, GRID_SIZE>>>
{
Expand All @@ -337,7 +337,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
// BEWARE: if calculated block_size is too high then the kernel launch will fail
const IdxT block_size = RAJA_DIVIDE_CEILING_INT(len, static_cast<IdxT>(IndexMapper::grid_size));
if ( len != (block_size * static_cast<IdxT>(IndexMapper::grid_size)) ) {
RAJA_ABORT_OR_THROW("len does not match the size of the unchecked mapped index space");
RAJA_ABORT_OR_THROW("len does not match the size of the direct_unchecked mapped index space");
}
set_cuda_dim<dim>(dims.threads, block_size);
set_cuda_dim<dim>(dims.blocks, static_cast<IdxT>(IndexMapper::grid_size));
Expand All @@ -347,7 +347,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
};
///
template<named_dim dim, int BLOCK_SIZE, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, BLOCK_SIZE, named_usage::unspecified>>>
{
Expand All @@ -360,7 +360,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
{
const IdxT grid_size = RAJA_DIVIDE_CEILING_INT(len, static_cast<IdxT>(IndexMapper::block_size));
if ( len != (static_cast<IdxT>(IndexMapper::block_size) * grid_size) ) {
RAJA_ABORT_OR_THROW("len does not match the size of the unchecked mapped index space");
RAJA_ABORT_OR_THROW("len does not match the size of the direct_unchecked mapped index space");
}
set_cuda_dim<dim>(dims.threads, static_cast<IdxT>(IndexMapper::block_size));
set_cuda_dim<dim>(dims.blocks, grid_size);
Expand All @@ -370,7 +370,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
};
///
template<named_dim dim, int BLOCK_SIZE, int GRID_SIZE, kernel_sync_requirement sync>
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::Unchecked,
struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapping::DirectUnchecked,
sync,
cuda::IndexGlobal<dim, BLOCK_SIZE, GRID_SIZE>>>
{
Expand All @@ -384,7 +384,7 @@ struct KernelDimensionCalculator<RAJA::policy::cuda::cuda_indexer<iteration_mapp
{
if ( len != (static_cast<IdxT>(IndexMapper::block_size) *
static_cast<IdxT>(IndexMapper::grid_size)) ) {
RAJA_ABORT_OR_THROW("len does not match the size of the unchecked mapped index space");
RAJA_ABORT_OR_THROW("len does not match the size of the direct_unchecked mapped index space");
}
set_cuda_dim<dim>(dims.threads, static_cast<IdxT>(IndexMapper::block_size));
set_cuda_dim<dim>(dims.blocks, static_cast<IdxT>(IndexMapper::grid_size));
Expand Down
Loading

0 comments on commit 8680495

Please sign in to comment.