Skip to main content

Module spirv

Module spirv 

Source
Expand description

SPIR-V compute kernel generators for the Level Zero backend.

This module provides:

  • A lightweight SpvModule builder for emitting valid SPIR-V binaries.
  • Generator functions for unary, binary, reduce, and GEMM compute kernels consumed by Level Zero’s zeModuleCreate.
  • The original trivial_compute_shader placeholder used for validation.

All generated kernels use the OpenCL SPIR-V execution model (Kernel) with Physical64/OpenCL memory model. Buffer parameters are CrossWorkgroup pointers; scalar parameters are passed by value via zeKernelSetArgumentValue.

The generated SPIR-V targets version 1.2 (widely supported by Level Zero).

Structs§

SpvModule
Lightweight SPIR-V word-stream builder.

Constants§

SPIRV_GENERATOR
Generator magic — OxiCUDA Level Zero backend.
SPIRV_MAGIC
SPIR-V magic number.
SPIRV_VERSION_1_2
SPIR-V version 1.2.

Functions§

batched_gemm_compute_shader
Generate an OpenCL SPIR-V compute kernel for batched GEMM.
binary_compute_shader
Generate an OpenCL SPIR-V compute kernel for an element-wise binary operation.
gemm_compute_shader
Generate an OpenCL SPIR-V compute kernel for GEMM: C = alpha * A * B + beta * C.
reduce_compute_shader
Generate an OpenCL SPIR-V compute kernel for reduction along an axis.
trivial_compute_shader
Build a minimal valid Shader-style compute shader: void main() {}.
trivial_compute_shader_bytes
Return the trivial compute shader as a byte slice suitable for passing to Level Zero module creation.
unary_compute_shader
Generate an OpenCL SPIR-V compute kernel for an element-wise unary operation.