Table of Contents

Class CompilationOptions

Namespace
DotCompute.Abstractions
Assembly
DotCompute.Abstractions.dll

Comprehensive compilation options for kernel compilation across different backends

public class CompilationOptions
Inheritance
CompilationOptions
Derived
Inherited Members
Extension Methods

Properties

AdditionalFlags

Additional compiler flags

public IList<string> AdditionalFlags { get; }

Property Value

IList<string>

AggressiveOptimizations

Enable aggressive optimizations

public bool AggressiveOptimizations { get; set; }

Property Value

bool

AllowUnsafeCode

Allow unsafe code during compilation

public bool AllowUnsafeCode { get; set; }

Property Value

bool

CompilationTimeout

Maximum compilation time before timeout

[Range(typeof(TimeSpan), "00:00:01", "00:10:00")]
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
public TimeSpan CompilationTimeout { get; set; }

Property Value

TimeSpan

CompileToCubin

Whether to compile to CUBIN format instead of PTX

public bool CompileToCubin { get; set; }

Property Value

bool

CompilerBackend

Compiler backend to use

public string? CompilerBackend { get; set; }

Property Value

string

ComputeCapability

Target compute capability version for compilation

public Version ComputeCapability { get; set; }

Property Value

Version

Debug

Debug-optimized compilation options

public static CompilationOptions Debug { get; }

Property Value

CompilationOptions

Default

Default compilation options

public static CompilationOptions Default { get; }

Property Value

CompilationOptions

Defines

Compiler-specific defines

public Dictionary<string, string> Defines { get; }

Property Value

Dictionary<string, string>

EnableDebugInfo

Enable debug information generation

public bool EnableDebugInfo { get; set; }

Property Value

bool

EnableDeviceDebugging

Enable device-level debugging (alias for EnableDebugInfo)

public bool EnableDeviceDebugging { get; set; }

Property Value

bool

EnableDynamicParallelism

Enable dynamic parallelism support for CUDA kernels Allows kernels to launch other kernels from GPU code

public bool EnableDynamicParallelism { get; set; }

Property Value

bool

EnableFastMath

Enable fast math optimizations (may reduce precision)

public bool EnableFastMath { get; set; }

Property Value

bool

EnableInlining

Enable inline function optimizations

public bool EnableInlining { get; set; }

Property Value

bool

EnableL2CacheResidencyControl

Enable L2 cache residency control (CUDA 13.0+ on Ampere and newer)

public bool EnableL2CacheResidencyControl { get; set; }

Property Value

bool

EnableLoopUnrolling

Enable loop unrolling optimizations

public bool EnableLoopUnrolling { get; set; }

Property Value

bool

EnableMemoryCoalescing

Enable memory coalescing optimizations

public bool EnableMemoryCoalescing { get; set; }

Property Value

bool

EnableOperatorFusion

Enable operator fusion optimizations

public bool EnableOperatorFusion { get; set; }

Property Value

bool

EnableParallelExecution

Enable parallel execution

public bool EnableParallelExecution { get; set; }

Property Value

bool

EnableProfileGuidedOptimizations

Enable profile-guided optimizations

public bool EnableProfileGuidedOptimizations { get; set; }

Property Value

bool

EnableProfiling

Enable profiling support during compilation and execution

public bool EnableProfiling { get; set; }

Property Value

bool

EnableSharedMemoryRegisterSpilling

Enable shared memory register spilling for CUDA 13.0+ (Turing and newer) Helps reduce register pressure by spilling to shared memory instead of local memory

public bool EnableSharedMemoryRegisterSpilling { get; set; }

Property Value

bool

EnableTileBasedProgramming

Enable tile-based programming patterns for tensor cores (CUDA 13.0+)

public bool EnableTileBasedProgramming { get; set; }

Property Value

bool

EnableVectorization

Enable vectorization optimizations

public bool EnableVectorization { get; set; }

Property Value

bool

FastMath

Enable fast math optimizations (alias for compatibility)

public bool FastMath { get; set; }

Property Value

bool

FloatingPointMode

Floating point precision mode

public FloatingPointMode FloatingPointMode { get; set; }

Property Value

FloatingPointMode

ForceInterpretedMode

Force interpreted mode instead of compiled

public bool ForceInterpretedMode { get; set; }

Property Value

bool

FusedMultiplyAdd

Enable fused multiply-add operations

public bool FusedMultiplyAdd { get; set; }

Property Value

bool

GenerateDebugInfo

Generate debug information (alias for EnableDebugInfo)

public bool GenerateDebugInfo { get; set; }

Property Value

bool

GenerateLineInfo

Generate line information for debugging

public bool GenerateLineInfo { get; set; }

Property Value

bool

IncludePaths

Include paths for headers

public IList<string> IncludePaths { get; }

Property Value

IList<string>

MaxRegisters

Maximum register usage for GPU kernels

[Range(1, 255)]
public int? MaxRegisters { get; set; }

Property Value

int?

MaxRegistersPerThread

Maximum registers per thread for GPU kernel execution (CUDA-specific)

[Range(0, 255)]
public int MaxRegistersPerThread { get; set; }

Property Value

int

Remarks

Controls the maximum number of registers that each thread can use. Setting this to 0 allows the compiler to use any number of registers. Lower values can increase occupancy but may reduce performance. Typical values range from 32 to 255 registers per thread.

OptimizationLevel

Target optimization level

public OptimizationLevel OptimizationLevel { get; set; }

Property Value

OptimizationLevel

PreferredBlockSize

Preferred block dimensions for GPU kernel execution

[Range(1, 2147483647)]
public Dim3? PreferredBlockSize { get; set; }

Property Value

Dim3?

ProfileDataPath

Profile data path for PGO

public string? ProfileDataPath { get; set; }

Property Value

string

Release

Release-optimized compilation options

public static CompilationOptions Release { get; }

Property Value

CompilationOptions

RelocatableDeviceCode

Generate relocatable device code

public bool RelocatableDeviceCode { get; set; }

Property Value

bool

SharedMemoryLimit

Shared memory usage limit for GPU kernels (in bytes)

[Range(0, 2147483647)]
public int? SharedMemoryLimit { get; set; }

Property Value

int?

SharedMemorySize

Dynamic shared memory size allocation (in bytes)

[Range(0, 2147483647)]
public int? SharedMemorySize { get; set; }

Property Value

int?

StrictFloatingPoint

Enable strict floating point semantics

public bool StrictFloatingPoint { get; set; }

Property Value

bool

TargetArchitecture

Target architecture specific optimizations

public string? TargetArchitecture { get; set; }

Property Value

string

ThreadBlockSize

Thread block size hint

public int? ThreadBlockSize { get; set; }

Property Value

int?

TreatWarningsAsErrors

Enable warnings as errors

public bool TreatWarningsAsErrors { get; set; }

Property Value

bool

UnrollLoops

Enable loop unrolling optimizations

public bool UnrollLoops { get; set; }

Property Value

bool

UseFastMath

Use fast math optimizations (alias for EnableFastMath)

public bool UseFastMath { get; set; }

Property Value

bool

UseNativeMathLibrary

Enable native math library usage

public bool UseNativeMathLibrary { get; set; }

Property Value

bool

WarningLevel

Warning level (0-4)

[Range(0, 4)]
public int WarningLevel { get; set; }

Property Value

int

Methods

Clone()

Creates a copy of the compilation options

public CompilationOptions Clone()

Returns

CompilationOptions

ToString()

Converts to string.

public override string ToString()

Returns

string

A string that represents this instance.