pub struct PtxFunction {
pub name: String,
pub params: Vec<(String, PtxType)>,
pub body: Vec<Instruction>,
pub shared_mem: Vec<(String, PtxType, usize)>,
pub max_threads: Option<u32>,
}Expand description
A PTX kernel or device function definition.
This structure holds all the information needed to emit a complete PTX function: the function signature (name and typed parameters), the instruction body, any shared memory allocations, and optional performance hints.
§Examples
use oxicuda_ptx::ir::{PtxFunction, PtxType};
let func = PtxFunction {
name: "vector_add".to_string(),
params: vec![
("a_ptr".to_string(), PtxType::U64),
("b_ptr".to_string(), PtxType::U64),
("c_ptr".to_string(), PtxType::U64),
("n".to_string(), PtxType::U32),
],
body: Vec::new(),
shared_mem: Vec::new(),
max_threads: Some(256),
};
assert_eq!(func.params.len(), 4);Fields§
§name: StringThe function name (without leading underscore — emitter adds $ prefix if needed).
params: Vec<(String, PtxType)>Kernel parameters as (name, type) pairs.
body: Vec<Instruction>The instruction body of the function.
Static shared memory declarations as (name, element_type, num_elements).
max_threads: Option<u32>Optional .maxnthreads directive (launch bounds hint to ptxas).
Implementations§
Trait Implementations§
Source§impl Clone for PtxFunction
impl Clone for PtxFunction
Source§fn clone(&self) -> PtxFunction
fn clone(&self) -> PtxFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PtxFunction
impl RefUnwindSafe for PtxFunction
impl Send for PtxFunction
impl Sync for PtxFunction
impl Unpin for PtxFunction
impl UnsafeUnpin for PtxFunction
impl UnwindSafe for PtxFunction
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