‘cudm’ Dialect#
Dialect wrapping the NVIDIA cuDensityMat API for quantum dynamics
The cudm dialect provides an MLIR representation of the NVIDIA cuDensityMat
library API for GPU-accelerated quantum dynamics simulation. It serves as
the lowering target for the qop dialect and the source for call
generation targeting the cuDensityMat runtime API.
Two tiers of operations:
API ops: wrappers around
cudensitymat*C API functions, whichcudm-to-llvmlowers to calls into the cudaq-pulse cuDensityMat runtimeSolver ops:
cudm.evolve, which the runtime integrates with its own rk1, rk2, rk4, Magnus or Crank-Nicolson stepper, and the reservedcudm.sse_evolveandcudm.apply_decoherence, which nothing lowers yet
Operations#
cudm.append_elementary_product (::cudm::AppendElementaryProductOp)#
Append a product of elementary operators to a term
Syntax:
operation ::= `cudm.append_elementary_product` $handle `,` $op_term `,` $elem_ops attr-dict `:` type($handle) `,` type($op_term) `,` type($elem_ops)
Appends to a term the product of elem_ops on the modes
modes_acted_on, weighted by coeff_real + i coeff_imag. An operator
on several modes takes that many consecutive entries of
modes_acted_on; a mode may appear twice in one operator, once on each
side. Each duality entry says whether its operator acts on the ket (0)
or the bra (1) side of that mode. The weight of a time-dependent
product is also multiplied, at each time, by the drive envelope that
its cudm.callback_kind and cudm.callback_params attributes
describe. callback names that envelope’s qop callback when there is
one; a sum of envelopes (kind 512, whose parameters list each
envelope’s kind, parameter count and parameters) has none.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
modes_acted_on | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
duality | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
coeff_real | ::mlir::FloatAttr | 64-bit float attribute |
coeff_imag | ::mlir::FloatAttr | 64-bit float attribute |
callback | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Operator term: sum of products of elementary/matrix operators |
|
variadic of Elementary tensor operator acting on specific modes |
cudm.apply_decoherence (::cudm::ApplyDecoherenceOp)#
Apply Lindblad T1/T2 decoherence for one time step
Syntax:
operation ::= `cudm.apply_decoherence` $handle `,` $state `,` $model `,` $dt attr-dict `:` type($handle) `,` type($state) `,` type($model)
Applies T1 and T2 decoherence of model over one step dt. The
execution lowering puts decoherence in the Lindblad operator instead
and does not use this op yet.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Quantum state (pure or mixed, optionally batched) |
|
T1/T2 decoherence parameters per qubit mode |
|
64-bit float |
cudm.create_elementary_op (::cudm::CreateElementaryOpOp)#
Create an elementary tensor operator
Syntax:
operation ::= `cudm.create_elementary_op` $handle `,` $tensor_data attr-dict `:` type($handle) `,` type($tensor_data) `->` type($elem_op)
An elementary operator on modes of mode_extents levels, copied to the
device. Dense, tensor_data is its matrix (column-major, interleaved
real and imaginary parts, as qop.matrix_leaf holds it). Multi-diagonal,
it acts on one mode and tensor_data holds one vector of the mode’s
extent per entry of diagonal_offsets (ascending; positive above the
main diagonal), element (r, r + offset) at index min(r, r + offset).
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
sparsity | ::cudm::SparsityAttr | Elementary operator sparsity pattern |
data_type | ::cudm::ComputeTypeAttr | Floating-point compute precision; the runtime computes in complex128 only |
mode_extents | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
callback | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
diagonal_offsets | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
any type |
Results:#
Result |
Description |
|---|---|
|
Elementary tensor operator acting on specific modes |
cudm.create_expectation (::cudm::CreateExpectationOp)#
Create expectation value computation object
Syntax:
operation ::= `cudm.create_expectation` $handle `,` $op attr-dict `:` type($handle) `,` type($op) `->` type($expectation)
An object computing the expectation value of an operator
(cudensitymatCreateExpectation). The execution lowering does not use
it yet; observables are reserved.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
Results:#
Result |
Description |
|---|---|
|
Expectation value computation handle |
cudm.create_op_term (::cudm::CreateOpTermOp)#
Create an empty operator term
Syntax:
operation ::= `cudm.create_op_term` $handle attr-dict `:` functional-type($handle, $op_term)
An empty operator term over modes of mode_extents levels, to which
products of elementary operators are appended.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
mode_extents | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
Results:#
Result |
Description |
|---|---|
|
Operator term: sum of products of elementary/matrix operators |
cudm.create_operator (::cudm::CreateOperatorOp)#
Create an empty composite operator (super-operator)
Syntax:
operation ::= `cudm.create_operator` $handle attr-dict `:` functional-type($handle, $op)
An empty composite operator (a super-operator on the state) over
modes of mode_extents levels.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
mode_extents | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
Results:#
Result |
Description |
|---|---|
|
Composite operator / super-operator |
cudm.create_state (::cudm::CreateStateOp)#
Define an empty quantum state of given purity and shape
Syntax:
operation ::= `cudm.create_state` $handle attr-dict `:` functional-type($handle, $state)
A state over modes of mode_extents levels (each at least 2): a pure
state vector or, with purity mixed, a density matrix, in
complex128. It starts as the ground state, or as the initial state
the host set for the next allocation on the thread.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
purity | ::cudm::StatePurityAttr | Quantum state purity |
data_type | ::cudm::ComputeTypeAttr | Floating-point compute precision; the runtime computes in complex128 only |
mode_extents | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
batch_size | ::mlir::IntegerAttr | 64-bit signless integer attribute |
distributed | ::mlir::BoolAttr | bool attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
Results:#
Result |
Description |
|---|---|
|
Quantum state (pure or mixed, optionally batched) |
cudm.create_workspace (::cudm::CreateWorkspaceOp)#
Create a workspace descriptor
Syntax:
operation ::= `cudm.create_workspace` $handle attr-dict `:` functional-type($handle, $workspace)
A workspace descriptor (cudensitymatCreateWorkspace). The runtime
allocates its scratch memory when an operator action is prepared.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
Results:#
Result |
Description |
|---|---|
|
Workspace buffer descriptor |
cudm.destroy_elementary_op (::cudm::DestroyElementaryOpOp)#
Destroy an elementary tensor operator
Syntax:
operation ::= `cudm.destroy_elementary_op` $elem_op attr-dict `:` type($elem_op)
Destroys an elementary operator and frees its device data.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Elementary tensor operator acting on specific modes |
cudm.destroy_expectation (::cudm::DestroyExpectationOp)#
Destroy expectation computation object
Syntax:
operation ::= `cudm.destroy_expectation` $expectation attr-dict `:` type($expectation)
Destroys an expectation object.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Expectation value computation handle |
cudm.destroy_handle (::cudm::DestroyHandleOp)#
Destroy cuDensityMat library context
Syntax:
operation ::= `cudm.destroy_handle` $handle attr-dict `:` type($handle)
Destroys a library context (cudensitymatDestroy) after everything
created on it.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
cudm.destroy_op_term (::cudm::DestroyOpTermOp)#
Destroy an operator term
Syntax:
operation ::= `cudm.destroy_op_term` $op_term attr-dict `:` type($op_term)
Destroys an operator term and releases its envelope callbacks.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Operator term: sum of products of elementary/matrix operators |
cudm.destroy_operator (::cudm::DestroyOperatorOp)#
Destroy a composite operator
Syntax:
operation ::= `cudm.destroy_operator` $op attr-dict `:` type($op)
Destroys a composite operator.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Composite operator / super-operator |
cudm.destroy_state (::cudm::DestroyStateOp)#
Destroy a quantum state
Syntax:
operation ::= `cudm.destroy_state` $state attr-dict `:` type($state)
Destroys a state and frees its storage.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Quantum state (pure or mixed, optionally batched) |
cudm.destroy_workspace (::cudm::DestroyWorkspaceOp)#
Destroy a workspace descriptor
Syntax:
operation ::= `cudm.destroy_workspace` $workspace attr-dict `:` type($workspace)
Destroys a workspace descriptor and frees its memory.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Workspace buffer descriptor |
cudm.evolve (::cudm::EvolveOp)#
Time-evolve a quantum state under an operator
Syntax:
operation ::= `cudm.evolve` $handle `,` $op `,` $state_in `,` $state_out `,` $workspace attr-dict `:` type($handle) `,` type($op) `,` type($state_in) `,` type($state_out) `,` type($workspace) `->` type($result)
Evolves state_in under the operator from t_start to t_end in
step_count equal steps of the integrator (rk1, rk2, rk4, magnus or
crank_nicolson), writing the final state to state_out, which is
also the result. cudm-to-llvm lowers it to the runtime’s
cudm_evolve followed by a capture of the result for the host.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
integrator | ::cudm::IntegratorKindAttr | Time-integration strategy |
t_start | ::mlir::FloatAttr | 64-bit float attribute |
t_end | ::mlir::FloatAttr | 64-bit float attribute |
step_count | ::mlir::IntegerAttr | 64-bit signless integer attribute |
compute_type | ::cudm::ComputeTypeAttr | Floating-point compute precision; the runtime computes in complex128 only |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
|
Quantum state (pure or mixed, optionally batched) |
|
Quantum state (pure or mixed, optionally batched) |
|
Workspace buffer descriptor |
Results:#
Result |
Description |
|---|---|
|
Quantum state (pure or mixed, optionally batched) |
cudm.expectation_compute (::cudm::ExpectationComputeOp)#
Compute operator expectation value(s)
Syntax:
operation ::= `cudm.expectation_compute` $handle `,` $expectation `,` $time `,` $batch_size `,` $param_count `,` $params `,` $state `,` $workspace attr-dict `:` type($handle) `,` type($expectation) `,` type($params) `,` type($state) `,` type($workspace) `->` type($value)
The expectation value of an operator in state at time.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Expectation value computation handle |
|
64-bit float |
|
64-bit signless integer |
|
32-bit signless integer |
|
any type |
|
Quantum state (pure or mixed, optionally batched) |
|
Workspace buffer descriptor |
Results:#
Result |
Description |
|---|---|
|
any type |
cudm.init_handle (::cudm::InitHandleOp)#
Create cuDensityMat library context
Syntax:
operation ::= `cudm.init_handle` attr-dict `:` type($handle)
A cuDensityMat library context (cudensitymatCreate). The lowered
program creates one per run, builds its states and operators on it
and destroys it last; the run’s drive-envelope callbacks belong to
it.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Results:#
Result |
Description |
|---|---|
|
cuDensityMat library context handle |
cudm.operator_append_term (::cudm::OperatorAppendTermOp)#
Append an operator term to a composite operator
Syntax:
operation ::= `cudm.operator_append_term` $handle `,` $op `,` $term attr-dict `:` type($handle) `,` type($op) `,` type($term)
Appends a term to a composite operator, weighted by
coeff_real + i coeff_imag. With duality 1, every mode action of
the term is flipped between the ket and bra sides; the lowering uses
this for the bra half of -i [H, rho].
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
duality | ::mlir::IntegerAttr | 32-bit signless integer attribute |
coeff_real | ::mlir::FloatAttr | 64-bit float attribute |
coeff_imag | ::mlir::FloatAttr | 64-bit float attribute |
callback | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
|
Operator term: sum of products of elementary/matrix operators |
cudm.operator_compute_action (::cudm::OperatorComputeActionOp)#
Compute operator action: state_out += Op(t, params) * state_in
Syntax:
operation ::= `cudm.operator_compute_action` $handle `,` $op `,` $time `,` $batch_size `,` $param_count `,` $params `,` $state_in `,` $state_out `,` $workspace attr-dict `:` type($handle) `,` type($op) `,` type($params) `,` type($state_in) `,` type($state_out) `,` type($workspace)
Accumulates the action of an operator at time and parameters
params on state_in into state_out
(cudensitymatOperatorComputeAction).
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
|
64-bit float |
|
64-bit signless integer |
|
32-bit signless integer |
|
any type |
|
Quantum state (pure or mixed, optionally batched) |
|
Quantum state (pure or mixed, optionally batched) |
|
Workspace buffer descriptor |
cudm.operator_prepare_action (::cudm::OperatorPrepareActionOp)#
Prepare operator for action on quantum state
Syntax:
operation ::= `cudm.operator_prepare_action` $handle `,` $op `,` $state_in `,` $state_out `,` $workspace attr-dict `:` type($handle) `,` type($op) `,` type($state_in) `,` type($state_out) `,` type($workspace)
Prepares the action of an operator on states of the given shape
within workspace_limit bytes of workspace
(cudensitymatOperatorPrepareAction).
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
compute_type | ::cudm::ComputeTypeAttr | Floating-point compute precision; the runtime computes in complex128 only |
workspace_limit | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
|
Quantum state (pure or mixed, optionally batched) |
|
Quantum state (pure or mixed, optionally batched) |
|
Workspace buffer descriptor |
cudm.sse_evolve (::cudm::SSEEvolveOp)#
Stochastic Schrodinger equation ensemble evolution
Syntax:
operation ::= `cudm.sse_evolve` $handle `,` $hamiltonian `,` `(` $collapse_ops `)` `,` $initial_state `,` $workspace attr-dict `:` type($handle) `,` type($hamiltonian) `,` `(` type($collapse_ops) `)` `,` type($initial_state) `,` type($workspace) `->` type($result)
Evolves trajectory_count stochastic Schrodinger trajectories under
a Hamiltonian and collapse operators from t_start to t_end in
step_count steps, seeded by seed. The counts must be at least 1
and t_end later than t_start. Reserved for trajectory
simulation; nothing lowers it yet.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
integrator | ::cudm::IntegratorKindAttr | Time-integration strategy |
trajectory_count | ::mlir::IntegerAttr | 64-bit signless integer attribute |
t_start | ::mlir::FloatAttr | 64-bit float attribute |
t_end | ::mlir::FloatAttr | 64-bit float attribute |
step_count | ::mlir::IntegerAttr | 64-bit signless integer attribute |
seed | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:#
Operand |
Description |
|---|---|
|
cuDensityMat library context handle |
|
Composite operator / super-operator |
|
variadic of Elementary tensor operator acting on specific modes |
|
Quantum state (pure or mixed, optionally batched) |
|
Workspace buffer descriptor |
Results:#
Result |
Description |
|---|---|
|
Ensemble results from the SSE quantum trajectory solver |
Attributes#
ComputeTypeAttr#
Floating-point compute precision; the runtime computes in complex128 only
Syntax:
#cudm.compute_type<
::cudm::ComputeType # value
>
Parameters:#
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type ComputeType |
IntegratorKindAttr#
Time-integration strategy
Syntax:
#cudm.integrator<
::cudm::IntegratorKind # value
>
Parameters:#
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type IntegratorKind |
SparsityAttr#
Elementary operator sparsity pattern
Syntax:
#cudm.sparsity<
::cudm::Sparsity # value
>
Parameters:#
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type Sparsity |
StatePurityAttr#
Quantum state purity
Syntax:
#cudm.purity<
::cudm::StatePurity # value
>
Parameters:#
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type StatePurity |
Types#
DecoherenceModelType#
T1/T2 decoherence parameters per qubit mode
Syntax: !cudm.decoherence_model
ElementaryOpType#
Elementary tensor operator acting on specific modes
Syntax: !cudm.elementary_op
ExpectationType#
Expectation value computation handle
Syntax: !cudm.expectation
HandleType#
CuDensityMat library context handle
Syntax: !cudm.handle
MatrixOpType#
Full matrix operator acting on all modes
Syntax: !cudm.matrix_op
OpActionType#
Aggregate operator action for coupled ODE systems
Syntax: !cudm.op_action
OpTermType#
Operator term: sum of products of elementary/matrix operators
Syntax: !cudm.op_term
OperatorType#
Composite operator / super-operator
Syntax: !cudm.operator
SpectrumType#
Operator eigenspectrum computation handle
Syntax: !cudm.spectrum
StateType#
Quantum state (pure or mixed, optionally batched)
Syntax: !cudm.state
TrajectoryResultType#
Ensemble results from the SSE quantum trajectory solver
Syntax: !cudm.trajectory_result
WorkspaceType#
Workspace buffer descriptor
Syntax: !cudm.workspace
Enums#
ComputeType#
Floating-point compute precision; the runtime computes in complex128 only
Cases:#
Symbol |
Value |
String |
|---|---|---|
F64 |
|
f64 |
IntegratorKind#
Time-integration strategy
Cases:#
Symbol |
Value |
String |
|---|---|---|
RungeKutta1 |
|
rk1 |
RungeKutta2 |
|
rk2 |
RungeKutta4 |
|
rk4 |
Magnus |
|
magnus |
CrankNicolson |
|
crank_nicolson |
Sparsity#
Elementary operator sparsity pattern
Cases:#
Symbol |
Value |
String |
|---|---|---|
None |
|
none |
Multidiagonal |
|
multidiagonal |
StatePurity#
Quantum state purity
Cases:#
Symbol |
Value |
String |
|---|---|---|
Pure |
|
pure |
Mixed |
|
mixed |