xref: /llvm-project/mlir/include/mlir/Config/mlir-config.h.cmake (revision 9ddf3b835c4c0f1d73ace1e2af1e05ec4bce865d)
1//===- mlir-config.h - MLIR configuration ------------------------*- C -*-===*//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9/* This file enumerates variables from the MLIR configuration so that they
10   can be in exported headers and won't override package specific directives.
11   Defining the variables here is preferable over specifying them in CMake files
12   via `target_compile_definitions` because it is easier to ensure that they are
13   defined consistently across all targets: They are guaranteed to be 0/1
14   variables thanks to #cmakedefine01, so we can test with `#if` and find
15   missing definitions or includes with `-Wundef`. With `#ifdef`, these mistakes
16   can go unnoticed.
17
18   This is a C header that can be included in the mlir-c headers. */
19
20#ifndef MLIR_CONFIG_H
21#define MLIR_CONFIG_H
22
23/* Enable expensive checks to detect invalid pattern API usage. Failed checks
24   manifest as fatal errors or invalid memory accesses (e.g., accessing
25   deallocated memory) that cause a crash. Running with ASAN is recommended for
26   easier debugging. */
27#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS
28
29/* If set, greedy pattern application is randomized: ops on the worklist are
30   chosen at random. For testing/debugging purposes only. This feature can be
31   used to ensure that lowering pipelines work correctly regardless of the order
32   in which ops are processed by the GreedyPatternRewriteDriver. This flag is
33   numeric seed that is passed to the random number generator. */
34#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}
35
36/* If set, enables PDL usage. */
37#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH
38
39/* If set, enables features that depend on the NVIDIA's PTX compiler. */
40#cmakedefine01 MLIR_ENABLE_NVPTXCOMPILER
41
42/* If set, enables ROCm-related features in ROCM-related transforms, pipelines,
43   and targets. */
44#cmakedefine01 MLIR_ENABLE_ROCM_CONVERSIONS
45
46#endif
47