kernelfoundry.compiler

Kernel compilation helpers for building PyTorch extensions.

See kernelfoundry.custom_test.Task.compile_torch_extension() for a high-level interface.

Classes

BaseKernelCompiler(extension_name, src, ...)

Abstract base class for kernel compilers.

IcpxCompiler(extension_name, src, build_dir, ...)

Compiler class for SYCL programs using the Intel icpx compiler.

TorchCompiler(extension_name, src, ...[, ...])

Compiler class using the torch cpp_extension compiler.

class kernelfoundry.compiler.BaseKernelCompiler(extension_name: str, src: str, build_dir: str, gpu_arch: str, timeout: int = 120, verbose: bool = False)[source]

Abstract base class for kernel compilers.

__init__(extension_name: str, src: str, build_dir: str, gpu_arch: str, timeout: int = 120, verbose: bool = False)[source]

Initialize the Compiler.

Parameters:
  • extension_name (str) – Name of the PyTorch extension to build.

  • src (str) – Path to the source file.

  • build_dir (str) – Directory to store the compiled outputs.

  • gpu_arch (str) – GPU architecture string.

  • timeout (int) – Timeout for each compilation step in seconds.

  • verbose (bool) – Whether to enable verbose output.

abstract compile()[source]
class kernelfoundry.compiler.TorchCompiler(extension_name: str, src: str, build_dir: str, gpu_arch: str, timeout: int = 120, verbose: bool = False)[source]

Compiler class using the torch cpp_extension compiler.

compile()[source]
class kernelfoundry.compiler.IcpxCompiler(extension_name: str, src: str, build_dir: str, gpu_arch: str, timeout: int = 120, verbose: bool = False)[source]

Compiler class for SYCL programs using the Intel icpx compiler.

compile()[source]

Compile the SYCL program into a PyTorch extension.