Skip to content

Commit

Permalink
Add all TVM configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
jroesch committed Apr 16, 2021
1 parent b3a8cc7 commit aff6717
Showing 1 changed file with 172 additions and 0 deletions.
172 changes: 172 additions & 0 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ pub enum Error {
},
}

/// Many TVM CMake settings are either OFF (disabled), ON (with auto detection) or
/// a path implying on with a fixed configuration.
///
/// This enumeration represents all cases in a more Rust friendly way.
#[derive(Debug)]
pub enum TVMCMakeSetting {
On,
Off,
Path(PathBuf),
}

#[derive(Debug)]
pub struct BuildConfig {
pub repository: Option<String>,
Expand All @@ -34,6 +45,117 @@ pub struct BuildConfig {
pub branch: Option<String>,
pub verbose: bool,
pub clean: bool,

// TVM Build Configuration Options
/// Build with the CUDA support enabled.
pub use_cuda: Option<TVMCMakeSetting>,
/// Build with the CUDA runtime enabled.
pub use_opencl: Option<TVMCMakeSetting>,
// Build with Vulkan runtime enabled.
pub use_vulkan: Option<TVMCMakeSetting>,
pub use_metal: Option<TVMCMakeSetting>,
pub use_rocm: Option<TVMCMakeSetting>,
/// The path to ROCM.
pub rocm_path: Option<PathBuf>,
/// Build with Hexagon device support in TVM runtime.
pub use_hexagon_device: Option<bool>,
/// Path to the Hexagon SDK root (required for Hexagon support in TVM runtime or for building TVM runtime for Hexagon.
pub use_heaxgon_dsk: Option<PathBuf>,
/// Whether to enable TVM RPC.
pub use_rpc: Option<bool>,
/// Build with threading support.
pub use_threads: Option<bool>,
/// Build with LLVM, can also be set to specific llvm-config path.
pub use_llvm: Option<TVMCMakeSetting>,
/// Enable TVM's stackvm in the runtime.
pub use_stackvm_runtime: Option<bool>,
/// Build with graph runtime, defaults to ON.
pub use_graph_runtime: Option<bool>,
/// Build with graph runtime debug mode, defaults to OFF.
pub use_graph_runtime_debug: Option<bool>,
/// Build with OpenMP thread pool implementation, defaults to OFF.
pub use_openmp: Option<bool>,
/// Build Relay in debug mode, defaults to OFF.
pub use_relay_debug: Option<bool>,
/// Build with RTTI, defaults to ON.
pub use_rtti: Option<bool>,
/// Build with multi-threaded MSCV runtime.
pub use_mscv_mt: Option<bool>,
/// Build with Micro TVM support.
pub use_micro: Option<bool>,
/// Install compiler infrastructure, defaults to OFF.
pub use_install_dev: Option<bool>,
/// Compile with -fvisibility=hidden.
pub hide_private_symbols: Option<bool>,
/// Use TVM's POD compatible Map, defaults to OFF.
pub use_fallback_stl_map: Option<bool>,
/// tvm_option(USE_ETHOSN "Build with Arm Ethos-N" OFF)
pub use_ethosn: Option<bool>,
/// Defaults the index datatype to int64.
pub use_index_default_i64: Option<bool>,
/// Build with TensorFlow TVMDSOOp.
pub use_tf_tvmdsoop: Option<bool>,

// Contrib library options.
/// Build with BYODT software emulated posit custom datatype.
pub use_byodt_posit: Option<bool>,
/// The blas library to be linked.
pub use_blas: Option<String>,
// tvm_option(USE_MKL "MKL root path when use MKL blas" OFF)
pub use_mkl: Option<TVMCMakeSetting>,
/// "Build with MKLDNN"
pub use_mkldnn: Option<TVMCMakeSetting>,
/// Enable MKLDNN (DNNL) codegen.
pub use_dnnl_codegen: Option<bool>,
// tvm_opt"Build with cuDNN" OFF)
pub use_cudnn: Option<bool>,
// tvm_option(USE_CUBLAS "Build with cuBLAS" OFF)
pub use_cublas: Option<bool>,
// tvm_option(USE_THRUST "Build with Thrust" OFF)
pub use_thrust: Option<bool>,
// tvm_option(USE_MIOPEN "Build with ROCM:MIOpen" OFF)
pub use_miopen: Option<bool>,
// tvm_option(USE_ROCBLAS "Build with ROCM:RoCBLAS" OFF)
pub use_rocblas: Option<bool>,
// tvm_option(USE_SORT "Build with sort support" ON)
pub use_sort: Option<bool>,
// tvm_option(USE_NNPACK "Build with nnpack support" OFF)
pub use_nnpack: Option<bool>,
// tvm_option(USE_RANDOM "Build with random support" ON)
pub use_random: Option<bool>,
// tvm_option(USE_MICRO_STANDALONE_RUNTIME "Build with micro.standalone_runtime support" OFF)
pub use_micro_standalone_runtime: Option<bool>,
// tvm_option(USE_CPP_RPC "Build CPP RPC" OFF)
pub use_cpp_rpc: Option<bool>,
// tvm_option(USE_TFLITE "Build with tflite support" OFF)
pub use_tflite: Option<bool>,
// tvm_option(USE_TENSORFLOW_PATH "TensorFlow root path when use TFLite" none)
pub use_tensorflow_path: Option<PathBuf>,
// tvm_option(USE_COREML "Build with coreml support" OFF)
pub use_coreml: Option<bool>,
// tvm_option(USE_TARGET_ONNX "Build with ONNX Codegen support" OFF)
pub use_target_onnx: Option<bool>,
// tvm_option(USE_ARM_COMPUTE_LIB "Build with Arm Compute Library" OFF)
pub use_arm_compute_lib: Option<bool>,
// tvm_option(USE_ARM_COMPUTE_LIB_GRAPH_RUNTIME "Build with Arm Compute Library graph runtime" OFF)
pub use_arm_compute_lib_graph_runtime: Option<TVMCMakeSetting>,
/// Build with TensorRT Codegen support, defaults to OFF>
pub use_tensorrt_codegen: Option<bool>,
/// Build with TensorRT runtime, defaults to OFF.
pub use_tensorrt_runtime: Option<TVMCMakeSetting>,
/// Build with Rust based compiler extensions, defaults to OFF.
pub use_rust_ext: Option<String>,
/// Build with VITIS-AI Codegen support, defaults to OFF.
pub use_vitis_ai: Option<bool>,
// Note(@jroesch): these options are supported by TVM but not exposed by this interface
// we instead use defaults.
//
// Configuration for 3rdparty libraries.
// tvm_option(DLPACK_PATH "Path to DLPACK" "3rdparty/dlpack/include")
// tvm_option(DMLC_PATH "Path to DMLC" "3rdparty/dmlc-core/include")
// tvm_option(RANG_PATH "Path to RANG" "3rdparty/rang/include")
// tvm_option(COMPILER_RT_PATH "Path to COMPILER-RT" "3rdparty/compiler-rt")
// tvm_option(PICOJSON_PATH "Path to PicoJSON" "3rdparty/picojson")
}

impl std::default::Default for BuildConfig {
Expand All @@ -45,6 +167,56 @@ impl std::default::Default for BuildConfig {
branch: None,
verbose: false,
clean: false,
use_cuda: None,
use_opencl: None,
use_vulkan: None,
use_metal: None,
use_rocm: None,
rocm_path: None,
use_hexagon_device: None,
use_heaxgon_dsk: None,
use_rpc: None,
use_threads: None,
use_llvm: None,
use_stackvm_runtime: None,
use_graph_runtime: None,
use_graph_runtime_debug: None,
use_openmp: None,
use_relay_debug: None,
use_rtti: None,
use_mscv_mt: None,
use_micro: None,
use_install_dev: None,
hide_private_symbols: None,
use_fallback_stl_map: None,
use_ethosn: None,
use_index_default_i64: None,
use_tf_tvmdsoop: None,
use_byodt_posit: None,
use_blas: None,
use_mkl: None,
use_mkldnn: None,
use_dnnl_codegen: None,
use_cudnn: None,
use_cublas: None,
use_thrust: None,
use_miopen: None,
use_rocblas: None,
use_sort: None,
use_nnpack: None,
use_random: None,
use_micro_standalone_runtime: None,
use_cpp_rpc: None,
use_tflite: None,
use_tensorflow_path: None,
use_coreml: None,
use_target_onnx: None,
use_arm_compute_lib: None,
use_arm_compute_lib_graph_runtime: None,
use_tensorrt_codegen: None,
use_tensorrt_runtime: None,
use_rust_ext: None,
use_vitis_ai: None,
}
}
}
Expand Down

0 comments on commit aff6717

Please sign in to comment.