llvm/mlir/lib/ExecutionEngine/ArmRunnerUtils.cpp

//===- ArmRunnerUtils.cpp - Utilities for configuring architecture properties //
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/MathExtras.h"
#include <iostream>
#include <stdint.h>
#include <string_view>

#if (defined(_WIN32) || defined(__CYGWIN__))
#define MLIR_ARMRUNNERUTILS_EXPORTED
#else
#define MLIR_ARMRUNNERUTILS_EXPORTED
#endif

#ifdef __linux__
#include <sys/prctl.h>
#endif

extern "C" {

// Defines for prctl() calls. These may not necessarily exist in the host
// <sys/prctl.h>, but will still be useable under emulation.
//
// https://www.kernel.org/doc/html/v5.3/arm64/sve.html#prctl-extensions
#ifndef PR_SVE_SET_VL
#define PR_SVE_SET_VL
#endif
// https://docs.kernel.org/arch/arm64/sme.html#prctl-extensions
#ifndef PR_SME_SET_VL
#define PR_SME_SET_VL
#endif
// Note: This mask is the same as both PR_SME_VL_LEN_MASK and
// PR_SVE_VL_LEN_MASK.
#define PR_VL_LEN_MASK

static void setArmVectorLength(std::string_view helper_name, int option,
                               uint32_t bits) {}

/// Sets the SVE vector length (in bits) to `bits`.
void MLIR_ARMRUNNERUTILS_EXPORTED setArmVLBits(uint32_t bits) {}

/// Sets the SME streaming vector length (in bits) to `bits`.
void MLIR_ARMRUNNERUTILS_EXPORTED setArmSVLBits(uint32_t bits) {}
}