Operators#
cuPQC-BigInt operators are used to describe a big-integer instance and configure its execution.
They are combined via addition (+) to form a cuPQC-BigInt descriptor.
Description Operators#
BitWidth#
-
template<unsigned int BW>
BitWidth()#
Sets the bit width BW of a big-integer instance. BW must be a multiple of 32 and greater
than 0. The number of 32-bit limbs is BW / 32.
Not every width satisfying those constraints is built: the set depends on the chosen TPI,
and one outside it fails to link. See
Supported Widths.
Default: BitWidth<256>.
Read back from a composed descriptor as BI::bit_width, and the resulting limb
count as BI::num_limbs.
SM#
-
template<unsigned int Architecture>
SM()#
Sets the target GPU architecture Architecture to generate code for, expressed as
major * 100 + minor * 10 (for example, 800 for compute capability 8.0).
Default: SM<800>.
Read back from a composed descriptor as BI::sm_arch.
TPI#
-
template<unsigned int T>
TPI()#
Sets the number of Threads Per Instance T: the number of consecutive warp lanes that
cooperate to hold and operate on a single big-integer instance. T must be a power of two,
1 <= T <= 32, and must not exceed the instance’s limb count (BW / 32).
Required when Warp() is used; must not be combined with
Thread().
Default: none. A descriptor without this operator reports BI::tpi as 1,
which is the Thread() case; 1 cannot be requested
explicitly, because TPI<1>() alongside Thread() is still rejected.
Read back from a composed descriptor as BI::tpi.
Execution Operators#
Exactly one of Thread() or Warp() must appear in a descriptor.
Thread#
-
Thread()#
Selects single-thread execution: one CUDA thread owns and operates on the entire big-integer
instance. Cannot be combined with TPI().
Warp#
-
Warp()#
Selects warp-cooperative execution: TPI()
consecutive warp lanes cooperate on one instance, each lane holding a contiguous slice of the
limbs (lowest-index lane holds the least-significant limbs). Requires
TPI() to be specified.
Not all operations are available under warp execution; see Warp Execution Coverage.
Error-Handling Operators#
OnErrorNone#
-
OnErrorNone()#
Selects the default on-error policy: failures are not reported by the error policy itself.
Callers of div_rem and inv_mod must inspect the returned bigint_error.
Default on-error policy.
OnErrorTrap#
-
OnErrorTrap()#
On any operation failure, calls __trap() on the offending thread(s), halting the kernel.
OnErrorPrintTrap#
-
OnErrorPrintTrap()#
On any operation failure, prints a diagnostic message identifying the failing block and thread
indices and the specific bigint_error, then calls __trap().