pub enum CudaStmt {
Show 17 variants
VarDecl {
ty: CudaType,
name: String,
init: Option<CudaExpr>,
},
Assign {
lhs: CudaExpr,
rhs: CudaExpr,
},
CompoundAssign {
lhs: CudaExpr,
op: CudaBinOp,
rhs: CudaExpr,
},
IfElse {
cond: CudaExpr,
then_body: Vec<CudaStmt>,
else_body: Option<Vec<CudaStmt>>,
},
ForLoop {
init: Box<CudaStmt>,
cond: CudaExpr,
step: CudaExpr,
body: Vec<CudaStmt>,
},
WhileLoop {
cond: CudaExpr,
body: Vec<CudaStmt>,
},
KernelLaunch {
name: String,
config: LaunchConfig,
args: Vec<CudaExpr>,
},
CudaMalloc {
ptr: String,
size: CudaExpr,
},
CudaMemcpy {
dst: CudaExpr,
src: CudaExpr,
size: CudaExpr,
kind: MemcpyKind,
},
CudaFree(CudaExpr),
Return(Option<CudaExpr>),
Expr(CudaExpr),
DeviceSync,
CheckError(CudaExpr),
Block(Vec<CudaStmt>),
Break,
Continue,
}Expand description
CUDA statement AST node.
Variants§
VarDecl
Variable declaration with optional initializer:
CudaType name [ = init ];
Assign
Simple assignment: lhs = rhs;
CompoundAssign
Compound assignment: lhs += rhs; etc.
IfElse
If / optional else:
ForLoop
C-style for loop:
for (init; cond; step) { body }
WhileLoop
While loop: while (cond) { body }
KernelLaunch
CUDA kernel launch: name<<<grid, block, shmem, stream>>>(args...);
CudaMalloc
cudaMalloc((void**)&ptr, size);
CudaMemcpy
cudaMemcpy(dst, src, size, kind);
CudaFree(CudaExpr)
cudaFree(ptr);
Return(Option<CudaExpr>)
return expr;
Expr(CudaExpr)
Raw expression statement: expr;
DeviceSync
cudaDeviceSynchronize();
CheckError(CudaExpr)
cudaCheckError() macro invocation
Block(Vec<CudaStmt>)
Block of statements grouped with {}
Break
break;
Continue
continue;
Trait Implementations§
impl StructuralPartialEq for CudaStmt
Auto Trait Implementations§
impl Freeze for CudaStmt
impl RefUnwindSafe for CudaStmt
impl Send for CudaStmt
impl Sync for CudaStmt
impl Unpin for CudaStmt
impl UnsafeUnpin for CudaStmt
impl UnwindSafe for CudaStmt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more