Execution Traits#

Execution traits can be retrieved from a function descriptor using the helper functions provided below.

Trait

Description

is_warp<Description>

true if the Description is configured for execution with a Warp operator.

is_block<Description>

true if the Description is configured for execution with a Block operator.

block_dim_of<Description>

Selected block dimension with a BlockDim Operator.

block_warp_of<Description>

Selected block dimension with a BlockWarp Operator.

is_comp_execution<Description>

true if Description is a function description configured for execution with execution operators.

is_complete_comp_execution<Description>

true if is_complete_comp<Description> and is_comp_execution<Description> are both true.

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.