gpu_kernel

Attribute Macro gpu_kernel 

Source
#[gpu_kernel]
Expand description

Define a GPU kernel with metadata.

This attribute generates a kernel struct and implements the necessary traits.

§Attributes

  • id - Unique kernel identifier (required)
  • mode - Kernel mode: “batch” or “ring” (required)
  • domain - Business domain (required)
  • description - Human-readable description (optional)
  • throughput - Expected throughput in ops/sec (optional)
  • latency_us - Target latency in microseconds (optional)
  • gpu_native - Whether GPU-native execution is required (optional)

§Example

#[gpu_kernel(
    id = "graph/pagerank",
    mode = "ring",
    domain = "GraphAnalytics",
    description = "PageRank centrality calculation",
    throughput = 100_000,
    latency_us = 1.0,
    gpu_native = true
)]
pub async fn pagerank(ctx: &mut RingContext, req: PageRankRequest) -> PageRankResponse {
    // Implementation
}