Skip to main content

gpu_asm

Macro gpu_asm 

Source
gpu_asm!() { /* proc-macro */ }
Expand description

GPU version of asm. Currently parses all the same options, but most are not applicable to GPU assembly architectures. Should validate and give proper errors at some point. Also adds a new register spec: the inferred register specifier (_). This is because the specifier isn’t actually meaningful in PTX and is currently ignored, with constraints being inferred from the value type. The reason it’s still present is because we may want to add an explicit mem specifier to allow fine-grained memory clobbering, or support for other assembly formats that do use different register types.

§Example

#use cubecl_macros::cube;
#[cube]
fn do_stuff(input: u32) -> u32 {
    let mut out: u32;
    gpu_asm!("some.custom.ptx {} {}", out(_) out, in(_) input)
}