summaryrefslogtreecommitdiffstats
path: root/js/src/intgemm/enable_intel_extensions.py
blob: 6259a1a1f76b94c4021f97fc2d378ae7fa867752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


def main(output, intgemm_config):
    with open(intgemm_config, "r") as f:
        config = f.read()

    # Enable intel AVX2 hardware extension specific code to allow using AVX2 at run time
    # if target cpu supports it
    config = config.replace(
        "#cmakedefine INTGEMM_COMPILER_SUPPORTS_AVX2",
        "#define INTGEMM_COMPILER_SUPPORTS_AVX2",
    )

    # Disable more advanced intel hardware extensions for now because base-toolchain compiler
    # versions aren't able to compile them
    config = config.replace("#cmakedefine", "#undef")

    output.write(config)
    output.close()

    return 0