Execution Traits#
Execution traits can be retrieved from a function descriptor using the helper functions provided below.
Trait |
Description |
---|---|
|
|
|
|
Selected block dimension with a BlockDim Operator. |
|
Selected block dimension with a BlockWarp Operator. |
|
|
|
|
For example, one can use the execution traits conveniently in user code to verify completeness before invoking execution:
#include <nvcompdx.hpp>
using namespace nvcompdx;
using COMP = decltype(Algorithm<algorithm::ans>() +
DataType<datatype::uint8>() +
Direction<direction::compress>() +
MaxUncompChunkSize<32768>() +
SM<800>() +
Block() +
BlockWarp<8, true>());
if constexpr (is_complete_comp_execution<COMP>::value) {
// Perform the described compression operation
COMP::execute(...);
}
Is it a warp-level execution description? Trait#
// bool
nvcompdx::is_warp<Description>::value
nvcompdx::is_warp_v<Description>
The trait evaluates to true
if the descriptor is an nvCOMPDx function description configured for execution, formed with the Warp operator.
Is it a block-level execution description? Trait#
// bool
nvcompdx::is_block<Description>::value
nvcompdx::is_block_v<Description>
The trait evaluates to true
if the descriptor is an nvCOMPDx function description configured for execution, formed with the Block operator.
BlockDim Trait#
// dim3
nvcompdx::block_dim_of<Description>::value
nvcompdx::block_dim_of_v<Description>
The block_dim_of
trait retrieves the selected block dimension of (de)compression problem we want to solve, as set by the BlockDim Operator.
If the descriptor was not created using a BlockDim Operator, compilation will fail with an error message.
BlockWarp Trait#
// std::tuple<unsigned int, bool>
nvcompdx::block_warp_of<Description>::value
nvcompdx::block_warp_of_v<Description>
The block_warp_of
trait retrieves the selected block dimension of (de)compression problem we want to solve, as set by the BlockWarp Operator.
If the descriptor was not created using a BlockWarp Operator, compilation will fail with an error message.
Is it an execution description? Trait#
// bool
nvcompdx::is_comp_execution<Description>::value
nvcompdx::is_comp_execution_v<Description>
The trait evaluates to true
if the descriptor is an nvCOMPDx function description configured for execution, formed with both description operators and execution operators.
Is it a complete execution description? Trait#
// bool
nvcompdx::is_complete_comp_execution<Description>::value
nvcompdx::is_complete_comp_execution_v<Description>
The trait evaluates to true
if both Is it an execution description? Trait and Is it a complete description? Trait are true
.
Note
If is_complete_comp_execution<Description>
evaluates to true
for a function descriptor, then one can use the Execution Method to execute the function.