mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-22 01:18:54 +03:00
Compare commits
184 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
adc4673a20 | ||
![]() |
7cdab7abc2 | ||
![]() |
d704e92c97 | ||
![]() |
867e4728d5 | ||
![]() |
646d746e02 | ||
![]() |
df5a96d935 | ||
![]() |
9c0747a5f7 | ||
![]() |
fee20e54d9 | ||
![]() |
7399132d5d | ||
![]() |
ecd61a8e2a | ||
![]() |
de870db1f1 | ||
![]() |
7ac67a89e9 | ||
![]() |
7a6df9dcbf | ||
![]() |
870fed4bb6 | ||
![]() |
970ba5aa25 | ||
![]() |
b4cb3ade63 | ||
![]() |
3870a96592 | ||
![]() |
1a63ef62b7 | ||
![]() |
7b2ecdd725 | ||
![]() |
c92abba2bb | ||
![]() |
46def3e7e0 | ||
![]() |
193eb29be8 | ||
![]() |
872054ae40 | ||
![]() |
90a1f77891 | ||
![]() |
164c172236 | ||
![]() |
2753d956df | ||
![]() |
c869a0d611 | ||
![]() |
9923a36b76 | ||
![]() |
89bc40618b | ||
![]() |
07aa1103aa | ||
![]() |
6f76c8b34c | ||
![]() |
2e56871643 | ||
![]() |
869efbe0e2 | ||
![]() |
9390db962b | ||
![]() |
bdcef897cc | ||
![]() |
971951bc9e | ||
![]() |
0ca14d740f | ||
![]() |
7ba1586d6c | ||
![]() |
04dbafaf4a | ||
![]() |
50e793e869 | ||
![]() |
dd915688bd | ||
![]() |
2c6d7ffb7a | ||
![]() |
26bf0eeaf2 | ||
![]() |
400feaf015 | ||
![]() |
fd1c13560f | ||
![]() |
3558a0a65c | ||
![]() |
0104814ac3 | ||
![]() |
a125b0746f | ||
![]() |
2cb5960a18 | ||
![]() |
24e100cb9c | ||
![]() |
e459086c5b | ||
![]() |
dd7ced8b37 | ||
![]() |
816365e7df | ||
![]() |
0172dc58e5 | ||
![]() |
b763415006 | ||
![]() |
c23be576e8 | ||
![]() |
370c0bd09e | ||
![]() |
9609f86033 | ||
![]() |
afe9120868 | ||
![]() |
04a411fe22 | ||
![]() |
ccf3c02ac1 | ||
![]() |
3de01b3f8b | ||
![]() |
d5a4b068dd | ||
![]() |
6ef19d6501 | ||
![]() |
5b2352723f | ||
![]() |
c37223fe67 | ||
![]() |
62ce1fd3a9 | ||
![]() |
04394dbb04 | ||
![]() |
314e3dcb49 | ||
![]() |
ca0d8ec666 | ||
![]() |
467782b1d0 | ||
![]() |
2cd0fcb650 | ||
![]() |
986fa49097 | ||
![]() |
dbb6f09ffa | ||
![]() |
e248a2c9a9 | ||
![]() |
2f951fa04c | ||
![]() |
5290190727 | ||
![]() |
ab67cd46fc | ||
![]() |
da9cf4d583 | ||
![]() |
a27d1e119f | ||
![]() |
e2fbdf7d7b | ||
![]() |
18245be7d5 | ||
![]() |
82510ce8fd | ||
![]() |
a71cd44104 | ||
![]() |
a63f004540 | ||
![]() |
5ec18f14a1 | ||
![]() |
4ae7feb93a | ||
![]() |
9631a8d242 | ||
![]() |
e2432d0df1 | ||
![]() |
043172bd9b | ||
![]() |
5969e59aae | ||
![]() |
4b4ba90219 | ||
![]() |
44decaf396 | ||
![]() |
407664600a | ||
![]() |
3ce6aee65d | ||
![]() |
3070d983ab | ||
![]() |
fefdd528d5 | ||
![]() |
20c9aa4f02 | ||
![]() |
8d79c5d0f8 | ||
![]() |
a610136e17 | ||
![]() |
479014a783 | ||
![]() |
5bfc2a56b9 | ||
![]() |
becda31524 | ||
![]() |
638786b0ec | ||
![]() |
b4de21fbc5 | ||
![]() |
4a71fefb8a | ||
![]() |
8f68287b18 | ||
![]() |
9d4f26bd07 | ||
![]() |
3d2024bf62 | ||
![]() |
58fb8a234c | ||
![]() |
2c6bee4955 | ||
![]() |
1897d33916 | ||
![]() |
5b593ec185 | ||
![]() |
ce25035051 | ||
![]() |
ecc33f7b10 | ||
![]() |
d76ffd691c | ||
![]() |
b460e359ae | ||
![]() |
ad2059872a | ||
![]() |
e328ecc550 | ||
![]() |
7d4fbedfcf | ||
![]() |
b2a455e12e | ||
![]() |
196242b410 | ||
![]() |
55fbe1abb5 | ||
![]() |
e89b0c5d9c | ||
![]() |
d7d38256e0 | ||
![]() |
b2765370e5 | ||
![]() |
015d23b5ad | ||
![]() |
1c0deca9e4 | ||
![]() |
23306e944b | ||
![]() |
23874efe68 | ||
![]() |
8ef6c3d8b6 | ||
![]() |
2e8716bf0d | ||
![]() |
9a568e2969 | ||
![]() |
e018de83ae | ||
![]() |
951c7558cc | ||
![]() |
2198862e76 | ||
![]() |
f0771e1fb6 | ||
![]() |
994cfb3386 | ||
![]() |
9ad88ac982 | ||
![]() |
e940b9400f | ||
![]() |
491e71e346 | ||
![]() |
83ba70bf37 | ||
![]() |
90960fd923 | ||
![]() |
f70abd065b | ||
![]() |
2e6f7e3fdc | ||
![]() |
3d9a79c41e | ||
![]() |
4091f658b2 | ||
![]() |
8d74c16c86 | ||
![]() |
2fc7af0434 | ||
![]() |
e40785aa74 | ||
![]() |
58a7fe53c6 | ||
![]() |
b3c73689a8 | ||
![]() |
89e72e4e95 | ||
![]() |
dca4c5bd21 | ||
![]() |
82b5cef0bd | ||
![]() |
425edfcdd4 | ||
![]() |
7f051ad20e | ||
![]() |
9d92a6e284 | ||
![]() |
d51aaaf552 | ||
![]() |
a55c851eaa | ||
![]() |
8cd3db6648 | ||
![]() |
4d04fe251d | ||
![]() |
a0baad9456 | ||
![]() |
a005c92c61 | ||
![]() |
fedf88180a | ||
![]() |
96f95d59ce | ||
![]() |
a39dda67d1 | ||
![]() |
8393dbd6e9 | ||
![]() |
9dcfb45aa2 | ||
![]() |
94af72f46b | ||
![]() |
15f465041d | ||
![]() |
17291019e3 | ||
![]() |
efd91e270c | ||
![]() |
cdac38d572 | ||
![]() |
648035a01a | ||
![]() |
178ec59af6 | ||
![]() |
d3cd2dc8b4 | ||
![]() |
eec55d9d02 | ||
![]() |
06a5cff2d8 | ||
![]() |
088ff760de | ||
![]() |
ba83bb28f7 | ||
![]() |
b7ee6d66c3 | ||
![]() |
871b8d1bef | ||
![]() |
bfae2e0d21 |
@ -1,8 +1,2 @@
|
||||
[target."x86_64-unknown-linux-gnu"]
|
||||
rustflags = ["-C", "target-cpu=x86-64-v2"]
|
||||
|
||||
[target."x86_64-pc-windows-msvc"]
|
||||
rustflags = ["-C", "target-cpu=x86-64-v2"]
|
||||
|
||||
[alias]
|
||||
xtask = "run --package xtask --"
|
@ -1,6 +1,52 @@
|
||||
# syntax = devthefuture/dockerfile-x
|
||||
FROM nvidia/cuda:12.4.1-base-ubuntu22.04
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
python3 \
|
||||
ripgrep \
|
||||
git \
|
||||
ltrace \
|
||||
# required by llvm 17
|
||||
lsb-release software-properties-common gnupg
|
||||
|
||||
ARG LLVM_VERSION=17
|
||||
RUN wget https://apt.llvm.org/llvm.sh && \
|
||||
chmod +x llvm.sh && \
|
||||
./llvm.sh ${LLVM_VERSION}
|
||||
|
||||
# Feel free to change to a newer version if you have a newer verison on your host
|
||||
ARG CUDA_PKG_VERSION=12-4
|
||||
# Docker <-> host driver version compatiblity is newer host <-> older docker
|
||||
# We don't care about a specific driver version, so pick oldest 5XX
|
||||
ARG CUDA_DRIVER=515
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
# CUDA headers need it for interop
|
||||
libgl-dev libegl-dev libvdpau-dev \
|
||||
nvidia-utils-${CUDA_DRIVER} \
|
||||
cuda-cudart-dev-${CUDA_PKG_VERSION} \
|
||||
cuda-nvml-dev-${CUDA_PKG_VERSION} \
|
||||
cuda-cudart-${CUDA_PKG_VERSION} \
|
||||
cuda-profiler-api-${CUDA_PKG_VERSION} \
|
||||
cuda-nvcc-${CUDA_PKG_VERSION}
|
||||
|
||||
ARG ROCM_VERSION=6.3.1
|
||||
RUN mkdir --parents --mode=0755 /etc/apt/keyrings && \
|
||||
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
|
||||
gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null && \
|
||||
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${ROCM_VERSION} jammy main" > /etc/apt/sources.list.d/rocm.list && \
|
||||
echo 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' > /etc/apt/preferences.d/rocm-pin-600 && \
|
||||
DEBIAN_FRONTEND=noninteractive apt update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
rocminfo \
|
||||
rocm-gdb \
|
||||
rocm-smi-lib \
|
||||
rocm-llvm-dev \
|
||||
hip-runtime-amd \
|
||||
hip-dev && \
|
||||
echo '/opt/rocm/lib' > /etc/ld.so.conf.d/rocm.conf && \
|
||||
ldconfig
|
||||
|
||||
ENV PATH=$PATH:/opt/rocm-${ROCM_VERSION}/bin
|
||||
|
||||
# This duplicate FROM is here purely to make dev containers happy,
|
||||
# Otherwise it tries to parse the file (whyyy???) and chokes on custom syntax
|
||||
FROM ubuntu:22.04
|
||||
INCLUDE ./Dockerfile-common
|
@ -1,64 +0,0 @@
|
||||
WORKDIR /root
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
nano \
|
||||
wget \
|
||||
curl \
|
||||
gnupg \
|
||||
ripgrep \
|
||||
ltrace \
|
||||
file\
|
||||
python3-minimal \
|
||||
build-essential \
|
||||
git \
|
||||
cmake \
|
||||
ninja-build
|
||||
ENV PATH="${PATH}:/opt/rocm/bin:/opt/rocm/llvm/bin:/usr/local/cuda/bin/"
|
||||
|
||||
|
||||
ARG CUDA_VERSION=11-8
|
||||
ENV NVIDIA_VISIBLE_DEVICES all
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb && \
|
||||
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
||||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
nvidia-headless-no-dkms-515 \
|
||||
nvidia-utils-515 \
|
||||
cuda-cudart-${CUDA_VERSION} \
|
||||
cuda-compiler-${CUDA_VERSION} \
|
||||
libcufft-dev-${CUDA_VERSION} \
|
||||
libcusparse-dev-${CUDA_VERSION} \
|
||||
libcublas-dev-${CUDA_VERSION} \
|
||||
cuda-nvml-dev-${CUDA_VERSION} \
|
||||
libcudnn8-dev
|
||||
|
||||
ARG RUST_VERSION=1.66.1
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
|
||||
RUN . $HOME/.cargo/env && cargo install bindgen-cli --locked
|
||||
|
||||
ARG ROCM_VERSION=5.7.3
|
||||
RUN echo "Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600" > /etc/apt/preferences.d/rocm-pin-600
|
||||
RUN mkdir --parents --mode=0755 /etc/apt/keyrings && \
|
||||
sh -c 'wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null' && \
|
||||
sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${ROCM_VERSION} jammy main > /etc/apt/sources.list.d/rocm.list' && \
|
||||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
rocminfo \
|
||||
rocm-gdb \
|
||||
rocprofiler \
|
||||
rocm-smi-lib \
|
||||
hip-runtime-amd \
|
||||
comgr \
|
||||
hipblaslt-dev \
|
||||
hipfft-dev \
|
||||
rocblas-dev \
|
||||
rocsolver-dev \
|
||||
rocsparse-dev \
|
||||
miopen-hip-dev \
|
||||
rocm-device-libs && \
|
||||
echo 'export PATH="$PATH:/opt/rocm/bin"' > /etc/profile.d/rocm.sh && \
|
||||
echo '/opt/rocm/lib' > /etc/ld.so.conf.d/rocm.conf && \
|
||||
ldconfig
|
||||
|
||||
# Default to a login shell
|
||||
CMD ["bash", "-l"]
|
@ -1,72 +0,0 @@
|
||||
FROM rockylinux:8.8
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
RUN dnf -y --setopt=install_weak_deps=False install \
|
||||
nano \
|
||||
wget \
|
||||
curl \
|
||||
ltrace \
|
||||
file \
|
||||
python3 \
|
||||
git \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
cmake
|
||||
|
||||
RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
|
||||
rpm -ivh epel-release-latest-8.noarch.rpm && \
|
||||
dnf -y --setopt=install_weak_deps=False install 'dnf-command(config-manager)' && \
|
||||
crb enable && \
|
||||
dnf -y --setopt=install_weak_deps=False install \
|
||||
ripgrep \
|
||||
ninja-build
|
||||
|
||||
ARG CUDA_VERSION=11-8
|
||||
ENV NVIDIA_VISIBLE_DEVICES all
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||
RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && \
|
||||
dnf -y --setopt=install_weak_deps=False module install \
|
||||
nvidia-driver:515 && \
|
||||
dnf -y --setopt=install_weak_deps=False install \
|
||||
cuda-cudart-${CUDA_VERSION} \
|
||||
cuda-compiler-${CUDA_VERSION} \
|
||||
libcufft-devel-${CUDA_VERSION} \
|
||||
libcusparse-devel-${CUDA_VERSION} \
|
||||
libcublas-devel-${CUDA_VERSION} \
|
||||
cuda-nvml-devel-${CUDA_VERSION} \
|
||||
libcudnn8-devel
|
||||
|
||||
ARG RUST_VERSION=1.66.1
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
|
||||
RUN . $HOME/.cargo/env && cargo install bindgen-cli --locked
|
||||
|
||||
ARG ROCM_VERSION=5.7.1
|
||||
RUN sh -c 'echo -e "[ROCm-${ROCM_VERSION}]\n\
|
||||
name=ROCm${ROCM_VERSION}\n\
|
||||
baseurl=https://repo.radeon.com/rocm/rhel8/${ROCM_VERSION}/main\n\
|
||||
enabled=1\n\
|
||||
priority=50\n\
|
||||
gpgcheck=1\n\
|
||||
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key"' \
|
||||
> /etc/yum.repos.d/rocm.repo && \
|
||||
dnf -y --setopt=install_weak_deps=False install \
|
||||
rocminfo \
|
||||
rocm-gdb \
|
||||
rocprofiler \
|
||||
rocm-smi-lib \
|
||||
hip-runtime-amd \
|
||||
comgr \
|
||||
hipblaslt-devel \
|
||||
hipfft-devel \
|
||||
rocblas-devel \
|
||||
rocsolver-devel \
|
||||
rocsparse-devel \
|
||||
miopen-hip-devel \
|
||||
rocm-device-libs && \
|
||||
echo 'export PATH="$PATH:/opt/rocm/bin"' > /etc/profile.d/rocm.sh && \
|
||||
echo '/opt/rocm/lib' > /etc/ld.so.conf.d/rocm.conf && \
|
||||
ldconfig
|
||||
|
||||
# Default to a login shell
|
||||
CMD ["bash", "-l"]
|
@ -1,16 +0,0 @@
|
||||
# syntax = devthefuture/dockerfile-x
|
||||
FROM ubuntu:22.04
|
||||
INCLUDE ./Dockerfile-common
|
||||
|
||||
ARG XGBOOST_VERSION=2.0.3
|
||||
RUN git clone --branch "v${XGBOOST_VERSION}" --recurse-submodules https://github.com/dmlc/xgboost.git && \
|
||||
cd xgboost && \
|
||||
# Broken test, segfaults on normal CUDA
|
||||
sed -i 's/TEST(Allocator, OOM) {/TEST(Allocator, OOM) { GTEST_SKIP();/g' tests/cpp/common/test_device_helpers.cu && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake .. -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DUSE_CUDA=ON -GNinja && \
|
||||
ninja
|
||||
|
||||
#
|
||||
|
@ -1,39 +1,34 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
|
||||
{
|
||||
"name": "ZLUDA",
|
||||
"name": "zluda",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"securityOpt": [
|
||||
"seccomp=unconfined"
|
||||
],
|
||||
// Make NVIDIA and AMD GPUs available
|
||||
"securityOpt": [ "seccomp=unconfined" ],
|
||||
"runArgs": [
|
||||
// Uncomment on newer docker/podman
|
||||
//"--runtime=nvidia",
|
||||
"--runtime=nvidia",
|
||||
"--device=/dev/kfd",
|
||||
"--device=/dev/dri",
|
||||
"--group-add=video"
|
||||
],
|
||||
// Cache cargo packages and compiled ZLUDA kernels
|
||||
"initializeCommand": "mkdir -p ${localEnv:HOME}/.cargo/git ${localEnv:HOME}/.cargo/registry ${localEnv:HOME}/.cache/ZLUDA",
|
||||
"mounts": [
|
||||
{
|
||||
"source": "${localEnv:HOME}/.cargo/git",
|
||||
"target": "/root/.cargo/git",
|
||||
"type": "bind"
|
||||
},
|
||||
{
|
||||
"source": "${localEnv:HOME}/.cargo/registry",
|
||||
"target": "/root/.cargo/registry",
|
||||
"type": "bind"
|
||||
},
|
||||
{
|
||||
"source": "${localEnv:HOME}/.cache/ZLUDA",
|
||||
"target": "/root/.cache/ZLUDA",
|
||||
"source": "${localEnv:HOME}/.cargo/",
|
||||
"target": "/root/.cargo",
|
||||
"type": "bind"
|
||||
}
|
||||
],
|
||||
// Rootless docker requires logging as root: https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "root"
|
||||
// https://containers.dev/features.
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/rust:1": {}
|
||||
},
|
||||
// https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "root",
|
||||
//"hostRequirements": { "gpu": "optional" }
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [ "mhutchie.git-graph" ]
|
||||
}
|
||||
}
|
||||
}
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,3 +1 @@
|
||||
ext/** linguist-vendored
|
||||
atiadlxx-sys/include/* linguist-vendored
|
||||
*.ptx linguist-language=Assembly
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,5 +1,5 @@
|
||||
[submodule "ext/llvm-project"]
|
||||
path = ext/llvm-project
|
||||
url = https://github.com/llvm/llvm-project.git
|
||||
branch = release/15.x
|
||||
url = https://github.com/llvm/llvm-project
|
||||
branch = release/17.x
|
||||
shallow = true
|
||||
|
197
ARCHITECTURE.md
197
ARCHITECTURE.md
@ -1,197 +0,0 @@
|
||||
# Architecture of ZLUDA
|
||||
|
||||
## Introduction
|
||||
|
||||
ZLUDA is a binary-compatible implementation of CUDA for AMD GPUs. An application built with CUDA compiler for NVIDIA GPU can be executed with near-native performance with ZLUDA on AMD GPUs without recompilation or any modifications to the application.
|
||||
The principle behind ZLUDA is similar to that of WINE or WSL: to provide a highly-compatible execution environment with a near-native performance.
|
||||
The design of the code follows directly from execution requirements of CUDA applications. Accordingly, this document is is split into five parts:
|
||||
* Introduction
|
||||
* CUDA runtime, which describes how CPU code, which controls NVIDIA GPUs is translated to control AMD GPUs
|
||||
* CUDA GPU code compiler, which describes how NVIDIA GPU code is compiled for AMD GPUs
|
||||
* Other projects, which describes miscellaneous ZLUDA tools for configuration and debugging
|
||||
* Diagrams, which show general dependencies between code projects and typical flow of ZLUDA-enabled application
|
||||
|
||||
This document will avoid referring to specific files, structures or functions. The project is still in flux and those details are bound to change soon. High-level design, on the other hand will stay the same.
|
||||
|
||||
### Top-level design assumptions
|
||||
If you are reading the code or even the rest of this document, you should be aware of assumptions made when developing the project:
|
||||
* ZLUDA itself is written in Rust
|
||||
C or C++ source dependencies are fine if they are are impossible to avoid (LLVM). GPU code in HIP/OpenCL C is fine - Rust support for writing GPU code is pitiful
|
||||
* ZLUDA is focused on end users
|
||||
By user we mean someone who uses a CUDA program, e.g. a 3D artist using Blender. Developer developing a CUDA application is not an. While we would like to support developers in the future, right now the time constraints do not allow it
|
||||
* Building the project should require just `cargo build` (if possible)
|
||||
That means that we avoid relying on `cargo` subcommands, `bindgen` or user setting up environment variables certain way to build the project. We can't avoid depending on some tools (cmake, Python), but that's because of C++ dependencies (LLVM)
|
||||
|
||||
## CUDA runtime
|
||||
|
||||
### Structure of a CUDA application
|
||||
This is a CUDA "Hello World" application:
|
||||
```
|
||||
__global__ void cuda_hello(){
|
||||
printf("Hello World from GPU!\n");
|
||||
}
|
||||
|
||||
int main() {
|
||||
cuda_hello<<<1,1>>>();
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Anyone familiar with C++ will instantly understand that compiling it is a complicated affair. CUDA does add special syntax for GPUs support: address spaces (`__global__` in the example above), kernel calling (`<<...>>` int the example above). Additionally CUDA allows, to a large degree, mixing CPU code and GPU code. What does all this complexity mean for ZLUDA?
|
||||
|
||||
Absolutely nothing
|
||||
|
||||
Turns out, CUDA compiler transforms CUDA source code into a normal application with calls to CUDA Driver API. The "Hello World" application gets transformed into something not too far from this:
|
||||
```
|
||||
char* cuda_hello_ptx = "...";
|
||||
|
||||
int main() {
|
||||
cuInit();
|
||||
CUmodule module = NULL;
|
||||
cuModuleLoad(&module, cuda_hello_ptx);
|
||||
CUfunction func = NULL;
|
||||
cuModuleGetFunction(&func, module, "cuda_hello");
|
||||
cuLaunchKernel(func, 1,1,1 1,1,1, NULL, NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
All functions starting with `cu` are CUDA Driver API calls to functions in a shared library `nvcuda.dll` or `libcuda.so`. ZLUDA simply provides an alternative `nvcuda.dll` or `libcuda.so` with the same functions, which accept the same arguments. The difference is that an NVIDIA-provided library works with NVIDIA GPUs, a ZLUDA-provided library works with AMD GPUs.
|
||||
|
||||
This is a fairly simplified view. In reality, there is more than one CUDA API. Next section explains how to all of them relate to each other and how they are implemented by ZLUDA.
|
||||
|
||||
### Three CUDA APIs
|
||||
|
||||
More experienced CUDA programmers understand that there are two CUDA APIs. Driver API and Runtime API:
|
||||
|
||||
| | Driver API | Runtime API |
|
||||
|---|---|---|
|
||||
| __Function prefix__ | `cu` | `cuda` |
|
||||
| __Dependencies__ | Kernel-mode driver | Driver API |
|
||||
| __Dynamic (runtime) linking__ | ✅ | ✅ |
|
||||
| __Static linking__ | ❌| ✅ |
|
||||
|
||||
Driver API is the lowest-level user-mode API. Runtime API builds on top of Driver API and provides miscellaneous high-level features. Since an application can dynamically link to either Driver API or Runtime API, it would seem that ZLUDA needs to provide both. In reality very few applications dynamically link to Runtime API. For the vast majority of applications it's sufficient to provide Driver API for dynamic (runtime) linking.
|
||||
|
||||
Driver API implementation is relatively straightforward: for each function ZLUDA calls a similarly called HIP runtime function. HIP is highly compatible with CUDA. For example, `cuDeviceGetAttribute(...)` is implemented by remapping some of the arguments to HIP versions and calling `hipDeviceGetAttribute(...)`. There's one exception: functions for compiling GPU code: `cuModuleLoadData(...)`, `cuModuleLoadDataEx(...)`. It's covered in the section [CUDA GPU code compiler](#cuda-gpu-code-compiler).
|
||||
|
||||
In addition to Driver API, Runtime API relies on CUDA Dark API. CUDA Driver API exposes function `cuGetExportTable(...)`. This function accepts a GUID and returns a table of function pointers. Those pointer point to undocumented functions forming CUDA Dark API. It's impossible to tell how many of them exist, but debugging experience suggests there are tens of function pointers across tens of tables. A typical application will use one or two most common. Due to they undocumented nature they are exclusively used by Runtime API and NVIDIA libraries (and in by CUDA applications in turn). We don't have names of those functions nor names or types of the arguments. This makes implementing them time-consuming. Dark API functions are are reverse-engineered and implemented by ZLUDA on case-by-case basis once we observe an application making use of it.
|
||||
|
||||
In addition, CUDA applications rely on various NVIDIA-provided libraries: NVML, cuBLAS, cuSPARSE. They are implemented by ZLUDA similarly - by providing a library with the same name and with the same functions, which call to native AMD libraries.
|
||||
|
||||
## CUDA GPU code compiler
|
||||
|
||||
A CUDA application ships with GPU code. This code can be either compiled into PTX or into SASS. The difference is that PTX is a textual assembly not specific to a particular NVIDIA GPU architecture (it is still specific to NVIDIA GPU hardware capabilities) while SASS is a binary asssembly specific to a given a particular NVIDIA GPU architecture. PTX is documented here: [https://docs.nvidia.com/cuda/parallel-thread-execution/index.html](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html). SASS is undocumented.
|
||||
Majority of applications ship their GPU code in PTX. PTX is forward compatible with future GPU architectures. For all those reasons, currently, our compiler only supports PTX.
|
||||
The compiler accepts PTX and outputs AMD GPU binary code. It is structured into a sequence of passes. Output of each pass is the input to the next one. Following sections contain description of the current compilation passes.
|
||||
|
||||
Compiler code is end-to-end tested. For every new feature or a bug fix we add a tiny PTX program that makes use of this feature. Firstly it's compiled and the output is compared to the reference LLVM IR. Next it's run and the result is compared to a saved reference result and a result of the same program running on NVIDIA CUDA.
|
||||
|
||||
|
||||
## Other projects
|
||||
|
||||
Additionally, ZLUDA ships with more projects which serve some platform-specific purpose or are used for debugging.
|
||||
|
||||
### ZLUDA injector (Windows-only)
|
||||
This is a Windows executable which starts injects process with ZLUDA redirector and a chosen CUDA Runtime API, typically either ZLUDA or ZLUDA dumper. This is a ZLUDA-specific replacement for `LD_PRELOAD`.
|
||||
|
||||
### ZLUDA redirector (Windows-only)
|
||||
This is an injector helper library. It intercepts calls to WinAPI `LoadLibrary...(...)` function calls, detecting attempts to load NVIDIA CUDA library and instead forcing load of the CUDA Runtime API chosen by the injector. Furthermore it intercepts calls to WinAPI `CreateProcess..(...)` function calls to inject itself and the chosen CUDA Runtime API into child processes.
|
||||
|
||||
### ZLUDA dumper
|
||||
This is a CUDA Runtime API implementation for diagnostics and debugging. The library does not have CUDA implementation per-se, but rather for each CUDA Runtime API function call, it intercepts the call, does some kind of pre-processing, routes the call to a real implementation (either ZLUDA or CUDA) and does post-processing. Currently, its main features are:
|
||||
* Tracing CUDA application execution. A trace is a log of all CUDA function calls (with parameters and files with all the kernels used by the application
|
||||
* Single kernel dump (in progress). This allows us to dump to disk a single `cuLaunchKernel(...)` with all the parameters (both memory and scalar). Then this kernel can be debugged without running whole application again
|
||||
* Side-by-side execution (in progress). This allows to run application normally and for every call to `cuLaunchKernel(...)` also do the same call with another CUDA implementation. The differences in their outputs are then logged
|
||||
|
||||
|
||||
|
||||
## Diagrams
|
||||
|
||||
### Block diagram of the project
|
||||
External dependencies are in rounded boxes
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
subgraph c["ZLUDA debug startup on Windows"];
|
||||
ZLUDA_INJECT2[ZLUDA injector]-->ZLUDA_REDIRECT2[ZLUDA redirector];
|
||||
ZLUDA_INJECT2-->ZLUDA_R3[ZLUDA dumper];
|
||||
ZLUDA_REDIRECT2-->ZLUDA_R3;
|
||||
ZLUDA_R3-->NV[NVIDIA CUDA Runtime]
|
||||
end;
|
||||
subgraph b[ZLUDA startup on Windows];
|
||||
ZLUDA_INJECT[ZLUDA injector]-->ZLUDA_REDIRECT[ZLUDA redirector];
|
||||
ZLUDA_INJECT-->ZLUDA_RT2[ZLUDA Runtime];
|
||||
ZLUDA_REDIRECT-->ZLUDA_RT2;
|
||||
end;
|
||||
subgraph a[" "];
|
||||
ZLUDA_RT[ZLUDA Runtime]-->HIP([HIP Runtime]);
|
||||
ZLUDA_RT-->ZLUDA_CMP[ZLUDA PTX Compiler];
|
||||
ZLUDA_CMP--generate LLVM bitcode-->LLVM([LLVM]);
|
||||
ZLUDA_CMP--compile LLVM bitcode to AMD GPU binary-->Lightning([Lightning Compiler]);
|
||||
end;
|
||||
```
|
||||
|
||||
### Flow of a typical ZLUDA-enabled application
|
||||
Some details omitted and certain interactions simplified
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
Application->>CUDA Runtime: cudaMemcpy(...)
|
||||
Note over Application, CUDA Runtime: First call, can be some other function
|
||||
activate CUDA Runtime
|
||||
CUDA Runtime->>ZLUDA: cuInit(...)
|
||||
activate ZLUDA
|
||||
ZLUDA->>HIP: hipInit(...)
|
||||
activate HIP
|
||||
HIP-->>ZLUDA: hipSuccess
|
||||
deactivate HIP
|
||||
ZLUDA-->>CUDA Runtime: CUDA_SUCCESS
|
||||
deactivate ZLUDA
|
||||
CUDA Runtime->>ZLUDA: cuDeviceGetCount(...)
|
||||
activate ZLUDA
|
||||
ZLUDA->>HIP: hipDeviceGetCount(...)
|
||||
activate HIP
|
||||
HIP-->>ZLUDA: hipSuccess
|
||||
deactivate HIP
|
||||
ZLUDA-->>CUDA Runtime: CUDA_SUCCESS
|
||||
deactivate ZLUDA
|
||||
Note over CUDA Runtime, HIP: More calls to CUDA Device API omitted
|
||||
rect rgb(200, 150, 255)
|
||||
Note over CUDA Runtime, ZLUDA: Dark API region
|
||||
CUDA Runtime->>ZLUDA: cuGetExportTable({6BD5FB6C-5BF4-E74A-8987-D93912FD9DF9})
|
||||
activate ZLUDA
|
||||
ZLUDA-->>CUDA Runtime: 0x1776e710
|
||||
deactivate ZLUDA
|
||||
Note right of CUDA Runtime: 0x1776e710 is the address of CUDA Dark API function table {6BD5FB6C-5BF4-E74A-8987-D93912FD9DF9}
|
||||
CUDA Runtime->>ZLUDA: (0x1776e710+0x30)(0x1499e2000)
|
||||
activate ZLUDA
|
||||
Note right of CUDA Runtime: Calling function at index 6 from table at 0x1776e710
|
||||
Note left of ZLUDA: ZLUDA recognizes this function as a private variant of cuModuleLoadData
|
||||
ZLUDA->>ZLUDA: Parse and compile PTX to AMD GPU binary
|
||||
ZLUDA-->>CUDA Runtime: 0x2982da70
|
||||
Note right of CUDA Runtime: We return newly created module handle 0x2982da70
|
||||
deactivate ZLUDA
|
||||
end
|
||||
Note over CUDA Runtime, HIP: More calls to CUDA Device API omitted
|
||||
CUDA Runtime->>ZLUDA: cuModuleGetFunction(module: 0x2982da70, ...)
|
||||
activate ZLUDA
|
||||
ZLUDA->>HIP: hipModuleGetFunction(...)
|
||||
activate HIP
|
||||
HIP-->>ZLUDA: hipSuccess
|
||||
deactivate HIP
|
||||
ZLUDA-->>CUDA Runtime: CUDA_SUCCESS
|
||||
deactivate ZLUDA
|
||||
Note over CUDA Runtime, HIP: More calls to CUDA Device API omitted
|
||||
CUDA Runtime-->>Application: cudaSuccess
|
||||
deactivate CUDA Runtime
|
||||
Application->>CUDA Runtime: cuLaunchKernel(...)
|
||||
activate CUDA Runtime
|
||||
CUDA Runtime->>ZLUDA: cuLaunchKernel(...)
|
||||
activate ZLUDA
|
||||
ZLUDA->>HIP: hipLaunchKernel(...)
|
||||
activate HIP
|
||||
HIP-->>ZLUDA: hipSuccess
|
||||
deactivate HIP
|
||||
ZLUDA-->>CUDA Runtime: CUDA_SUCCESS
|
||||
deactivate ZLUDA
|
||||
CUDA Runtime->>Application: cudaSuccess
|
||||
deactivate CUDA Runtime
|
||||
```
|
1395
Cargo.lock
generated
Normal file
1395
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
60
Cargo.toml
60
Cargo.toml
@ -1,61 +1,33 @@
|
||||
[workspace]
|
||||
|
||||
# Remember to also update the project's Cargo.toml
|
||||
# if it's a top-level project
|
||||
resolver = "2"
|
||||
|
||||
members = [
|
||||
"atiadlxx-sys",
|
||||
"ext/hip_runtime-sys",
|
||||
"ext/amd_comgr-sys",
|
||||
"comgr",
|
||||
"cuda_base",
|
||||
"cuda_types",
|
||||
"detours-sys",
|
||||
"ext/llvm-sys.rs",
|
||||
"hip_common",
|
||||
"hip_runtime-sys",
|
||||
"hipblaslt-sys",
|
||||
"hipfft-sys",
|
||||
"hiprt-sys",
|
||||
"miopen-sys",
|
||||
"offline_compiler",
|
||||
"optix_base",
|
||||
"optix_dump",
|
||||
"process_address_table",
|
||||
"ptx",
|
||||
"rocblas-sys",
|
||||
"rocm_smi-sys",
|
||||
"rocsparse-sys",
|
||||
"xtask",
|
||||
"zluda",
|
||||
"zluda_api",
|
||||
"zluda_blas",
|
||||
"zluda_blaslt",
|
||||
"zluda_ccl",
|
||||
"zluda_dark_api",
|
||||
"zluda_dnn",
|
||||
"zluda_dump",
|
||||
"zluda_fft",
|
||||
"zluda_inject",
|
||||
"zluda_lib",
|
||||
"zluda_llvm",
|
||||
"zluda_ml",
|
||||
"zluda_redirect",
|
||||
"zluda_rt",
|
||||
"zluda_sparse",
|
||||
]
|
||||
|
||||
# Cargo does not support OS-specific or profile-specific
|
||||
# targets. We keep list here to bare minimum and rely on xtask
|
||||
default-members = [
|
||||
"zluda_lib",
|
||||
"zluda_ml",
|
||||
"zluda_inject",
|
||||
"zluda_redirect"
|
||||
"ptx",
|
||||
"ptx_parser",
|
||||
"ptx_parser_macros",
|
||||
"ptx_parser_macros_impl",
|
||||
"xtask",
|
||||
"zluda_bindgen",
|
||||
]
|
||||
|
||||
[profile.dev.package.blake3]
|
||||
opt-level = 3
|
||||
default-members = ["zluda", "zluda_ml", "zluda_inject", "zluda_redirect"]
|
||||
|
||||
[profile.dev.package.lz4-sys]
|
||||
opt-level = 3
|
||||
[profile.release-lto]
|
||||
inherits = "release"
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
|
||||
[profile.dev.package.xtask]
|
||||
opt-level = 3
|
||||
opt-level = 2
|
||||
|
@ -1,57 +0,0 @@
|
||||
[config]
|
||||
default_to_workspace = false
|
||||
skip_core_tasks = true
|
||||
|
||||
[tasks.build]
|
||||
run_task = [
|
||||
{ name = "build-windows", condition = { platforms = ["windows"] } },
|
||||
{ name = "build-linux", condition = { platforms = ["linux"] } },
|
||||
]
|
||||
|
||||
[tasks.build-windows]
|
||||
command = "cargo"
|
||||
args = [
|
||||
"build",
|
||||
"-p", "offline_compiler",
|
||||
"-p", "zluda_dump",
|
||||
"-p", "zluda_inject",
|
||||
"-p", "zluda_lib",
|
||||
"-p", "zluda_ml",
|
||||
"-p", "zluda_redirect",
|
||||
]
|
||||
|
||||
[tasks.build-linux]
|
||||
command = "cargo"
|
||||
args = [
|
||||
"build",
|
||||
"-p", "offline_compiler",
|
||||
"-p", "zluda_blas",
|
||||
"-p", "zluda_blaslt",
|
||||
"-p", "zluda_ccl",
|
||||
"-p", "zluda_dnn",
|
||||
"-p", "zluda_dump",
|
||||
"-p", "zluda_fft",
|
||||
"-p", "zluda_lib",
|
||||
"-p", "zluda_ml",
|
||||
"-p", "zluda_sparse",
|
||||
]
|
||||
|
||||
[tasks.build-release]
|
||||
command = "cargo"
|
||||
args = [
|
||||
"build",
|
||||
"--release",
|
||||
"-p", "offline_compiler",
|
||||
"-p", "zluda_blas",
|
||||
"-p", "zluda_blaslt",
|
||||
"-p", "zluda_ccl",
|
||||
"-p", "zluda_dnn",
|
||||
"-p", "zluda_dump",
|
||||
"-p", "zluda_fft",
|
||||
"-p", "zluda_lib",
|
||||
"-p", "zluda_ml",
|
||||
"-p", "zluda_sparse",
|
||||
]
|
||||
|
||||
[tasks.default]
|
||||
alias = "build"
|
253
README.md
253
README.md
@ -1,250 +1,73 @@
|
||||
[](https://discord.gg/sg6BNzXuc7)
|
||||
|
||||
# ZLUDA
|
||||
|
||||
ZLUDA lets you run unmodified CUDA applications with near-native performance on ~~Intel~~ AMD GPUs.
|
||||
ZLUDA is a drop-in replacement for CUDA on non-NVIDIA GPU. ZLUDA allows to run unmodified CUDA applications using non-NVIDIA GPUs with near-native performance.
|
||||
|
||||
ZLUDA is currently alpha quality, but it has been confirmed to work with a variety of native CUDA applications: Geekbench, 3DF Zephyr, Blender, Reality Capture, LAMMPS, NAMD, waifu2x, OpenFOAM, Arnold (proof of concept) and more.
|
||||
ZLUDA supports AMD Radeon RX 5000 series and newer GPUs (both desktop and integrated).
|
||||
|
||||
If you want to give it a try, download it from Release page to the right and read [Usage](#usage) and [Known Issues](#known-issues) sections below. If you are interested in its history and future read [FAQ](#faq) section further below.
|
||||

|
||||
|
||||

|
||||
ZLUDA is work in progress. Follow development here and say hi on [Discord](https://discord.gg/sg6BNzXuc7). For more details see the announcement: https://vosen.github.io/ZLUDA/blog/zludas-third-life/
|
||||
|
||||
## Usage
|
||||
**Warning**: This version ZLUDA is under heavy development (more [here](https://vosen.github.io/ZLUDA/blog/zludas-third-life/)) and right now only supports Geekbench. ZLUDA probably will not work with your application just yet.
|
||||
|
||||
### Windows
|
||||
Using command line:
|
||||
You should have recent AMD GPU driver ("AMD Software: Adrenalin Edition") installed.\
|
||||
To run your application you should etiher:
|
||||
* (Recommended approach) Copy ZLUDA-provided `nvcuda.dll` and `nvml.dll` from `target\release` (if built from sources) or `zluda` (if downloaded a zip package) into a path which your application uses to load CUDA. Paths vary application to application, but usually it's the directory where the .exe file is located
|
||||
* Use ZLUDA launcher like below. ZLUDA launcher is known to be buggy and incomplete:
|
||||
```
|
||||
<ZLUDA_DIRECTORY>\zluda.exe -- <APPLICATION> <APPLICATION_ARGUMENTS>
|
||||
<ZLUDA_DIRECTORY>\zluda_with.exe -- <APPLICATION> <APPLICATIONS_ARGUMENTS>
|
||||
```
|
||||
If you downloaded a ZIP file with the release and unpacked it, then `<ZLUDA_DIRECTORY>` is the `zluda` directory you have just unpacked.\
|
||||
If you are building from source, then `<ZLUDA_DIRECTORY>` is subdirectory `target\release`.
|
||||
|
||||
### Linux
|
||||
Using command line:
|
||||
|
||||
Run your application like this:
|
||||
```
|
||||
LD_LIBRARY_PATH="<ZLUDA_DIRECTORY>:$LD_LIBRARY_PATH" <APPLICATION> <APPLICATION_ARGUMENTS>
|
||||
LD_LIBRARY_PATH=<ZLUDA_DIRECTORY> <APPLICATION> <APPLICATIONS_ARGUMENTS>
|
||||
```
|
||||
If you downloaded a ZIP file with the release and unpacked it, then `<ZLUDA_DIRECTORY>` is the `zluda` directory you have just unpacked.\
|
||||
If you are building from source, then `<ZLUDA_DIRECTORY>` is subdirectory `target\release`.
|
||||
|
||||
## Build
|
||||
where `<ZLUDA_DIRECTORY>` is the directory which contains ZLUDA-provided `libcuda.so`: `target/release` if you built from sources or `zluda` if you downloaded prebuilt package.
|
||||
|
||||
### Prerequisites
|
||||
### MacOS
|
||||
|
||||
Not supported
|
||||
|
||||
## Building
|
||||
|
||||
### Dependencies
|
||||
|
||||
Make sure you have the following installed:
|
||||
* Git
|
||||
* CMake
|
||||
* Python 3
|
||||
* Rust (1.66.1 or newer)
|
||||
* Rust compiler (recent version)
|
||||
* C++ compiler
|
||||
* (Linux only) ROCm 5.7+ (_not ROCm 6_) (https://rocm.docs.amd.com/en/latest/deploy/linux/install_overview.html)
|
||||
* (Windows only) Recent AMD Radeon Software Adrenalin (https://rocm.docs.amd.com/en/latest/deploy/linux/install_overview.html)
|
||||
* (Recommended, optional) Ninja (https://ninja-build.org/)
|
||||
* (Optional, but recommended) [Ninja build system](https://ninja-build.org/)
|
||||
|
||||
Alternatively, if you are building for Linux, [.devcontainer](.devcontainer) directory contains various developer Dockerfiles with all the required dependencies
|
||||
### Build steps
|
||||
|
||||
### Checkout
|
||||
* Git clone the repo (make sure to use `--recursive` option to fetch submodules):
|
||||
`git clone --recursive https://github.com/vosen/ZLUDA.git`
|
||||
* Enter freshly cloned `ZLUDA` directory and build with cargo (this takes a while):
|
||||
`cargo xtask --release`
|
||||
|
||||
Checkout ZLUDA code with:
|
||||
```
|
||||
git clone --recurse-submodules https://github.com/vosen/zluda.git
|
||||
```
|
||||
## Contributing
|
||||
|
||||
### Build
|
||||
Build by running:
|
||||
ZLUDA project has a commercial backing and _does not_ accept donations.
|
||||
ZLUDA project accepts pull requests and other non-monetary contributions.
|
||||
|
||||
```
|
||||
cargo xtask --release
|
||||
```
|
||||
If you want to contribute a code fix or documentation update feel free to open a Pull Request.
|
||||
|
||||
## Known Issues
|
||||
### Getting started
|
||||
|
||||
### Hardware
|
||||
There's no architecture document (yet). Two most important crates in ZLUDA are `ptx` (PTX compiler) and `zluda` (AMD GPU runtime). A good starting point to tinkering the project is to run one of the `ptx` unit tests under a debugger and understand what it is doing. `cargo test -p ptx -- ::add_hip` is a simple test that adds two numbers.
|
||||
|
||||
- If both integrated AMD GPU and dedicated AMD GPU are present in the system, ZLUDA uses the integrated GPU.
|
||||
Github issues tagged with ["help wanted"](https://github.com/vosen/ZLUDA/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) are tasks that are self-containted. Their level of difficulty varies, they are not always good beginner tasks, but they defined unambiguously.
|
||||
|
||||
This is a bug in underying ROCm/HIP runtime. You can work around it by disabling the integrated GPU.
|
||||
If you have questions feel free to ask on [#devtalk channel on Discord](https://discord.com/channels/1273316903783497778/1303329281409159270).
|
||||
|
||||
On Windows we recommend you use environment variable `HIP_VISIBLE_DEVICES=1` environment variable (more [here](https://rocmdocs.amd.com/en/latest/conceptual/gpu-isolation.html#hip-visible-devices)) or disable it system-wide in Device Manager.
|
||||
|
||||
On Linux we recommend you use environment variable `ROCR_VISIBLE_DEVICES=<UUID>` where `<UUID>` is the UUID of the dedicated GPU as reported by `rocminfo` command line tool (you can also use `HIP_VISIBLE_DEVICES=1`, but this does not seem to be stable). Alternatively you can disable integrated GPU syste-wide by passing `pci-stub.ids=<DEVICE_VENDOR>:<DEVICE_CODE>` to the kernel options. On Ubuntu you can pass additional kernel options by adding them to `/etc/default/grub` to the option `GRUB_CMDLINE_LINUX_DEFAULT`. You can find `<DEVICE_VENDOR>:<DEVICE_CODE>` with the help of `lspci -nn`. This will emit a series of lines with one of them matching you integrated GPU, for example:\
|
||||
`1b:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:164e] (rev c1)`\
|
||||
`<DEVICE_VENDOR>:<DEVICE_CODE>` ar at the end, in this case `1002:164e`.
|
||||
|
||||
- Integrated GPUs (as tested with Radeon 680M) work in a limited way. Some rarely used GPU operations (abort, printf, etc.) will hang or crash the application. Additionally, performance library support (cuBLAS, cuDNN, etc.) might be limited, rendering more complex applications inoperable.
|
||||
|
||||
- ZLUDA can use AMD server GPUs (as tested with Instinct MI200) with a caveat.
|
||||
|
||||
On Server GPUs, ZLUDA can compile CUDA GPU code to run in one of two modes:
|
||||
- Fast mode, which is faster, but can make exotic (but correct) GPU code hang.
|
||||
- Slow mode, which should make GPU code more stable, but can prevent some applications from running on ZLUDA.
|
||||
|
||||
By default, ZLUDA uses fast mode. That's because:
|
||||
- There's a huge performance difference, fast mode can be twice as fast.
|
||||
- The code patterns that can trip fast mode were not encountered across multiple projects (SPECFEM3D, QUDA, CHroma, MILC, Kokkos, LAMMPS, OpenFOAM, XGBoost, NAMD, LAMMPS).
|
||||
|
||||
You can use environment variable `ZLUDA_WAVE64_SLOW_MODE=1` to force compilation in slow mode.
|
||||
|
||||
Nothing of that applies to desktop and integrated GPUs (RDNA family).
|
||||
|
||||
|
||||
### Software
|
||||
|
||||
- Applications using ZLUDA are slow to start.
|
||||
|
||||
On the first start ZLUDA needs to compile GPU code for the application. This is a one-time cost, compiled GPU code is cached in `%LOCALAPPDATA%` on Windows and in `$XDG_CACHE_HOME` or `$HOME/.cache` on Linux.\
|
||||
Some applications will gradually load the GPU code as it is used. If that is undesirable you can try setting environment variable `CUDA_MODULE_LOADING=EAGER`. It depends on how the application was programmed, but it might force to load (and compile) all the kernels on startup, no matter if they are used or not.
|
||||
|
||||
- Applications running ZLUDA might produce slightly different values
|
||||
|
||||
Firstly, ZLUDA ignores some of the floating point denormal and rounding mode information present in the kernels. Secondly, for certain approximate (not IEEE 754) NVIDIA floating point operations in CUDA, ZLUDA blindly uses approximate AMD floating point operations. The two might have a different precision.
|
||||
|
||||
#### CUDA 12+
|
||||
- Application built with CUDA 12 and using Thrust crashes with `LLVM ERROR: unsupported libcall legalization`.
|
||||
|
||||
This is a ROCm/HIP bug. Currently, CUDA applications built with CUDA versions pre-12 work the best. Building with CUDA 12 and a pre-CUDA 12 Thrust might also work.
|
||||
|
||||
#### OptiX
|
||||
- ZLUDA has a bare-minimum OptiX implementation for Arnold. See details in [Arnold](#arnold) section.
|
||||
|
||||
#### Windows
|
||||
- Antivirus flags ZLUDA as malware.
|
||||
|
||||
ZLUDA launcher (`zluda.exe`) uses some of the techniques used by malware, but for good. `zluda.exe` hijacks the process and redirects all uses of the original NVIDIA's CUDA libraries to use ZLUDA's CUDA instead.
|
||||
|
||||
<u>Don't use `zluda.exe` with games that use anti-cheat.</u> ZLUDA does not support CUDA gaming workloads (PhysX or DLSS) and anti-cheat might mistake `zluda.exe` for a malware or a cheat.
|
||||
|
||||
- Following error when launching an application with `zluda.exe`: `Error: OsError { function: "DetourCreateProcessWithDllsW", error_code: 740, message: "The requested operation requires elevation." }`
|
||||
|
||||
You are launching an application that requires Administrator rights through `zluda.exe`. Try launching `zluda.exe` from an Administrator command line.
|
||||
|
||||
- ZLUDA offers limited support for performance libraries (cuDNN, cuBLAS, cuSPARSE, cuFFT, OptiX, NCCL). Currently, this support is Linux-only and not available on Windows.
|
||||
|
||||
- ZLUDA launcher (`zluda.exe`) does not support 32 bit processes. If an application launches 32 bit subprocess `a.exe` neither the 32 bit process `a.exe`, nor its 64 bit subprocess `a64.exe` will be able to use ZLUDA. This affects e.g. SiSoft Sandra.
|
||||
|
||||
### Applications
|
||||
|
||||
#### Arnold
|
||||
|
||||
* ZLUDA implements minimum of OptiX framework to support Arnold. ZLUDA's OptiX is buggy, unoptimized and incomplete. It's been tested with Arnold 7.1.4.1 command line rendering on Linux.
|
||||
|
||||
ZLUDA-OptiX is not built by default or redistributed in the release. To use it follow those steps:
|
||||
|
||||
* Firstly build a newer version of ROCm LLVM. Version shipped with 5.7.1 is known to miscompile Arnold code. Get it here: https://github.com/ROCm/llvm-project. Switch to a known good commit: `0c7fd5b6d1bbf471d2c068c2b6172d9cfd76b08d` and build it.
|
||||
|
||||
* Then build amd_comgr: https://github.com/ROCm/ROCm-CompilerSupport with the LLVM built in the previous step. I'm using the last commit from https://github.com/ROCm/ROCm-CompilerSupport (`8276083301409001ec7643e68f5ad58b057c21fd`).
|
||||
|
||||
* Now build ZLUDA-OptiX:
|
||||
```
|
||||
cargo ctask --release
|
||||
cargo build -p zluda_rt --release
|
||||
cd target/release
|
||||
ln -s libnvoptix.so liboptix.so.6.6.0
|
||||
cp ../../hiprt-sys/lib/libhiprt64.so .
|
||||
```
|
||||
|
||||
* After those quick and easy steps you can use it with the command line Arnold renderer:
|
||||
```
|
||||
LD_LIBRARY_PATH=<PATH_TO_ZLUDA>/target/release/ LD_PRELOAD="<PATH_TO_COMGR>/build/libamd_comgr.so.2 <PATH_TO_ZLUDA>/liboptix.so.6.6.0" /usr/autodesk/arnold/maya2023/bin/kick attic.ass -device gpu -o /tmp/attic.jpg -v 6 -sl
|
||||
```
|
||||
|
||||
* Keep in mind that ZLUDA-OptiX can only successfully render the simplest Arnold scene (and possibly one more):
|
||||
|
||||
* Cornell box (from [here](https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_scene_source_ac_ass_examples_html)):\
|
||||
[](https://imgur.com/4Vv3GO8)
|
||||
* (used to work, broken now) Attic scene (from [here](https://github.com/wahn/export_multi/tree/master/17_attic)):\
|
||||
[](https://imgur.com/a/2jF9Kb5)
|
||||
|
||||
#### PyTorch
|
||||
|
||||
* PyTorch received very little testing. ZLUDA's coverage of cuDNN APIs is very minimal (just enough to run ResNet-50) and realistically you won't get much running.\
|
||||
However if you are interested in trying it out you need to build it from sources with the settings below. Default PyTorch does not ship PTX and uses bundled NCCL which also builds without PTX:
|
||||
|
||||
```
|
||||
export TORCH_CUDA_ARCH_LIST="6.1+PTX"
|
||||
export CUDAARCHS=61
|
||||
export CMAKE_CUDA_ARCHITECTURES=61
|
||||
export USE_SYSTEM_NCCL=1
|
||||
export NCCL_ROOT_DIR=/usr
|
||||
export NCCL_INCLUDE_DIR=/usr/include
|
||||
export NCCL_LIB_DIR=/usr/lib/x86_64-linux-gnu
|
||||
export USE_EXPERIMENTAL_CUDNN_V8_API=OFF
|
||||
```
|
||||
or (untested):
|
||||
```
|
||||
export TORCH_CUDA_ARCH_LIST="6.1+PTX"
|
||||
export CUDAARCHS=61
|
||||
export CMAKE_CUDA_ARCHITECTURES=61
|
||||
export USE_SYSTEM_NCCL=1
|
||||
export USE_NCCL=0
|
||||
export USE_EXPERIMENTAL_CUDNN_V8_API=OFF
|
||||
```
|
||||
|
||||
When running use the following environment variable:
|
||||
```
|
||||
DISABLE_ADDMM_CUDA_LT=1
|
||||
```
|
||||
|
||||
|
||||
#### 3DF Zephyr
|
||||
- ZLUDA is much slower than CUDA.
|
||||
|
||||
3DF Zephyr is triggering an uderlying ROCm/HIP performance issue.
|
||||
|
||||
#### Reality Capture
|
||||
- ZLUDA is much slower than CUDA.
|
||||
|
||||
Reality Capture is triggering an uderlying ROCm/HIP performance issue.
|
||||
|
||||
#### CompuBench
|
||||
|
||||
- When running multiple tests, first test passes and the subsequent tests fail with `CUDA_ERROR_UNKNOWN`.
|
||||
|
||||
This is a ROCm/HIP bug. Currently, CompuBench tests have to be run one at a time.
|
||||
|
||||
- Some tests output black screen.
|
||||
|
||||
This is due to a bug (or an unintended hardware feature) in CompuBench that just happens to work on NVIDIA GPUs.
|
||||
|
||||
#### V-Ray Benchmark
|
||||
|
||||
- Currently, ZLUDA crashes when running V-Ray benchmark. Nonetheless, certain "lucky" older combinations of ZLUDA and ROCm/HIP are known to run V-Ray Benchmark successfully.
|
||||
|
||||
#### Cinebench CUDA
|
||||
|
||||
- ZLUDA can't run it. Cinebench CUDA benchmark has not been fully compiled with PTX. It may be possible to run it (sans OptiX) if the OctaneBench developers re-compile it.
|
||||
|
||||
#### OctaneBench
|
||||
|
||||
- ZLUDA can't run it. OctaneBench has not been fully compiled with PTX. It may be possible to run it (sans OptiX) if the OctaneBench developers re-compile it.
|
||||
|
||||
## FAQ
|
||||
|
||||
- Why is this project suddenly back after 3 years? What happened to Intel GPU support?
|
||||
|
||||
In 2021 I was contacted by Intel about the development od ZLUDA. I was an Intel employee at the time. While we were building a case for ZLUDA internally, I was asked for a far-reaching discretion: not to advertise the fact that Intel was evaluating ZLUDA and definitely not to make any commits to the public ZLUDA repo. After some deliberation, Intel decided that there is no business case for running CUDA applications on Intel GPUs.
|
||||
|
||||
Shortly thereafter I got in contact with AMD and in early 2022 I have left Intel and signed a ZLUDA development contract with AMD. Once again I was asked for a far-reaching discretion: not to advertise the fact that AMD is evaluating ZLUDA and definitely not to make any commits to the public ZLUDA repo. After two years of development and some deliberation, AMD decided that there is no business case for running CUDA applications on AMD GPUs.
|
||||
|
||||
One of the terms of my contract with AMD was that if AMD did not find it fit for further development, I could release it. Which brings us to today.
|
||||
|
||||
|
||||
* What's the future of the project?
|
||||
|
||||
With neither Intel nor AMD interested, we've run out of GPU companies. I'm open though to any offers of that could move the project forward.
|
||||
|
||||
Realistically, it's now abandoned and will only possibly receive updates to run workloads I am personally interested in (DLSS).
|
||||
|
||||
* What underlying GPU API does ZLUDA use? Is it OpenCL? ROCm? Vulkan?
|
||||
|
||||
ZLUDA is built purely on ROCm/HIP. On both Windows and Linux.
|
||||
|
||||
* I am a developer writing CUDA code, does this project help me port my code to ROCm/HIP?
|
||||
|
||||
Currently no, this project is strictly for end users. However this project could be used for a much more gradual porting from CUDA to HIP than anything else. You could start with an unmodified application running on ZLUDA, then have ZLUDA expose the underlying HIP objects (streams, modules, etc.), allowing to rewrite GPU kernels one at a time. Or you could have a mixed CUDA-HIP application where only the most performance sensitive GPU kernels are written in the native AMD language.
|
||||
|
||||
## For developers
|
||||
|
||||
If you are curious about ZLUDA's architecture, you can read a broad overview in [ARCHITECTURE.md](ARCHITECTURE.md).
|
||||
|
||||
## License
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
[package]
|
||||
name = "atiadlxx-sys"
|
||||
version = "0.0.0"
|
||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||
edition = "2018"
|
||||
links = "atiadlxx"
|
||||
|
||||
[lib]
|
@ -1 +0,0 @@
|
||||
bindgen include/wrapper.hpp -o src/adl.rs --no-layout-tests --default-enum-style=newtype --no-derive-debug --allowlist-function "ADL2_.*" --allowlist-var "ADL.*" --allowlist-type "ADL.*"
|
@ -1,389 +0,0 @@
|
||||
#ifndef ADAPTER_H_
|
||||
#define ADAPTER_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ObservedClockInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpCoreClock, int* lpMemoryClock);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ObservedClockInfo_Get(int iAdapterIndex, int* lpCoreClock, int* lpMemoryClock);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ObservedGameClockInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpBaseClock, int* lpGameClock, int* lpBoostClock, int* lpMemoryClock);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Active_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex,
|
||||
int iStatus,
|
||||
int* lpNewlyActivate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Active_Set(int iAdapterIndex,
|
||||
int iStatus,
|
||||
int* lpNewlyActivate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Active_SetPrefer(ADL_CONTEXT_HANDLE context, int iAdapterIndex,
|
||||
int iStatus,
|
||||
int iNumPreferTarget,
|
||||
ADLDisplayTarget* lpPreferTarget,
|
||||
int* lpNewlyActivate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Active_SetPrefer(int iAdapterIndex,
|
||||
int iStatus,
|
||||
int iNumPreferTarget,
|
||||
ADLDisplayTarget* lpPreferTarget,
|
||||
int* lpNewlyActivate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Primary_Get(ADL_CONTEXT_HANDLE context, int* lpPrimaryAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Primary_Get(int* lpPrimaryAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Primary_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Primary_Set(int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ModeSwitch(ADL_CONTEXT_HANDLE context, int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ModeSwitch(int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Active_Get (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpStatus);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Active_Get ( int iAdapterIndex, int* lpStatus);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Aspects_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, char* lpAspects, int iSize );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Aspects_Get( int iAdapterIndex, char* lpAspects, int iSize );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_NumberOfAdapters_Get (ADL_CONTEXT_HANDLE context, int* lpNumAdapters );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_NumberOfAdapters_Get ( int* lpNumAdapters );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Flush_Driver_Data(ADL_CONTEXT_HANDLE context,int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Flush_Driver_Data(int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AdapterInfo_Get (ADL_CONTEXT_HANDLE context,LPAdapterInfo lpInfo, int iInputSize);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VerndorID_Int_get(ADL_CONTEXT_HANDLE context, int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_AdapterInfo_Get (LPAdapterInfo lpInfo, int iInputSize);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AdapterInfoX2_Get (ADL_CONTEXT_HANDLE context,AdapterInfo **lppAdapterInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_AdapterInfoX2_Get (AdapterInfo **lppAdapterInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_RegValueString_Get(int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int iSize, char *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_RegValueString_Set(int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int iSize, char *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_RegValueString_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int iSize, char *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_RegValueString_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int iSize, char *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_RegValueInt_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_RegValueInt_Get(int iAdapterIndex, int iDriverPathOption, char* szSubKey, char *szKeyName, int *lpKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_RegValueInt_Set(int iAdapterIndex, int iDriverPathOption, char *szSubKey, char *szKeyName, int iKeyValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_RegValueInt_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDriverPathOption, char *szSubKey, char *szKeyName, int iKeyValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ASICFamilyType_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpAsicTypes, int* lpValids);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ASICFamilyType_Get (int iAdapterIndex, int* lpAsicTypes, int* lpValids);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Speed_Caps (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpCaps, int* lpValid);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Speed_Caps (int iAdapterIndex, int* lpCaps, int* lpValid);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Speed_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Speed_Get (int iAdapterIndex, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Speed_Set (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iSpeed);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Speed_Set (int iAdapterIndex, int iSpeed);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Accessibility_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpAccessibility);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Accessibility_Get (int iAdapterIndex, int *lpAccessibility);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VideoBiosInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLBiosInfo* lpBiosInfo );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VideoBiosInfo_Get( int iAdapterIndex, ADLBiosInfo* lpBiosInfo );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ID_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpAdapterID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ID_Get(int iAdapterIndex, int* lpAdapterID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_AdapterX2_Caps(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLAdapterCapsX2 *adapterCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_AdapterX2_Caps(int iAdapterIndex, ADLAdapterCapsX2 *adapterCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Stress_Test_Cap(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Throttle_Notification_Cap(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AceDefaults_Restore(ADL_CONTEXT_HANDLE context, int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AdapterInfoX4_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* numAdapters, AdapterInfoX2** lppAdapterInfoX2);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AdapterInfoX3_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* numAdapters, AdapterInfo** lppAdapterInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_AdapterList_Disable(ADL_CONTEXT_HANDLE context, int iNumAdapters, int *lpAdapterIndexList, bool isSkipSaveDB = false);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_AdapterList_Disable(int iNumAdapters, int *lpAdapterIndexList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_BigSw_Info_Get(int iAdapterIndex, int* lpBigSwSupportMajor, int* lpBigSwSupportMinor, int* lpRedStoneSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_BigSw_Info_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpBigSwSupportMajor, int* lpBigSwSupportMinor, int* lpRedStoneSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLAdapterCaps *adapterCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Caps(int iAdapterIndex, ADLAdapterCaps *adapterCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ChipSetInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLChipSetInfo * lpChipSetInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ChipSetInfo_Get(int iAdapterIndex, ADLChipSetInfo * lpChipSetInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Feature_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_UIFEATURES_GROUP iFeatureID, int *iIsFeatureSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_HBC_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpHbcCapable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Headless_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpHeadless);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_IsGamingDriver_Info_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpCwgSupport, int* lpIsGamingMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_MemoryInfo2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLMemoryInfo2 *lpMemoryInfo2);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_MemoryInfo2_Get(int iAdapterIndex, ADLMemoryInfo2 *lpMemoryInfo2);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_TRNG_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iTRNGSize, int iTRNGBufferSize, char *lpTRNGBuffer);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Modes_ReEnumerate(ADL_CONTEXT_HANDLE context);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Modes_ReEnumerate();
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Feature_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_UIFEATURES_GROUP iFeatureID, int *iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Feature_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_UIFEATURES_GROUP iFeatureID, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_GcnAsicInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLGcnInfo* gcnInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_GPUVMPageSize_Info_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* iVMPageSizeSupport, int* iVMPageSizeType);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_GPUVMPageSize_Info_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iVMPageSizeType);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VRAMUsage_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iVRAMUsageInMB);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_DedicatedVRAMUsage_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iVRAMUsageInMB);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VideoTheaterModeInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpOverlayDisplayMode, int* lpSavedSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VideoTheaterModeInfo_Get(int iAdapterIndex, int* lpOverlayDisplayMode, int* lpSavedSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VideoTheaterModeInfo_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iOverlayDisplayMode, int iSavedSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VideoTheaterModeInfo_Set(int iAdapterIndex, int iOverlayDisplayMode, int iSavedSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_MMD_Features_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLFeatureCaps ** lppFeatureCaps, int * lpFeatureCount);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_MMD_Features_Caps(int iAdapterIndex, ADLFeatureCaps ** lppFeatureCaps, int * lpFeatureCount);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_MMD_FeatureValues_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLFeatureValues ** lppFeatureValues, int * lpFeatureCount);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_MMD_FeatureValues_Get(int iAdapterIndex, ADLFeatureValues ** lppFeatureValues, int * lpFeatureCount);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_MMD_FeatureValues_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLFeatureValues * lpFeatureValues, int iFeatureCount, int ClientID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_MMD_FeatureValues_Set(int iAdapterIndex, ADLFeatureValues * lpFeatureValues, int iFeatureCount, int ClientID);
|
||||
|
||||
|
||||
|
||||
#if defined (_WIN32) || defined(_WIN64)
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PageMigration_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLVirtualSegmentSettingsOutput *lpVirtualSegSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PageMigration_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iEnabled, int iNewSize);
|
||||
|
||||
#endif /*(_WIN32) || (_WIN64)*/
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Crossfire_Caps (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpPreferred, int* lpNumComb, ADLCrossfireComb **ppCrossfireComb);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Crossfire_Caps (int iAdapterIndex, int* lpPreferred, int* lpNumComb, ADLCrossfireComb **ppCrossfireComb);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Crossfire_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb, ADLCrossfireInfo *lpCrossfireInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Crossfire_Get (int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb, ADLCrossfireInfo *lpCrossfireInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_Crossfire_Set (ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_Crossfire_Set (int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_MVPU_Set (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_CrossfireX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb, ADLCrossfireInfo *lpCrossfireInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_CrossfireX2_Get(int iAdapterIndex, ADLCrossfireComb *lpCrossfireComb, ADLCrossfireInfo *lpCrossfireInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_BoardLayout_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpValidFlags, int *lpNumberSlots, ADLBracketSlotInfo** lppBracketSlot, int* lpNumberConnector, ADLConnectorInfo** lppConnector);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_BoardLayout_Get(int iAdapterIndex, int* lpValidFlags, int *lpNumberSlots, ADLBracketSlotInfo** lppBracketSlot, int* lpNumberConnector, ADLConnectorInfo** lppConnector);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_SupportedConnections_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort, ADLSupportedConnections* lpADLSupportedConnections);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_SupportedConnections_Get(int iAdapterIndex, ADLDevicePort devicePort, ADLSupportedConnections* lpADLSupportedConnections);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ConnectionState_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort, ADLConnectionState* lpADLConnectionState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ConnectionState_Get(int iAdapterIndex, ADLDevicePort devicePort, ADLConnectionState* lpADLConnectionState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_EmulationMode_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort, int iEmulationMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_EmulationMode_Set(int iAdapterIndex, ADLDevicePort devicePort, int iEmulationMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ConnectionData_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort, ADLConnectionData ConnectionData);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ConnectionData_Set(int iAdapterIndex, ADLDevicePort devicePort, ADLConnectionData ConnectionData);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ConnectionData_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort, int iQueryType, ADLConnectionData* lpConnectionData);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ConnectionData_Get(int iAdapterIndex, ADLDevicePort devicePort, int iQueryType, ADLConnectionData* lpConnectionData);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ConnectionData_Remove(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLDevicePort devicePort);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ConnectionData_Remove(int iAdapterIndex, ADLDevicePort devicePort);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_EDIDManagement_Caps(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_EDIDManagement_Caps(int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Workstation_GlobalEDIDPersistence_Get(ADL_CONTEXT_HANDLE context,int *lpCurResultValue, int *lpDefResultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Workstation_GlobalEDIDPersistence_Get(int *lpCurResultValue, int *lpDefResultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Workstation_GlobalEDIDPersistence_Set(ADL_CONTEXT_HANDLE context,int iCurState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Workstation_GlobalEDIDPersistence_Set(int iCurState);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_ElmCompatibilityMode_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_ElmCompatibilityMode_Status_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_ElmCompatibilityMode_Status_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iValue);
|
||||
|
||||
|
||||
#if defined (_WIN32) || defined(_WIN64)
|
||||
ADL_EXTERNC int EXPOSED ADL2_FPS_Caps (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpSupported, int *lpVersion);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_FPS_Settings_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLFPSSettingsOutput *lpFPSSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_FPS_Settings_Set (ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLFPSSettingsInput lpFPSSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_FPS_Settings_Reset (ADL_CONTEXT_HANDLE context,int iAdapterIndex);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_RIS_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_RIS_SETTINGS settings, ADL_RIS_NOTFICATION_REASON changeReason);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_RIS_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_RIS_SETTINGS* settings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CHILL_SettingsX2_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_CHILL_SETTINGS settings, ADL_CHILL_NOTFICATION_REASON changeReason, ADL_ERROR_REASON* errorReason);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CHILL_SettingsX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_CHILL_SETTINGS* settings);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DELAG_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_DELAG_SETTINGS settings, ADL_DELAG_NOTFICATION_REASON changeReason, ADL_ERROR_REASON* errorReason);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DELAG_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_DELAG_SETTINGS* settings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_BOOST_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_BOOST_SETTINGS settings, ADL_BOOST_NOTFICATION_REASON changeReason, ADL_ERROR_REASON* errorReason);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_BOOST_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_BOOST_SETTINGS* settings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PROVSR_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_PROVSR_SETTINGS settings, ADL_PROVSR_NOTFICATION_REASON changeReason, ADL_ERROR_REASON* errorReason);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PROVSR_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_PROVSR_SETTINGS* settings);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Chill_Settings_Notify(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iChanged);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Chill_Settings_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Chill_Settings_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Chill_Caps_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* iSupported, int* iCheckCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PerformanceTuning_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PerfTuning_Status_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpPTuningValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PerfTuning_Status_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int lpPTuningValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PPW_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PPW_Status_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpFPWValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PPW_Status_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iFPWValue);
|
||||
|
||||
#endif /*(_WIN32) || (_WIN64)*/
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *iIsFrameMonitorSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_Start(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int VidPnSourceId);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_Stop(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int VidPnSourceId);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int VidPnSourceId, float *iFramesPerSecond);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_FrameDuration_Enable(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_FRAME_DURATION_HANDLE* frameDurationHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_FrameDuration_Disable(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_FRAME_DURATION_HANDLE* frameDurationHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_FrameDuration_Start(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int VidPnSourceId);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_FrameDuration_Stop(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int VidPnSourceId);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_FrameMetrics_FrameDuration_Get(ADL_CONTEXT_HANDLE context, ADL_FRAME_DURATION_HANDLE frameDurationHandle, unsigned long long * pFrameDurationsArr, unsigned int frameDurationsArrSize, unsigned int *elementsCopied);
|
||||
|
||||
// Deprecated APIs
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ClockInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLClockInfo* lpClockInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ClockInfo_Get(int iAdapterIndex, ADLClockInfo* lpClockInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_AdapterID_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpAdapterID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_AdapterID_Get(int iAdapterIndex, int* lpAdapterID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_EDC_ErrorRecords_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* pErrorrecordCount, ADLErrorRecord* errorRecords);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_EDC_ErrorInjection_Set (ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLErrorInjection* errorInjection);
|
||||
|
||||
|
||||
#endif /* ADAPTER_H_ */
|
@ -1,64 +0,0 @@
|
||||
#ifndef ADL_H_
|
||||
#define ADL_H_
|
||||
|
||||
#include "adl_sdk.h"
|
||||
//#include "amd_only/amd_structures.h"
|
||||
|
||||
#include "adapter.h"
|
||||
#include "display.h"
|
||||
//#include "workstation.h"
|
||||
//#include "displaysmanager.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Main_ControlX2_Create ( ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters, ADLThreadingModel threadingModel );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Main_ControlX2_Create ( ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters, ADL_CONTEXT_HANDLE* context, ADLThreadingModel threadingModel);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Main_ControlX3_Create(ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters, ADL_CONTEXT_HANDLE* context, ADLThreadingModel threadingModel, int adlCreateOptions);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Main_Control_Create ( ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Main_Control_Create ( ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters, ADL_CONTEXT_HANDLE* context);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Main_Control_Refresh (ADL_CONTEXT_HANDLE context);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Main_Control_Refresh ();
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Main_Control_Destroy ();
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Main_Control_Destroy (ADL_CONTEXT_HANDLE context);
|
||||
|
||||
ADL_EXTERNC EXPOSED void* ADL2_Main_Control_GetProcAddress (ADL_CONTEXT_HANDLE context, void* lpModule, char* lpProcName );
|
||||
|
||||
ADL_EXTERNC EXPOSED void* ADL_Main_Control_GetProcAddress ( void* lpModule, char* lpProcName );
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_RegisterEvent(ADL_CONTEXT_HANDLE context, int eventID, void* evntHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_UnRegisterEvent(ADL_CONTEXT_HANDLE context, int eventID, void* evntHandle);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_RegisterEventX2(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int clientID, int eventID, void* evntHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_UnRegisterEventX2(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int clientID, int eventID, void* evntHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PerGPU_GDEvent_Register(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int clientID, int eventID, void* evntHandle);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_PerGPU_GDEvent_UnRegister(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int clientID, int eventID, void* evntHandle);
|
||||
|
||||
|
||||
#endif /* ADL_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2016 - 2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// MIT LICENSE:
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
/// \file adl_sdk.h
|
||||
/// \brief Contains the definition of the Memory Allocation Callback.\n <b>Included in ADL SDK</b>
|
||||
///
|
||||
/// \n\n
|
||||
/// This file contains the definition of the Memory Allocation Callback.\n
|
||||
/// It also includes definitions of the respective structures and constants.\n
|
||||
/// <b> This is the only header file to be included in a C/C++ project using ADL </b>
|
||||
|
||||
#ifndef ADL_SDK_H_
|
||||
#define ADL_SDK_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#if defined (LINUX)
|
||||
#define __stdcall
|
||||
#endif /* (LINUX) */
|
||||
|
||||
/// Memory Allocation Call back
|
||||
typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
|
||||
|
||||
#define ADL_SDK_MAJOR_VERSION 17
|
||||
#define ADL_SDK_MINOR_VERSION 1
|
||||
|
||||
#endif /* ADL_SDK_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,573 +0,0 @@
|
||||
#ifndef DISPLAY_H_
|
||||
#define DISPLAY_H_
|
||||
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_VirtualType_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADL_VIRTUALDISPLAY_TYPE *iVirtualType);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_WriteAndReadI2CLargePayload(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLI2CLargePayload *plI2C);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_WriteAndReadI2CLargePayload(int iAdapterIndex, ADLI2CLargePayload *plI2C);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_HDCP_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLHDCPSettings *lpHDCPSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_HDCP_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int iSetToDefault, int iEnable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_HDRState_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, int *iSupport, int *iEnable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_HDRState_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, int iEnable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Limits_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int* lpMaxHRes, int* lpMaxVRes, int* lpMaxRefresh);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PreferredMode_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int* lpNumModes, ADLMode** lppModes);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Limits_Get(int iAdapterIndex, int iDisplayIndex, int* lpMaxHRes, int* lpMaxVRes, int* lpMaxRefresh);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DisplayInfo_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex,
|
||||
int* lpNumDisplays,
|
||||
ADLDisplayInfo ** lppInfo,
|
||||
int iForceDetect);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DisplayInfo_Get (int iAdapterIndex,
|
||||
int* lpNumDisplays,
|
||||
ADLDisplayInfo ** lppInfo,
|
||||
int iForceDetect);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DpMstInfo_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex,
|
||||
int* lpNumDisplays,
|
||||
ADLDisplayDPMSTInfo ** lppDisplayDPMstInfo,
|
||||
int iForceDetect);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DpMstInfo_Get (int iAdapterIndex,
|
||||
int* lpNumDisplays,
|
||||
ADLDisplayDPMSTInfo ** lppDisplayDPMstInfo,
|
||||
int iForceDetect);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_NumberOfDisplays_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpNumDisplays);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_NumberOfDisplays_Get(int iAdapterIndex, int *lpNumDisplays);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PreservedAspectRatio_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpSupport, int * lpCurrent, int * lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_PreservedAspectRatio_Get(int iAdapterIndex, int iDisplayIndex, int* lpSupport, int * lpCurrent, int * lpDefault);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PreservedAspectRatio_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_PreservedAspectRatio_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ImageExpansion_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpSupport, int * lpCurrent, int * lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ImageExpansion_Get(int iAdapterIndex, int iDisplayIndex, int* lpSupport, int * lpCurrent, int * lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ImageExpansion_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ImageExpansion_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Position_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpX, int* lpY, int* lpXDefault, int* lpYDefault,
|
||||
int* lpMinX, int* lpMinY, int* lpMaxX, int*lpMaxY, int* lpStepX, int* lpStepY);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Position_Get(int iAdapterIndex, int iDisplayIndex, int* lpX, int* lpY, int* lpXDefault, int* lpYDefault,
|
||||
int* lpMinX, int* lpMinY, int* lpMaxX, int*lpMaxY, int* lpStepX, int* lpStepY);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Position_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iX, int iY);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Position_Set(int iAdapterIndex, int iDisplayIndex, int iX, int iY);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Size_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpWidth, int* lpHeight, int* lpDefaultWidth, int* lpDefaultHeight,
|
||||
int* lpMinWidth, int* lpMinHeight, int* lpMaxWidth, int*lpMaxHeight, int* lpStepWidth, int* lpStepHeight);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Size_Get(int iAdapterIndex, int iDisplayIndex, int* lpWidth, int* lpHeight, int* lpDefaultWidth, int* lpDefaultHeight,
|
||||
int* lpMinWidth, int* lpMinHeight, int* lpMaxWidth, int*lpMaxHeight, int* lpStepWidth, int* lpStepHeight);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Size_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iWidth, int iHeight);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Size_Set(int iAdapterIndex, int iDisplayIndex, int iWidth, int iHeight);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_AdjustCaps_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_AdjustCaps_Get(int iAdapterIndex, int iDisplayIndex, int* lpInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Capabilities_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpNumberOfControlers, int* lpNumberOfDisplays);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Capabilities_Get(int iAdapterIndex, int* lpNumberOfControlers, int* lpNumberOfDisplays);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ConnectedDisplays_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int * lpConnections);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ConnectedDisplays_Get(int iAdapterIndex, int * lpConnections);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DeviceConfig_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayConfig * lpDisplayConfig);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DeviceConfig_Get(int iAdapterIndex, int iDisplayIndex, ADLDisplayConfig * lpDisplayConfig);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Property_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayProperty * lpDisplayProperty);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Property_Get(int iAdapterIndex, int iDisplayIndex, ADLDisplayProperty * lpDisplayProperty);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Property_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayProperty * lpDisplayProperty);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Property_Set(int iAdapterIndex, int iDisplayIndex, ADLDisplayProperty * lpDisplayProperty);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_SwitchingCapability_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpResult);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_SwitchingCapability_Get(int iAdapterIndex, int *lpResult);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DitherState_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpDitherState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DitherState_Get(int iAdapterIndex, int iDisplayIndex, int *lpDitherState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DitherState_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iDitherState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DitherState_Set(int iAdapterIndex, int iDisplayIndex, int iDitherState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_SupportedPixelFormat_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_SupportedPixelFormat_Get(int iAdapterIndex, int iDisplayIndex, int *lpPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PixelFormat_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_PixelFormat_Get(int iAdapterIndex, int iDisplayIndex, int *lpPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PixelFormatDefault_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int *lpDefPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_PixelFormat_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_PixelFormat_Set(int iAdapterIndex, int iDisplayIndex, int iPixelFormat);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_SupportedColorDepth_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int *lpColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_SupportedColorDepth_Get(int iAdapterIndex, int iDisplayIndex, int *lpColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorDepth_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int *lpColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ColorDepth_Get(int iAdapterIndex, int iDisplayIndex, int *lpColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorDepth_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int iColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ColorDepth_Set(int iAdapterIndex, int iDisplayIndex, int iColorDepth);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ODClockInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLAdapterODClockInfo *lpOdClockInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ODClockInfo_Get(int iAdapterIndex, ADLAdapterODClockInfo *lpOdClockInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ODClockConfig_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLAdapterODClockConfig *lpOdClockConfig);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ODClockConfig_Set(int iAdapterIndex, ADLAdapterODClockConfig *lpOdClockConfig);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_AdjustmentCoherent_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpAdjustmentCoherentCurrent, int *lpAdjustmentCoherentDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_AdjustmentCoherent_Get(int iAdapterIndex, int iDisplayIndex, int *lpAdjustmentCoherentCurrent, int *lpAdjustmentCoherentDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_AdjustmentCoherent_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iAdjustmentCoherent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_AdjustmentCoherent_Set(int iAdapterIndex, int iDisplayIndex, int iAdjustmentCoherent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ReducedBlanking_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpReducedBlankingCurrent, int *lpReducedBlankingDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ReducedBlanking_Get(int iAdapterIndex, int iDisplayIndex, int *lpReducedBlankingCurrent, int *lpReducedBlankingDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ReducedBlanking_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iReducedBlanking);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ReducedBlanking_Set(int iAdapterIndex, int iDisplayIndex, int iReducedBlanking);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FormatsOverride_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpSettingsSupported, int* lpSettingsSupportedEx, int* lpCurSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FormatsOverride_Get(int iAdapterIndex, int iDisplayIndex, int* lpSettingsSupported, int* lpSettingsSupportedEx, int* lpCurSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FormatsOverride_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FormatsOverride_Set(int iAdapterIndex, int iDisplayIndex, int iOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_MVPUCaps_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLMVPUCaps *lpMvpuCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_MVPUCaps_Get(int iAdapterIndex, ADLMVPUCaps *lpMvpuCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_MVPUStatus_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLMVPUStatus *lpMvpuStatus);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_MVPUStatus_Get(int iAdapterIndex, ADLMVPUStatus *lpMvpuStatus);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DummyVirtual_Get(ADL_CONTEXT_HANDLE context, int iVirtualDisplayType, int* iTargetID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DummyVirtual_Destroy(ADL_CONTEXT_HANDLE context, int iTargetID);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VariBright_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VariBright_Caps(int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VariBrightEnable_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VariBrightEnable_Set(int iAdapterIndex, int iEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VariBrightLevel_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iDefaultLevel, int * iNumberOfLevels, int * iStep, int * iCurrentLevel);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VariBrightLevel_Get(int iAdapterIndex, int * iDefaultLevel, int * iNumberOfLevels, int * iStep, int * iCurrentLevel);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_VariBrightLevel_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iCurrentLevel, int iApplyImmediately);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_VariBrightLevel_Set(int iAdapterIndex, int iCurrentLevel, int iApplyImmediately);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ControllerOverlayAdjustmentCaps_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLControllerOverlayInput *lpOverlayInput, ADLControllerOverlayInfo *lpCapsInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ControllerOverlayAdjustmentCaps_Get(int iAdapterIndex, ADLControllerOverlayInput *lpOverlayInput, ADLControllerOverlayInfo *lpCapsInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ControllerOverlayAdjustmentData_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLControllerOverlayInput * lpOverlay);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ControllerOverlayAdjustmentData_Get(int iAdapterIndex, ADLControllerOverlayInput * lpOverlay);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ControllerOverlayAdjustmentData_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLControllerOverlayInput * lpOverlay);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ControllerOverlayAdjustmentData_Set(int iAdapterIndex, ADLControllerOverlayInput * lpOverlay);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ViewPort_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLControllerMode * lpControllerMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ViewPort_Set(int iAdapterIndex, int iDisplayIndex, ADLControllerMode * lpControllerMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ViewPort_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLControllerMode * lpControllerMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ViewPort_Get(int iAdapterIndex, int iDisplayIndex, ADLControllerMode * lpControllerMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ViewPort_Cap(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int* lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ViewPort_Cap(int iAdapterIndex, int* lpSupported);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_WriteAndReadI2CRev_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpMajor, int *lpMinor);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_WriteAndReadI2CRev_Get(int iAdapterIndex, int *lpMajor, int *lpMinor);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_WriteAndReadI2C(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLI2C *plI2C);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_WriteAndReadI2C(int iAdapterIndex, ADLI2C *plI2C);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DDCBlockAccess_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex,int iSendMsgLen, char *lpucSendMsgBuf, int *lpulRecvMsgLen, char *lpucRecvMsgBuf);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DDCBlockAccess_Get(int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex,int iSendMsgLen, char *lpucSendMsgBuf, int *lpulRecvMsgLen, char *lpucRecvMsgBuf);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DDCInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDDCInfo* lpInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DDCInfo_Get(int iAdapterIndex, int iDisplayIndex, ADLDDCInfo* lpInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DDCInfo2_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDDCInfo2* lpInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DDCInfo2_Get(int iAdapterIndex, int iDisplayIndex, ADLDDCInfo2* lpInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_EdidData_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *lpEDIDData);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_EdidData_Get(int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *lpEDIDData);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorCaps_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpCaps, int* lpValids);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ColorCaps_Get(int iAdapterIndex, int iDisplayIndex, int* lpCaps, int* lpValids);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Color_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iColorType, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Color_Set(int iAdapterIndex, int iDisplayIndex, int iColorType, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Color_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iColorType, int* lpCurrent, int* lpDefault, int* lpMin, int* lpMax, int* lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Color_Get(int iAdapterIndex, int iDisplayIndex, int iColorType, int* lpCurrent, int* lpDefault, int* lpMin, int* lpMax, int* lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorTemperatureSource_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpTempSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ColorTemperatureSource_Get(int iAdapterIndex, int iDisplayIndex, int *lpTempSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorTemperatureSourceDefault_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpTempSourceDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ColorTemperatureSource_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iTempSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ColorTemperatureSource_Set(int iAdapterIndex, int iDisplayIndex, int iTempSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Gamut_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, ADLGamutInfo *lpCap);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Gamut_Caps(int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, ADLGamutInfo *lpCap);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Gamut_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, ADLGamutData *lpSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Gamut_Get(int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, ADLGamutData *lpSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Gamut_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, const ADLGamutData *lpSource);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Gamut_Set(int iAdapterIndex, int iDisplayIndex, ADLGamutReference gamut, const ADLGamutData *lpSource);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverride_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayMode *lpModeIn, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverride_Get(int iAdapterIndex, int iDisplayIndex, ADLDisplayMode *lpModeIn, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverride_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLDisplayModeInfo *lpMode, int iForceUpdate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverride_Set(int iAdapterIndex, int iDisplayIndex, ADLDisplayModeInfo *lpMode, int iForceUpdate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideList_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iMaxNumOfOverrides, ADLDisplayModeInfo *lpModeInfoList, int *lpNumOfOverrides);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverrideList_Get(int iAdapterIndex, int iDisplayIndex, int iMaxNumOfOverrides, ADLDisplayModeInfo *lpModeInfoList, int *lpNumOfOverrides);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideX2_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDisplayModeInfoX2 *lpMode, int iForceUpdate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideX3_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeX2 *lpModeIn, ADLDisplayModeInfoX2 *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideListX3_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, int *lpNumOfModes, ADLDisplayModeInfoX2 **lpModeInfoList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_ModeTimingOverride_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Adapter_ModeTimingOverride_Caps(int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeX2 *lpModeIn, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverrideX2_Get(int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeX2 *lpModeIn, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverrideListX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, int *lpNumOfModes, ADLDisplayModeInfo **lpModeInfoList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverrideListX2_Get(int iAdapterIndex, ADLDisplayID displayID, int *lpNumOfModes, ADLDisplayModeInfo **lpModeInfoList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_ModeTimingOverride_Delete(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeX2 *lpMode, int iForceUpdate);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_ModeTimingOverride_Delete(int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeX2 *lpMode, int iForceUpdate);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_CustomizedModeListNum_Get (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpListNum);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_CustomizedModeListNum_Get (int iAdapterIndex, int iDisplayIndex, int* lpListNum);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_CustomizedModeList_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLCustomMode* lpCustomModeList, int iBuffSize);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_CustomizedModeList_Get(int iAdapterIndex, int iDisplayIndex, ADLCustomMode* lpCustomModeList, int iBuffSize);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_CustomizedMode_Add (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLCustomMode customMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_CustomizedMode_Add (int iAdapterIndex, int iDisplayIndex, ADLCustomMode customMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_CustomizedMode_Delete (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_CustomizedMode_Delete (int iAdapterIndex, int iDisplayIndex, int iIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_CustomizedMode_Validate(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, ADLCustomMode customMode, int *lpValid);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_CustomizedMode_Validate(int iAdapterIndex, int iDisplayIndex, ADLCustomMode customMode, int *lpValid);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_UnderscanSupport_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_UnderscanState_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_UnderscanState_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iUnderscanEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Underscan_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Underscan_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Underscan_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpCurrent, int* lpDefault, int* lpMin, int* lpMax, int* lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Underscan_Get(int iAdapterIndex, int iDisplayIndex, int* lpCurrent, int* lpDefault, int* lpMin, int* lpMax, int* lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Overscan_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Overscan_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Overscan_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefualt, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Overscan_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefualt, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_BaseAudioSupport_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_BaseAudioSupport_Get(int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_HDMISupport_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_HDMISupport_Get(int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_MVPUAnalogSupport_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_MVPUAnalogSupport_Get(int iAdapterIndex, int iDisplayIndex,int* lpSupport);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_PixelFormat_Caps(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpValidBits, int *lpValidCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_PixelFormat_Caps(int iAdapterIndex, int iDisplayIndex, int *lpValidBits, int *lpValidCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_PixelFormat_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurState, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_PixelFormat_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurState, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_PixelFormat_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_PixelFormat_Set(int iAdapterIndex, int iDisplayIndex, int iState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_GPUScalingEnable_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpSupport, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_GPUScalingEnable_Get(int iAdapterIndex, int iDisplayIndex, int *lpSupport, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_GPUScalingEnable_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_GPUScalingEnable_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_AllowOnlyCETimings_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpSupport, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_AllowOnlyCETimings_Get(int iAdapterIndex, int iDisplayIndex, int *lpSupport, int *lpCurrent, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_DFP_AllowOnlyCETimings_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_DFP_AllowOnlyCETimings_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_TVCaps_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpcaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_TVCaps_Get(int iAdapterIndex, int iDisplayIndex, int* lpcaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_TV_Standard_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_TV_Standard_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_TV_Standard_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int* lpSupportedStandards);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_TV_Standard_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int* lpSupportedStandards);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CV_DongleSettings_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* lpDongleSetting, int* lpOverrideSettingsSupported, int* lpCurOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_CV_DongleSettings_Get(int iAdapterIndex, int iDisplayIndex, int* lpDongleSetting, int* lpOverrideSettingsSupported, int* lpCurOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CV_DongleSettings_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_CV_DongleSettings_Set(int iAdapterIndex, int iDisplayIndex, int iOverrideSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CV_DongleSettings_Reset(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_CV_DongleSettings_Reset(int iAdapterIndex, int iDisplayIndex);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_UnderScan_Auto_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_UnderScan_Auto_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_UnderScan_Auto_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_UnderScan_Auto_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Deflicker_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Deflicker_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Deflicker_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayindex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Deflicker_Set(int iAdapterIndex, int iDisplayindex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FilterSVideo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FilterSVideo_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMin, int *lpMax, int *lpStep);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FilterSVideo_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FilterSVideo_Set(int iAdapterIndex, int iDisplayIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DisplayContent_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DisplayContent_Set(int iAdapterIndex, int iDisplayIndex, int iContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DisplayContent_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex,int iDisplayIndex,int* piContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DisplayContent_Get(int iAdapterIndex,int iDisplayIndex,int* piContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DisplayContent_Cap(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int* pCapContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DisplayContent_Cap(int iAdapterIndex, int iDisplayIndex, int* pCapContent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_TargetTiming_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_TargetTimingX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeInfoX2 *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_TargetTiming_Get(int iAdapterIndex, ADLDisplayID displayID, ADLDisplayModeInfo *lpModeInfoOut);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_Downscaling_Caps(int iAdapterIndex, int iDisplayID, int* lpCaps);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_Downscaling_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayID, int* lpCaps);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FreeSyncState_Get(int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMinRefreshRateInMicroHz, int *lpMaxRefreshRateInMicroHz);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FreeSyncState_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int *lpCurrent, int *lpDefault, int *lpMinRefreshRateInMicroHz, int *lpMaxRefreshRateInMicroHz);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FreeSyncState_Set(int iAdapterIndex, int iDisplayIndex, int iSetting, int iRefreshRateInMicroHz);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FreeSyncState_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDisplayIndex, int iSetting, int iRefreshRateInMicroHz);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DCE_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DCE_Set(int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DCE_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DCE_Get(int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_FreeSync_Cap(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLFreeSyncCap *lpFreeSyncCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_FreeSync_Cap(int iAdapterIndex, int iDisplayIndex, ADLFreeSyncCap *lpFreeSyncCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DCE_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DCE_Set(int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Display_DCE_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Display_DCE_Get(int iAdapterIndex, int iDisplayIndex, ADLDceSettings *lpADLDceSettings);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_CDS_UnsafeMode_Set(int iAdapterIndex, int unsafeMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CDS_UnsafeMode_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int unsafeMode);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_TurboSyncSupport_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* iTurboSyncSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_User_Settings_Notify(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_USER_SETTINGS iSetting, int iChanged);
|
||||
|
||||
#endif /* DISPLAY_H_ */
|
@ -1,85 +0,0 @@
|
||||
#ifndef OVERDRIVE5_H_
|
||||
#define OVERDRIVE5_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_CurrentActivity_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLPMActivity *lpActivity);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_CurrentActivity_Get(int iAdapterIndex, ADLPMActivity *lpActivity);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_ThermalDevices_Enum(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_ThermalDevices_Enum(int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_Temperature_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_Temperature_Get(int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_FanSpeedInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_FanSpeedInfo_Get(int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_FanSpeed_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_FanSpeed_Get(int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_FanSpeed_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_FanSpeed_Set(int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_FanSpeedToDefault_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iThermalControllerIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_FanSpeedToDefault_Set(int iAdapterIndex, int iThermalControllerIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_ODParameters_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLODParameters *lpOdParameters);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_ODParameters_Get(int iAdapterIndex, ADLODParameters *lpOdParameters);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_ODPerformanceLevels_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_ODPerformanceLevels_Get(int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_ODPerformanceLevels_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_ODPerformanceLevels_Set(int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_PowerControl_Caps(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpSupported);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_PowerControl_Caps(int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_PowerControlInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLPowerControlInfo *lpPowerControlInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_PowerControlInfo_Get(int iAdapterIndex, ADLPowerControlInfo *lpPowerControlInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_PowerControl_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_PowerControl_Get(int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive5_PowerControl_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive5_PowerControl_Set(int iAdapterIndex, int iValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive_Caps (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion );
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive_Caps (int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion );
|
||||
|
||||
|
||||
#endif /* OVERDRIVE5_H_ */
|
@ -1,164 +0,0 @@
|
||||
#ifndef OVERDRIVE6_H_
|
||||
#define OVERDRIVE6_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_Capabilities_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6Capabilities *lpODCapabilities);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_Capabilities_Get(int iAdapterIndex, ADLOD6Capabilities *lpODCapabilities);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_StateInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iStateType, ADLOD6StateInfo *lpStateInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_StateInfo_Get(int iAdapterIndex, int iStateType, ADLOD6StateInfo *lpStateInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_State_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iStateType, ADLOD6StateInfo *lpStateInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_State_Set(int iAdapterIndex, int iStateType, ADLOD6StateInfo *lpStateInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_State_Reset(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iStateType);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_State_Reset(int iAdapterIndex, int iStateType);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_CurrentStatus_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6CurrentStatus *lpCurrentStatus);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_CurrentStatus_Get(int iAdapterIndex, ADLOD6CurrentStatus *lpCurrentStatus);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_ThermalController_Caps(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6ThermalControllerCaps *lpThermalControllerCaps);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_ThermalController_Caps(int iAdapterIndex, ADLOD6ThermalControllerCaps *lpThermalControllerCaps);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_Temperature_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpTemperature);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_Temperature_Get(int iAdapterIndex, int *lpTemperature);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanSpeed_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanSpeed_Get(int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanSpeed_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanSpeed_Set(int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanSpeed_Reset(ADL_CONTEXT_HANDLE context,int iAdapterIndex);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanSpeed_Reset(int iAdapterIndex);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_PowerControl_Caps (ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpSupported);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_PowerControl_Caps (int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_PowerControlInfo_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, ADLOD6PowerControlInfo *lpPowerControlInfo);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_PowerControlInfo_Get(int iAdapterIndex, ADLOD6PowerControlInfo *lpPowerControlInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_PowerControl_Get(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_PowerControl_Get(int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_PowerControl_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_PowerControl_Set(int iAdapterIndex, int iValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_VoltageControlInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD6VoltageControlInfo *lpVoltageControlInfo);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_VoltageControlInfo_Get(int iAdapterIndex, ADLOD6VoltageControlInfo *lpVoltageControlInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_VoltageControl_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_VoltageControl_Get(int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_VoltageControl_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iValue);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_VoltageControl_Set(int iAdapterIndex, int iValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_CapabilitiesEx_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD6CapabilitiesEx *lpODCapabilities);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_CapabilitiesEx_Get(int iAdapterIndex, ADLOD6CapabilitiesEx *lpODCapabilities);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_StateEx_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iStateType, ADLOD6StateEx *lpODState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_StateEx_Get(int iAdapterIndex, int iStateType, ADLOD6StateEx *lpODState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_StateEx_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iStateType, ADLOD6StateEx *lpODState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_StateEx_Set(int iAdapterIndex, int iStateType, ADLOD6StateEx *lpODState);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_ThermalLimitUnlock_Set(int iAdapterIndex, int iStateType, int iEnable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_ThermalLimitUnlock_Set(ADL_CONTEXT_HANDLE context,int iAdapterIndex, int iStateType, int iEnable);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_ThermalLimitUnlock_Get(int iAdapterIndex, int iStateType, int* pEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_ThermalLimitUnlock_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iStateType, int* pEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_AdvancedFan_Caps (int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_AdvancedFan_Caps (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_TargetTemperatureRangeInfo_Get(int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_TargetTemperatureRangeInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_TargetTemperatureData_Get(int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_TargetTemperatureData_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_TargetTemperatureData_Set(int iAdapterIndex, int iCurrentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_TargetTemperatureData_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iCurrentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanPWMLimitRangeInfo_Get(int iAdapterIndex, ADLOD6ParameterRange *lpFanPWMLimitInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanPWMLimitRangeInfo_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD6ParameterRange *lpFanPWMLimitInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanPWMLimitData_Get(int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanPWMLimitData_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FanPWMLimitData_Set(int iAdapterIndex, int iCurrentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FanPWMLimitData_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iCurrentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_CurrentPower_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iPowerType, int *lpCurrentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_ControlI2C(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iControl);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive6_FuzzyController_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL_Overdrive6_FuzzyController_Caps(int iAdapterIndex, int *lpSupported);
|
||||
|
||||
|
||||
#endif /* OVERDRIVE6_H_ */
|
||||
|
@ -1,68 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
#ifndef OVERDRIVE8_H_
|
||||
#define OVERDRIVE8_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Init_Setting_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD8InitSetting *lpInitSetting);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Current_Setting_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD8CurrentSetting *lpCurrentSetting);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Setting_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLOD8SetSetting *lpSetSetting, ADLOD8CurrentSetting *lpCurrentSetting);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_New_QueryPMLogData_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLPMLogDataOutput* lpDataOutput);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Init_SettingX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpOverdrive8Capabilities, int *lpNumberOfFeatures, ADLOD8SingleInitSetting** lppInitSettingList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Current_SettingX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpNumberOfFeatures, int** lppCurrentSettingList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_AutoTuningResult_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, bool* lpDataOutput);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLogSenorRange_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpNumberOfSupportedSensorRange, ADLOD8SingleInitSetting** lppSenorRangeCapsList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLogSenorType_Support_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpNumOfSupportedSensorType, int** lppSenroTypesList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLog_ShareMemory_Support(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * lpSupported, int option);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLog_ShareMemory_Start(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iSampleRate, int iNumofPMLogSendorList, int* lpPMLogSendorList, ADL_D3DKMT_HANDLE* lpHDevice, void** lppSharedMemory, int iOption);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLog_ShareMemory_Read(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iNumSensor, int *lpSensorList, void** lppSharedMemory, ADLPMLogDataOutput* lpDataOutput);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_PMLog_ShareMemory_Stop(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_D3DKMT_HANDLE *lpHDevice);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Device_PMLog_Device_Create(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_D3DKMT_HANDLE *pDevice);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Device_PMLog_Device_Destroy(ADL_CONTEXT_HANDLE context, ADL_D3DKMT_HANDLE hDevice);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Overdrive8_Current_SettingX3_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpFeatureNotAdjustableBits, int *lpNumberOfSettings, int** lppCurrentSettingList, int iOption);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_PMLog_Support_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLPMLogSupportInfo* pPMLogSupportInfo);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_PMLog_Start(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLPMLogStartInput* pPMLogStartInput, ADLPMLogStartOutput* pPMLogStartOutput, ADL_D3DKMT_HANDLE hDevice);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_PMLog_Stop(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADL_D3DKMT_HANDLE hDevice);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_Adapter_PMLog_SensorLimits_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLPMLogSensorLimits* lpDataOutput);
|
||||
|
||||
|
||||
#endif /* OVERDRIVE8_H_ */
|
@ -1,90 +0,0 @@
|
||||
#ifndef OVERDRIVEN_H_
|
||||
#define OVERDRIVEN_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#ifndef ADL_EXTERNC
|
||||
#ifdef __cplusplus
|
||||
#define ADL_EXTERNC extern "C"
|
||||
#else
|
||||
#define ADL_EXTERNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXPOSED
|
||||
#define EXPOSED
|
||||
#endif /* EXPOSED */
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_Capabilities_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNCapabilities *lpODCapabilities);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_CapabilitiesX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNCapabilitiesX2 *lpODCapabilities);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SystemClocks_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevels *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SystemClocks_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevels *lpODPerformanceLevels);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SystemClocksX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevelsX2 *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SystemClocksX2_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevelsX2 *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryClocksX2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevelsX2 *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryClocksX2_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevelsX2 *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryClocks_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevels *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryClocks_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceLevels *lpODPerformanceLevels);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_FanControl_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNFanControl *lpODFanSpeed);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_FanControl_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNFanControl *lpODFanControl);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_PowerLimit_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPowerLimitSetting *lpODPowerLimit);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_PowerLimit_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPowerLimitSetting *lpODPowerLimit);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_Temperature_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iTemperatureType, int *iTemperature);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_PerformanceStatus_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNPerformanceStatus *lpODPerformanceStatus);
|
||||
|
||||
// Custom fan for WS ODN vega 10
|
||||
ADL_EXTERNC int EXPOSED ADL2_CustomFan_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CustomFan_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNFanControl *lpODFanControl);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_CustomFan_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLODNFanControl *lpODFanControl);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryTimingLevel_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupport, int *lpCurrentValue, int *lpDefaultValue, int *lpNumberLevels, int **lppLevelList);
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_MemoryTimingLevel_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int currentValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_ZeroRPMFan_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupport, int *lpCurrentValue, int *lpDefaultValue);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_ZeroRPMFan_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int currentValue);
|
||||
|
||||
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SettingsExt_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* lpOverdriveNExtCapabilities, int *lpNumberOfODNExtFeatures, ADLODNExtSingleInitSetting** lppInitSettingList, int** lppCurrentSettingList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SettingsExt_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iNumberOfODNExtFeatures,int* itemValueValidList, int* lpItemValueList);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_AutoWattman_Caps(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpSupported, int *lpDefault);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_AutoWattman_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_AutoWattman_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iCurrent);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_CountOfEvents_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int eventcounterType, int *eventCount);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SCLKAutoOverClock_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpStatus);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_SCLKAutoOverClock_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iStatus, int *iFlags);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_Test_Set(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iEnabled);
|
||||
|
||||
ADL_EXTERNC int EXPOSED ADL2_OverdriveN_ThrottleNotification_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpStatus, int *lpThrottleFlags);
|
||||
|
||||
|
||||
#endif /* OVERDRIVEN_H_ */
|
@ -1,6 +0,0 @@
|
||||
#include <cstddef>
|
||||
#include "adl.h"
|
||||
#include "overdrive5.h"
|
||||
#include "overdrive6.h"
|
||||
#include "overdriveN.h"
|
||||
#include "overdrive8.h"
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(non_snake_case)]
|
||||
#[allow(non_upper_case_globals)]
|
||||
mod adl;
|
||||
pub use adl::*;
|
@ -2,11 +2,9 @@
|
||||
name = "comgr"
|
||||
version = "0.0.0"
|
||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
libloading = "0.8"
|
||||
hip_common = { path = "../hip_common" }
|
||||
itertools = "0.10.5"
|
||||
amd_comgr-sys = { path = "../ext/amd_comgr-sys" }
|
@ -1 +0,0 @@
|
||||
bindgen .\include\amd_comgr.h --size_t-is-usize --must-use-type "amd_comgr_status_t" --no-layout-tests --no-derive-debug --default-enum-style=newtype --dynamic-loading LibComgr --dynamic-link-require-all -o src/amd_comgr.rs --whitelist-function="^amd_comgr_action_data_get_data$|^amd_comgr_action_info_set_isa_name$|^amd_comgr_action_info_set_option_list$|^amd_comgr_create_action_info$|^amd_comgr_create_data$|^amd_comgr_create_data_set$|^amd_comgr_data_set_add$|^amd_comgr_destroy_action_info$|^amd_comgr_destroy_data_set$|^amd_comgr_do_action$|^amd_comgr_get_data$|^amd_comgr_release_data$|^amd_comgr_set_data$|^amd_comgr_set_data_name$|^amd_comgr_action_info_set_language$|^amd_comgr_set_data_name$"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
|
||||
target triple = "amdgcn-amd-amdhsa"
|
||||
|
||||
@__zluda_ptx_impl__COMPILATION_MODE = linkonce_odr local_unnamed_addr addrspace(4) constant i8 3, align 1
|
768
comgr/src/lib.rs
768
comgr/src/lib.rs
@ -1,626 +1,186 @@
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(dead_code)]
|
||||
#[path = "amd_comgr.rs"]
|
||||
pub mod sys;
|
||||
use amd_comgr_sys::*;
|
||||
use std::{ffi::CStr, mem, ptr};
|
||||
|
||||
use hip_common::CompilationMode;
|
||||
use itertools::Either;
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
ffi::{CStr, CString},
|
||||
iter, mem, ptr,
|
||||
rc::Rc,
|
||||
sync::atomic::{AtomicU64, Ordering},
|
||||
};
|
||||
use sys::LibComgr;
|
||||
struct Data(amd_comgr_data_t);
|
||||
|
||||
#[cfg(windows)]
|
||||
static CODE_OBJECT_VERSION_FLAG_COMGR: &'static [u8] = b"code_object_v4\0"; // Code Object v5 is broken as of Adrenaline 23.11.1
|
||||
#[cfg(windows)]
|
||||
static CODE_OBJECT_VERSION_FLAG_CLANG: &'static [u8] = b"-mcode-object-version=4\0"; // Code Object v5 is broken as of Adrenaline 23.11.1
|
||||
#[cfg(not(windows))]
|
||||
static CODE_OBJECT_VERSION_FLAG_COMGR: &'static [u8] = b"code_object_v5\0";
|
||||
#[cfg(not(windows))]
|
||||
static CODE_OBJECT_VERSION_FLAG_CLANG: &'static [u8] = b"-mcode-object-version=5\0";
|
||||
|
||||
macro_rules! call {
|
||||
($expr:expr) => {
|
||||
#[allow(unused_unsafe)]
|
||||
{
|
||||
unsafe {
|
||||
let result = $expr;
|
||||
if result != sys::amd_comgr_status_t::AMD_COMGR_STATUS_SUCCESS {
|
||||
return Err(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, sys::amd_comgr_status_t>;
|
||||
|
||||
pub struct Comgr(LibComgr, AtomicU64);
|
||||
|
||||
static WAVE32_MODULE: &'static [u8] = include_bytes!("wave32.ll");
|
||||
static WAVE32_ON_WAVE64_MODULE: &'static [u8] = include_bytes!("wave32_on_wave64.ll");
|
||||
static DOUBLE_WAVE32_ON_WAVE64_MODULE: &'static [u8] = include_bytes!("double_wave32_on_wave64.ll");
|
||||
|
||||
#[cfg(windows)]
|
||||
static OS_MODULE: &'static [u8] = include_bytes!("windows.ll");
|
||||
#[cfg(not(windows))]
|
||||
static OS_MODULE: &'static [u8] = include_bytes!("linux.ll");
|
||||
|
||||
impl Comgr {
|
||||
pub fn find_and_load() -> Result<Self> {
|
||||
match unsafe { Self::load_library() } {
|
||||
Ok(libcomgr) => Ok(Self(libcomgr, AtomicU64::new(1))),
|
||||
Err(_) => Err(sys::amd_comgr_status_t::AMD_COMGR_STATUS_ERROR),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
unsafe fn load_library() -> std::result::Result<LibComgr, libloading::Error> {
|
||||
LibComgr::new("amd_comgr.dll")
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
unsafe fn load_library() -> std::result::Result<LibComgr, libloading::Error> {
|
||||
LibComgr::new("libamd_comgr.so.2")
|
||||
.or_else(|_| LibComgr::new("/opt/rocm/lib/libamd_comgr.so.2"))
|
||||
}
|
||||
|
||||
fn get(&self) -> &LibComgr {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn compile<'a>(
|
||||
&self,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
input_bitcode: impl Iterator<Item = (impl AsRef<[u8]>, impl AsRef<CStr>)>,
|
||||
linker_module: &[u8],
|
||||
) -> Result<Vec<u8>> {
|
||||
let bitcode = self.link_bitcode_impl(compilation_mode, isa, input_bitcode)?;
|
||||
let relocatable = self.build_relocatable_impl(compilation_mode, isa, &bitcode)?;
|
||||
if !linker_module.is_empty() {
|
||||
let source = self.assemble_source(isa, linker_module)?;
|
||||
self.link_relocatable_impl(
|
||||
isa,
|
||||
IntoIterator::into_iter([
|
||||
&relocatable.get_data(
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
0,
|
||||
)?,
|
||||
&source,
|
||||
]),
|
||||
)
|
||||
} else {
|
||||
self.link_relocatable_impl(
|
||||
isa,
|
||||
iter::once(&relocatable.get_data(
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
0,
|
||||
)?),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn link_bitcode<'this, 'a>(
|
||||
&'this self,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
input_bitcode: impl Iterator<Item = (impl AsRef<[u8]>, &'a CStr)>,
|
||||
) -> Result<Bitcode<'this>> {
|
||||
let data_set_bitcode = self.link_bitcode_impl(compilation_mode, isa, input_bitcode)?;
|
||||
Ok(Bitcode(data_set_bitcode))
|
||||
}
|
||||
|
||||
pub fn bitcode_to_relocatable<'a>(
|
||||
self: &Rc<Self>,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
bc: &Bitcode,
|
||||
) -> Result<Relocatable> {
|
||||
let data_set_relocatable = self.build_relocatable_impl(compilation_mode, isa, &bc.0)?;
|
||||
Ok(Relocatable::from_data(data_set_relocatable.get_data_rc(
|
||||
self.clone(),
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
0,
|
||||
)?)?)
|
||||
}
|
||||
|
||||
pub fn build_relocatable<'a>(
|
||||
self: &Rc<Self>,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
input_bitcode: impl Iterator<Item = (impl AsRef<[u8]>, &'a CStr)>,
|
||||
) -> Result<Relocatable> {
|
||||
let bitcode = self.link_bitcode_impl(compilation_mode, isa, input_bitcode)?;
|
||||
let data_set_relocatable = self.build_relocatable_impl(compilation_mode, isa, &bitcode)?;
|
||||
Ok(Relocatable::from_data(data_set_relocatable.get_data_rc(
|
||||
self.clone(),
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
0,
|
||||
)?)?)
|
||||
}
|
||||
|
||||
pub fn link_relocatable<'a>(
|
||||
self: &Rc<Self>,
|
||||
isa: &'a CStr,
|
||||
modules: impl Iterator<Item = &'a Relocatable>,
|
||||
) -> Result<Vec<u8>> {
|
||||
self.link_relocatable_impl(isa, modules.map(|reloc| &reloc.0))
|
||||
}
|
||||
|
||||
pub fn version(&self) -> Result<String> {
|
||||
let mut data_set = DataSet::new(self)?;
|
||||
let data = Data::new(
|
||||
self,
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_SOURCE,
|
||||
b"__VERSION__",
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"version.h\0") },
|
||||
)?;
|
||||
data_set.add(&data)?;
|
||||
let result = self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR,
|
||||
&data_set,
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"\0") },
|
||||
iter::once(unsafe { CStr::from_bytes_with_nul_unchecked(b"-nogpuinc\0") }),
|
||||
Some(sys::amd_comgr_language_t::AMD_COMGR_LANGUAGE_HIP),
|
||||
)?;
|
||||
let result = result.get_data(sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_SOURCE, 0)?;
|
||||
let result = result.get_data()?;
|
||||
let end_quote = result
|
||||
.iter()
|
||||
.copied()
|
||||
.rposition(|c| c as char == '"')
|
||||
.ok_or(sys::amd_comgr_status_t::AMD_COMGR_STATUS_ERROR)?;
|
||||
let start_quote = result[..end_quote]
|
||||
.iter()
|
||||
.copied()
|
||||
.rposition(|c| c as char == '"')
|
||||
.ok_or(sys::amd_comgr_status_t::AMD_COMGR_STATUS_ERROR)?;
|
||||
String::from_utf8(result[start_quote + 1..end_quote].to_vec())
|
||||
.map_err(|_| sys::amd_comgr_status_t::AMD_COMGR_STATUS_ERROR)
|
||||
}
|
||||
|
||||
fn link_bitcode_impl<'this, 'a>(
|
||||
&'this self,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
input_bitcode: impl Iterator<Item = (impl AsRef<[u8]>, impl AsRef<CStr>)>,
|
||||
) -> Result<DataSet<'this>> {
|
||||
let mut bitcode_modules = DataSet::new(self)?;
|
||||
for (bc, name) in input_bitcode {
|
||||
bitcode_modules.add(&Data::new(
|
||||
self,
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC,
|
||||
bc.as_ref(),
|
||||
name.as_ref(),
|
||||
)?)?;
|
||||
}
|
||||
let wave_module_text = match compilation_mode {
|
||||
CompilationMode::Wave32 => WAVE32_MODULE,
|
||||
CompilationMode::Wave32OnWave64 => WAVE32_ON_WAVE64_MODULE,
|
||||
CompilationMode::DoubleWave32OnWave64 => DOUBLE_WAVE32_ON_WAVE64_MODULE,
|
||||
};
|
||||
let wave_module = Data::new(
|
||||
self,
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC,
|
||||
wave_module_text,
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"wave.ll\0") },
|
||||
)?;
|
||||
bitcode_modules.add(&wave_module)?;
|
||||
let os_module = Data::new(
|
||||
self,
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC,
|
||||
OS_MODULE,
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"os.ll\0") },
|
||||
)?;
|
||||
bitcode_modules.add(&os_module)?;
|
||||
let lib_options = unsafe {
|
||||
match compilation_mode {
|
||||
CompilationMode::Wave32 => Either::Left([CStr::from_bytes_with_nul_unchecked(
|
||||
CODE_OBJECT_VERSION_FLAG_COMGR,
|
||||
)]),
|
||||
CompilationMode::Wave32OnWave64 | CompilationMode::DoubleWave32OnWave64 => {
|
||||
Either::Right([
|
||||
CStr::from_bytes_with_nul_unchecked(CODE_OBJECT_VERSION_FLAG_COMGR),
|
||||
CStr::from_bytes_with_nul_unchecked(b"wavefrontsize64\0"),
|
||||
])
|
||||
}
|
||||
}
|
||||
};
|
||||
let device_linking_output: DataSet<'_> = self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES,
|
||||
&bitcode_modules,
|
||||
isa,
|
||||
lib_options.into_iter(),
|
||||
Some(sys::amd_comgr_language_t::AMD_COMGR_LANGUAGE_OPENCL_2_0),
|
||||
)?;
|
||||
self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_BC_TO_BC,
|
||||
&device_linking_output,
|
||||
isa,
|
||||
unsafe {
|
||||
[CStr::from_bytes_with_nul_unchecked(
|
||||
CODE_OBJECT_VERSION_FLAG_COMGR,
|
||||
)]
|
||||
.iter()
|
||||
.copied()
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn build_relocatable_impl<'this, 'a>(
|
||||
&'this self,
|
||||
compilation_mode: CompilationMode,
|
||||
isa: &'a CStr,
|
||||
bc_linking_output: &DataSet<'this>,
|
||||
) -> Result<DataSet<'this>> {
|
||||
let debug_level = if cfg!(debug_assertions) {
|
||||
unsafe {
|
||||
[
|
||||
CStr::from_bytes_with_nul_unchecked(b"-g\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"\0"),
|
||||
]
|
||||
}
|
||||
} else {
|
||||
unsafe {
|
||||
[
|
||||
CStr::from_bytes_with_nul_unchecked(b"-g0\0"),
|
||||
// TODO: tweak and measure impact
|
||||
CStr::from_bytes_with_nul_unchecked(b"-mllvm\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"-inline-threshold=5000\0"),
|
||||
]
|
||||
}
|
||||
};
|
||||
let compilation_mode = unsafe {
|
||||
if compilation_mode == CompilationMode::Wave32 {
|
||||
CStr::from_bytes_with_nul_unchecked(b"-mno-wavefrontsize64\0")
|
||||
} else {
|
||||
CStr::from_bytes_with_nul_unchecked(b"-mwavefrontsize64\0")
|
||||
}
|
||||
};
|
||||
let relocatable = self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE,
|
||||
bc_linking_output,
|
||||
isa,
|
||||
unsafe {
|
||||
[
|
||||
compilation_mode,
|
||||
CStr::from_bytes_with_nul_unchecked(CODE_OBJECT_VERSION_FLAG_CLANG),
|
||||
CStr::from_bytes_with_nul_unchecked(b"-O3\0"),
|
||||
// TODO: measure more
|
||||
// Slightly more efficient in Blender
|
||||
CStr::from_bytes_with_nul_unchecked(b"-mcumode\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"-ffp-contract=off\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"-mllvm\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"-amdgpu-internalize-symbols\0"),
|
||||
// TODO: This emits scratch_ instead of buffer_ instructions
|
||||
// for stack spills&fills, measure impact
|
||||
// CStr::from_bytes_with_nul_unchecked(b"-Xclang\0"),
|
||||
// CStr::from_bytes_with_nul_unchecked(b"-target-feature\0"),
|
||||
// CStr::from_bytes_with_nul_unchecked(b"-Xclang\0"),
|
||||
// CStr::from_bytes_with_nul_unchecked(b"+enable-flat-scratch\0"),
|
||||
// Useful for debugging miscompilations
|
||||
// CStr::from_bytes_with_nul_unchecked(b"-mllvm\0"),
|
||||
// CStr::from_bytes_with_nul_unchecked(b"-opt-bisect-limit=-1\0"),
|
||||
]
|
||||
}
|
||||
.iter()
|
||||
.copied()
|
||||
.chain(debug_level.iter().copied()),
|
||||
None,
|
||||
)?;
|
||||
Ok(relocatable)
|
||||
}
|
||||
|
||||
fn link_relocatable_impl<'this, 'a, C: Borrow<Comgr> + 'a>(
|
||||
&'this self,
|
||||
isa: &'a CStr,
|
||||
modules: impl Iterator<Item = &'a Data<C>>,
|
||||
) -> Result<Vec<u8>> {
|
||||
let mut input = DataSet::new(self)?;
|
||||
for module in modules {
|
||||
input.add(module)?;
|
||||
}
|
||||
let executable_set: DataSet = self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE,
|
||||
&input,
|
||||
isa,
|
||||
unsafe {
|
||||
[
|
||||
CStr::from_bytes_with_nul_unchecked(b"-Xlinker\0"),
|
||||
CStr::from_bytes_with_nul_unchecked(b"--no-undefined\0"),
|
||||
]
|
||||
}
|
||||
.iter()
|
||||
.copied(),
|
||||
None,
|
||||
)?;
|
||||
let executable_data = executable_set.get_data(
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_EXECUTABLE,
|
||||
0,
|
||||
)?;
|
||||
executable_data.get_data()
|
||||
}
|
||||
|
||||
fn assemble_source(&self, isa: &CStr, src: &[u8]) -> Result<Data<&Self>> {
|
||||
let data = Data::new(
|
||||
self,
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_SOURCE,
|
||||
src,
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"input.s\0") },
|
||||
)?;
|
||||
let mut data_set = DataSet::new(self)?;
|
||||
data_set.add(&data)?;
|
||||
let assembled = self.do_action(
|
||||
sys::amd_comgr_action_kind_t::AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE,
|
||||
&data_set,
|
||||
isa,
|
||||
iter::once(unsafe {
|
||||
CStr::from_bytes_with_nul_unchecked(CODE_OBJECT_VERSION_FLAG_CLANG)
|
||||
}),
|
||||
None,
|
||||
)?;
|
||||
assembled.get_data(
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
0,
|
||||
)
|
||||
}
|
||||
|
||||
fn do_action<'a, 'cstr>(
|
||||
&'a self,
|
||||
kind: sys::amd_comgr_action_kind_t,
|
||||
input: &DataSet,
|
||||
isa: &CStr,
|
||||
options: impl Iterator<Item = &'cstr CStr>,
|
||||
language: Option<sys::amd_comgr_language_t>,
|
||||
) -> Result<DataSet<'a>> {
|
||||
let output = DataSet::new(self)?;
|
||||
let action = ActionInfo::new(self, isa)?;
|
||||
if options.size_hint().1.unwrap() > 0 {
|
||||
action.set_options(options)?;
|
||||
}
|
||||
if let Some(lang) = language {
|
||||
action.set_language(lang)?;
|
||||
}
|
||||
action.execute(kind, &input, &output)?;
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Bitcode<'a>(DataSet<'a>);
|
||||
|
||||
impl<'a> Bitcode<'a> {
|
||||
pub fn get_data(&self) -> Result<Vec<u8>> {
|
||||
self.0
|
||||
.get_data(sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC, 0)?
|
||||
.get_data()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Relocatable(Data<Rc<Comgr>>);
|
||||
|
||||
impl Relocatable {
|
||||
fn from_data(data: Data<Rc<Comgr>>) -> Result<Self> {
|
||||
let suffix = data.1 .1.fetch_add(1, Ordering::Relaxed);
|
||||
let new_name = format!("reloc_{}.o\0", suffix);
|
||||
call!(data
|
||||
.1
|
||||
.get()
|
||||
.amd_comgr_set_data_name(data.0, new_name.as_ptr() as _));
|
||||
Ok(Self(data))
|
||||
}
|
||||
|
||||
pub fn new(comgr: &Rc<Comgr>, vec: &[u8]) -> Result<Self> {
|
||||
let suffix = comgr.1.fetch_add(1, Ordering::Relaxed);
|
||||
let new_name = format!("reloc_{}.o", suffix);
|
||||
let data = Data::new(
|
||||
comgr.clone(),
|
||||
sys::amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_RELOCATABLE,
|
||||
vec,
|
||||
&CString::new(new_name).map_err(|_| sys::amd_comgr_status_t::AMD_COMGR_STATUS_ERROR)?,
|
||||
)?;
|
||||
Ok(Self(data))
|
||||
}
|
||||
|
||||
pub fn get_data(&self) -> Result<Vec<u8>> {
|
||||
self.0.get_data()
|
||||
}
|
||||
}
|
||||
|
||||
struct ActionInfo<'a>(sys::amd_comgr_action_info_t, &'a Comgr);
|
||||
|
||||
impl<'a> ActionInfo<'a> {
|
||||
fn new(comgr: &'a Comgr, isa: &'a CStr) -> Result<Self> {
|
||||
unsafe {
|
||||
let mut action_info = mem::zeroed();
|
||||
call!(comgr.get().amd_comgr_create_action_info(&mut action_info));
|
||||
call!(comgr
|
||||
.get()
|
||||
.amd_comgr_action_info_set_isa_name(action_info, isa.as_ptr() as _));
|
||||
Ok(ActionInfo(action_info, comgr))
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self) -> sys::amd_comgr_action_info_t {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn set_options<'cstr>(&self, options: impl Iterator<Item = &'cstr CStr>) -> Result<()> {
|
||||
let mut options_c = options.map(CStr::as_ptr).collect::<Vec<_>>();
|
||||
call!(self.1.get().amd_comgr_action_info_set_option_list(
|
||||
self.get(),
|
||||
options_c.as_mut_ptr(),
|
||||
options_c.len()
|
||||
));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_language(&self, lang: sys::amd_comgr_language_t) -> Result<()> {
|
||||
call!(self
|
||||
.1
|
||||
.get()
|
||||
.amd_comgr_action_info_set_language(self.get(), lang));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn execute(
|
||||
&self,
|
||||
kind: sys::amd_comgr_action_kind_t,
|
||||
input: &DataSet<'a>,
|
||||
output: &DataSet<'a>,
|
||||
) -> Result<()> {
|
||||
call!(self
|
||||
.1
|
||||
.get()
|
||||
.amd_comgr_do_action(kind, self.get(), input.get(), output.get()));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_must_use)]
|
||||
impl<'a> Drop for ActionInfo<'a> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.1.get().amd_comgr_destroy_action_info(self.get()) };
|
||||
}
|
||||
}
|
||||
|
||||
struct DataSet<'a> {
|
||||
base: sys::amd_comgr_data_set_t,
|
||||
comgr: &'a Comgr,
|
||||
}
|
||||
|
||||
impl<'a> DataSet<'a> {
|
||||
fn new(comgr: &'a Comgr) -> Result<DataSet<'a>> {
|
||||
unsafe {
|
||||
let mut base = mem::zeroed();
|
||||
call!(comgr.get().amd_comgr_create_data_set(&mut base));
|
||||
Ok(DataSet { base, comgr })
|
||||
}
|
||||
}
|
||||
|
||||
fn add<C: Borrow<Comgr>>(&mut self, data: &Data<C>) -> Result<()> {
|
||||
call!(self
|
||||
.comgr
|
||||
.get()
|
||||
.amd_comgr_data_set_add(self.base, data.get()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_data(&self, kind: sys::amd_comgr_data_kind_t, index: usize) -> Result<Data<&'a Comgr>> {
|
||||
let mut output = unsafe { mem::zeroed() };
|
||||
call!(self.comgr.get().amd_comgr_action_data_get_data(
|
||||
self.get(),
|
||||
kind,
|
||||
index,
|
||||
&mut output
|
||||
));
|
||||
Ok(Data(output, self.comgr))
|
||||
}
|
||||
|
||||
fn get_data_rc(
|
||||
&self,
|
||||
comgr: Rc<Comgr>,
|
||||
kind: sys::amd_comgr_data_kind_t,
|
||||
index: usize,
|
||||
) -> Result<Data<Rc<Comgr>>> {
|
||||
assert!(std::ptr::eq::<Comgr>(self.comgr as *const _, &*comgr));
|
||||
let mut output = unsafe { mem::zeroed() };
|
||||
call!(self.comgr.get().amd_comgr_action_data_get_data(
|
||||
self.get(),
|
||||
kind,
|
||||
index,
|
||||
&mut output
|
||||
));
|
||||
Ok(Data(output, comgr))
|
||||
}
|
||||
|
||||
fn get(&self) -> sys::amd_comgr_data_set_t {
|
||||
self.base
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_must_use)]
|
||||
impl<'a> Drop for DataSet<'a> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.comgr.get().amd_comgr_destroy_data_set(self.get()) };
|
||||
}
|
||||
}
|
||||
|
||||
struct Data<C: Borrow<Comgr>>(sys::amd_comgr_data_t, C);
|
||||
|
||||
impl<C: Borrow<Comgr>> Data<C> {
|
||||
impl Data {
|
||||
fn new(
|
||||
comgr: C,
|
||||
kind: sys::amd_comgr_data_kind_t,
|
||||
data: &[u8],
|
||||
kind: amd_comgr_data_kind_t,
|
||||
name: &CStr,
|
||||
) -> Result<Data<C>> {
|
||||
let mut comgr_data = unsafe { mem::zeroed() };
|
||||
call!(comgr
|
||||
.borrow()
|
||||
.get()
|
||||
.amd_comgr_create_data(kind, &mut comgr_data));
|
||||
call!(comgr
|
||||
.borrow()
|
||||
.get()
|
||||
.amd_comgr_set_data_name(comgr_data, name.as_ptr() as _));
|
||||
call!(comgr
|
||||
.borrow()
|
||||
.get()
|
||||
.amd_comgr_set_data(comgr_data, data.len(), data.as_ptr() as _));
|
||||
Ok(Self(comgr_data, comgr))
|
||||
content: &[u8],
|
||||
) -> Result<Self, amd_comgr_status_s> {
|
||||
let mut data = unsafe { mem::zeroed() };
|
||||
unsafe { amd_comgr_create_data(kind, &mut data) }?;
|
||||
unsafe { amd_comgr_set_data_name(data, name.as_ptr()) }?;
|
||||
unsafe { amd_comgr_set_data(data, content.len(), content.as_ptr().cast()) }?;
|
||||
Ok(Self(data))
|
||||
}
|
||||
|
||||
fn get(&self) -> sys::amd_comgr_data_t {
|
||||
fn get(&self) -> amd_comgr_data_t {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn get_data(&self) -> Result<Vec<u8>> {
|
||||
let mut size = 0;
|
||||
call!(self
|
||||
.1
|
||||
.borrow()
|
||||
.get()
|
||||
.amd_comgr_get_data(self.get(), &mut size, ptr::null_mut()));
|
||||
let mut output = vec![0u8; size];
|
||||
call!(self.1.borrow().get().amd_comgr_get_data(
|
||||
self.get(),
|
||||
&mut size,
|
||||
output.as_mut_ptr() as _
|
||||
));
|
||||
Ok(output)
|
||||
fn copy_content(&self) -> Result<Vec<u8>, amd_comgr_status_s> {
|
||||
let mut size = unsafe { mem::zeroed() };
|
||||
unsafe { amd_comgr_get_data(self.get(), &mut size, ptr::null_mut()) }?;
|
||||
let mut result: Vec<u8> = Vec::with_capacity(size);
|
||||
unsafe { result.set_len(size) };
|
||||
unsafe { amd_comgr_get_data(self.get(), &mut size, result.as_mut_ptr().cast()) }?;
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Borrow<Comgr> + Clone> Clone for Data<C> {
|
||||
fn clone(&self) -> Self {
|
||||
Self(self.0.clone(), self.1.clone())
|
||||
struct DataSet(amd_comgr_data_set_t);
|
||||
|
||||
impl DataSet {
|
||||
fn new() -> Result<Self, amd_comgr_status_s> {
|
||||
let mut data_set = unsafe { mem::zeroed() };
|
||||
unsafe { amd_comgr_create_data_set(&mut data_set) }?;
|
||||
Ok(Self(data_set))
|
||||
}
|
||||
|
||||
fn add(&self, data: &Data) -> Result<(), amd_comgr_status_s> {
|
||||
unsafe { amd_comgr_data_set_add(self.get(), data.get()) }
|
||||
}
|
||||
|
||||
fn get(&self) -> amd_comgr_data_set_t {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn get_data(
|
||||
&self,
|
||||
kind: amd_comgr_data_kind_t,
|
||||
index: usize,
|
||||
) -> Result<Data, amd_comgr_status_s> {
|
||||
let mut data = unsafe { mem::zeroed() };
|
||||
unsafe { amd_comgr_action_data_get_data(self.get(), kind, index, &mut data) }?;
|
||||
Ok(Data(data))
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_must_use)]
|
||||
impl<C: Borrow<Comgr>> Drop for Data<C> {
|
||||
impl Drop for DataSet {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.1.borrow().get().amd_comgr_release_data(self.get()) };
|
||||
unsafe { amd_comgr_destroy_data_set(self.get()).ok() };
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::Comgr;
|
||||
struct ActionInfo(amd_comgr_action_info_t);
|
||||
|
||||
#[test]
|
||||
fn version() {
|
||||
let comgr = Comgr::find_and_load().unwrap();
|
||||
let version = comgr.version().unwrap();
|
||||
assert!(version.contains("Clang"));
|
||||
assert!(!version.contains("\""));
|
||||
assert!(!version.contains("\n"));
|
||||
impl ActionInfo {
|
||||
fn new() -> Result<Self, amd_comgr_status_s> {
|
||||
let mut action = unsafe { mem::zeroed() };
|
||||
unsafe { amd_comgr_create_action_info(&mut action) }?;
|
||||
Ok(Self(action))
|
||||
}
|
||||
|
||||
fn set_isa_name(&self, isa: &CStr) -> Result<(), amd_comgr_status_s> {
|
||||
let mut full_isa = "amdgcn-amd-amdhsa--".to_string().into_bytes();
|
||||
full_isa.extend(isa.to_bytes_with_nul());
|
||||
unsafe { amd_comgr_action_info_set_isa_name(self.get(), full_isa.as_ptr().cast()) }
|
||||
}
|
||||
|
||||
fn set_language(&self, language: amd_comgr_language_t) -> Result<(), amd_comgr_status_s> {
|
||||
unsafe { amd_comgr_action_info_set_language(self.get(), language) }
|
||||
}
|
||||
|
||||
fn set_options<'a>(
|
||||
&self,
|
||||
options: impl Iterator<Item = &'a CStr>,
|
||||
) -> Result<(), amd_comgr_status_s> {
|
||||
let options = options.map(|x| x.as_ptr()).collect::<Vec<_>>();
|
||||
unsafe {
|
||||
amd_comgr_action_info_set_option_list(
|
||||
self.get(),
|
||||
options.as_ptr().cast_mut(),
|
||||
options.len(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self) -> amd_comgr_action_info_t {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ActionInfo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { amd_comgr_destroy_action_info(self.get()).ok() };
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compile_bitcode(
|
||||
gcn_arch: &CStr,
|
||||
main_buffer: &[u8],
|
||||
ptx_impl: &[u8],
|
||||
) -> Result<Vec<u8>, amd_comgr_status_s> {
|
||||
use amd_comgr_sys::*;
|
||||
let bitcode_data_set = DataSet::new()?;
|
||||
let main_bitcode_data = Data::new(
|
||||
amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC,
|
||||
c"zluda.bc",
|
||||
main_buffer,
|
||||
)?;
|
||||
bitcode_data_set.add(&main_bitcode_data)?;
|
||||
let stdlib_bitcode_data = Data::new(
|
||||
amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC,
|
||||
c"ptx_impl.bc",
|
||||
ptx_impl,
|
||||
)?;
|
||||
bitcode_data_set.add(&stdlib_bitcode_data)?;
|
||||
let linking_info = ActionInfo::new()?;
|
||||
let linked_data_set = do_action(
|
||||
&bitcode_data_set,
|
||||
&linking_info,
|
||||
amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_BC_TO_BC,
|
||||
)?;
|
||||
let compile_to_exec = ActionInfo::new()?;
|
||||
compile_to_exec.set_isa_name(gcn_arch)?;
|
||||
compile_to_exec.set_language(amd_comgr_language_t::AMD_COMGR_LANGUAGE_LLVM_IR)?;
|
||||
let common_options = [
|
||||
// This makes no sense, but it makes ockl linking work
|
||||
c"-Xclang",
|
||||
c"-mno-link-builtin-bitcode-postopt",
|
||||
// Otherwise LLVM omits dynamic fp mode for ockl functions during linking
|
||||
// and then fails to inline them
|
||||
c"-Xclang",
|
||||
c"-fdenormal-fp-math=dynamic",
|
||||
c"-O3",
|
||||
c"-mno-wavefrontsize64",
|
||||
c"-mcumode",
|
||||
// Useful for inlining reports, combined with AMD_COMGR_SAVE_TEMPS=1 AMD_COMGR_EMIT_VERBOSE_LOGS=1 AMD_COMGR_REDIRECT_LOGS=stderr
|
||||
// c"-fsave-optimization-record=yaml",
|
||||
]
|
||||
.into_iter();
|
||||
let opt_options = if cfg!(debug_assertions) {
|
||||
//[c"-g", c"-mllvm", c"-print-before-all", c"", c""]
|
||||
[c"-g", c"", c"", c"", c""]
|
||||
} else {
|
||||
[
|
||||
c"-g0",
|
||||
// default inlining threshold times 10
|
||||
c"-mllvm",
|
||||
c"-inline-threshold=2250",
|
||||
c"-mllvm",
|
||||
c"-inlinehint-threshold=3250",
|
||||
]
|
||||
};
|
||||
compile_to_exec.set_options(common_options.chain(opt_options))?;
|
||||
let exec_data_set = do_action(
|
||||
&linked_data_set,
|
||||
&compile_to_exec,
|
||||
amd_comgr_action_kind_t::AMD_COMGR_ACTION_COMPILE_SOURCE_TO_EXECUTABLE,
|
||||
)?;
|
||||
let executable =
|
||||
exec_data_set.get_data(amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_EXECUTABLE, 0)?;
|
||||
executable.copy_content()
|
||||
}
|
||||
|
||||
fn do_action(
|
||||
data_set: &DataSet,
|
||||
action: &ActionInfo,
|
||||
kind: amd_comgr_action_kind_t,
|
||||
) -> Result<DataSet, amd_comgr_status_s> {
|
||||
let result = DataSet::new()?;
|
||||
unsafe { amd_comgr_do_action(kind, action.get(), data_set.get(), result.get()) }?;
|
||||
Ok(result)
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
|
||||
target triple = "amdgcn-amd-amdhsa"
|
||||
|
||||
@__zluda_ptx_impl__IS_WINDOWS = linkonce_odr local_unnamed_addr addrspace(4) constant i1 0
|
@ -1,4 +0,0 @@
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
|
||||
target triple = "amdgcn-amd-amdhsa"
|
||||
|
||||
@__zluda_ptx_impl__COMPILATION_MODE = linkonce_odr local_unnamed_addr addrspace(4) constant i8 1, align 1
|
@ -1,4 +0,0 @@
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
|
||||
target triple = "amdgcn-amd-amdhsa"
|
||||
|
||||
@__zluda_ptx_impl__COMPILATION_MODE = linkonce_odr local_unnamed_addr addrspace(4) constant i8 2, align 1
|
@ -1,4 +0,0 @@
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
|
||||
target triple = "amdgcn-amd-amdhsa"
|
||||
|
||||
@__zluda_ptx_impl__IS_WINDOWS = linkonce_odr local_unnamed_addr addrspace(4) constant i1 1
|
@ -2,13 +2,13 @@
|
||||
name = "cuda_base"
|
||||
version = "0.0.0"
|
||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
quote = "1.0"
|
||||
syn = { version = "1.0.93", features = ["full", "visit", "visit-mut"] }
|
||||
syn = { version = "2.0", features = ["full", "visit-mut", "extra-traits"] }
|
||||
proc-macro2 = "1.0"
|
||||
rustc-hash = "1.1"
|
||||
rustc-hash = "1.1.0"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
@ -1 +0,0 @@
|
||||
bindgen build/wrapper.h -o src/cuda.rs --no-partialeq "CUDA_HOST_NODE_PARAMS_st" --no-partialeq "CUDA_HOST_NODE_PARAMS_v2_st" --with-derive-eq --allowlist-function="^cu.*" --allowlist-var="^CU.*" --default-enum-style=newtype --no-layout-tests --no-doc-comments --new-type-alias "^CUdevice_v\d+$|^CUdeviceptr_v\d+$" --must-use-type "cudaError_enum" -- -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include"
|
@ -1,7 +1,7 @@
|
||||
#define __CUDA_API_VERSION_INTERNAL
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <cuda.h>
|
||||
#include <cudaGL.h>
|
||||
#include <cudaProfiler.h>
|
||||
#include <cudaGL.h>
|
||||
#include <cudaEGL.h>
|
||||
#include <vdpau/vdpau.h>
|
||||
#include <cudaVDPAU.h>
|
||||
|
27645
cuda_base/src/cuda.rs
27645
cuda_base/src/cuda.rs
File diff suppressed because it is too large
Load Diff
@ -2,157 +2,23 @@ extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::Span;
|
||||
use quote::{format_ident, quote, ToTokens};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use std::collections::hash_map;
|
||||
use quote::{quote, ToTokens};
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::iter;
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::visit::Visit;
|
||||
use syn::visit_mut::VisitMut;
|
||||
use syn::{
|
||||
bracketed, parse_macro_input, Abi, Fields, File, FnArg, ForeignItem, ForeignItemFn, Ident,
|
||||
Item, ItemEnum, ItemForeignMod, ItemStruct, ItemUnion, LitStr, PatType, Path, PathArguments,
|
||||
PathSegment, ReturnType, Signature, Token, Type, TypeArray, TypePath, TypePtr,
|
||||
bracketed, parse_macro_input, File, ForeignItem, ForeignItemFn, Ident, Item, Path, Signature,
|
||||
Token,
|
||||
};
|
||||
|
||||
const CUDA_RS: &'static str = include_str! {"cuda.rs"};
|
||||
|
||||
// This macro copies cuda.rs as-is with some changes:
|
||||
// * All function declarations are filtered out
|
||||
// * CUdeviceptr_v2 is redefined from `unsigned long long` to `*void`
|
||||
// * `extern "C"` gets replaced by `extern "system"`
|
||||
// * CUuuid_st is redefined to use uchar instead of char
|
||||
// * Every type except anything graph-related is marked as Send and Sync
|
||||
// TODO: Improve Send/Sync generation. Currently types that are defined as
|
||||
// pointers (which is 99% of useful types) can't be marked as Send&Sync
|
||||
// Their definition should be changed to newtype with a null() function
|
||||
// and all code should be updated accordingly
|
||||
#[proc_macro]
|
||||
pub fn cuda_type_declarations(_: TokenStream) -> TokenStream {
|
||||
let mut cuda_module = syn::parse_str::<File>(CUDA_RS).unwrap();
|
||||
cuda_module.items = cuda_module
|
||||
.items
|
||||
.into_iter()
|
||||
.filter_map(|item| match item {
|
||||
Item::ForeignMod(_) => None,
|
||||
Item::Struct(mut struct_) => {
|
||||
if "CUdeviceptr_v2" == struct_.ident.to_string() {
|
||||
match &mut struct_.fields {
|
||||
Fields::Unnamed(ref mut fields) => {
|
||||
fields.unnamed[0].ty =
|
||||
absolute_path_to_mut_ptr(&["std", "os", "raw", "c_void"])
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
} else if "CUuuid_st" == struct_.ident.to_string() {
|
||||
match &mut struct_.fields {
|
||||
Fields::Named(ref mut fields) => match fields.named[0].ty {
|
||||
Type::Array(TypeArray { ref mut elem, .. }) => {
|
||||
*elem = Box::new(Type::Path(TypePath {
|
||||
qself: None,
|
||||
path: segments_to_path(&["std", "os", "raw", "c_uchar"]),
|
||||
}))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
Some(Item::Struct(struct_))
|
||||
}
|
||||
i => Some(i),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
mark_types_as_send_sync(&mut cuda_module);
|
||||
syn::visit_mut::visit_file_mut(&mut FixAbi, &mut cuda_module);
|
||||
cuda_module.into_token_stream().into()
|
||||
}
|
||||
|
||||
fn mark_types_as_send_sync(cuda_module: &mut File) {
|
||||
let mut types_for_send_sync = CollectTypesForSendSync { types: Vec::new() };
|
||||
syn::visit::visit_file(&mut types_for_send_sync, &cuda_module);
|
||||
for type_ in types_for_send_sync.types {
|
||||
let send: Item = syn::parse_quote! {
|
||||
unsafe impl Send for #type_ {}
|
||||
};
|
||||
cuda_module.items.push(send);
|
||||
let sync: Item = syn::parse_quote! {
|
||||
unsafe impl Sync for #type_ {}
|
||||
};
|
||||
cuda_module.items.push(sync);
|
||||
}
|
||||
}
|
||||
|
||||
fn segments_to_path(path: &[&'static str]) -> Path {
|
||||
let mut segments = Punctuated::new();
|
||||
for ident in path {
|
||||
let ident = PathSegment {
|
||||
ident: Ident::new(ident, Span::call_site()),
|
||||
arguments: PathArguments::None,
|
||||
};
|
||||
segments.push(ident);
|
||||
}
|
||||
Path {
|
||||
leading_colon: Some(Token)),
|
||||
segments,
|
||||
}
|
||||
}
|
||||
|
||||
fn absolute_path_to_mut_ptr(path: &[&'static str]) -> Type {
|
||||
Type::Ptr(TypePtr {
|
||||
star_token: Token),
|
||||
const_token: None,
|
||||
mutability: Some(Token)),
|
||||
elem: Box::new(Type::Path(TypePath {
|
||||
qself: None,
|
||||
path: segments_to_path(path),
|
||||
})),
|
||||
})
|
||||
}
|
||||
|
||||
struct FixAbi;
|
||||
|
||||
impl VisitMut for FixAbi {
|
||||
fn visit_abi_mut(&mut self, i: &mut Abi) {
|
||||
if let Some(ref mut name) = i.name {
|
||||
*name = LitStr::new("system", Span::call_site());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CollectTypesForSendSync {
|
||||
types: Vec<Ident>,
|
||||
}
|
||||
|
||||
impl CollectTypesForSendSync {
|
||||
fn try_add(&mut self, ident: &Ident) {
|
||||
let mut name = ident.to_string();
|
||||
name.make_ascii_lowercase();
|
||||
if name.contains("graph") {
|
||||
return;
|
||||
}
|
||||
self.types.push(ident.clone());
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ast> Visit<'ast> for CollectTypesForSendSync {
|
||||
fn visit_item_struct(&mut self, item_struct: &'ast ItemStruct) {
|
||||
self.try_add(&item_struct.ident);
|
||||
}
|
||||
|
||||
fn visit_item_union(&mut self, item_struct: &'ast ItemUnion) {
|
||||
self.try_add(&item_struct.ident);
|
||||
}
|
||||
|
||||
fn visit_item_enum(&mut self, item_struct: &'ast ItemEnum) {
|
||||
self.try_add(&item_struct.ident);
|
||||
}
|
||||
}
|
||||
const NVML_RS: &'static str = include_str! {"nvml.rs"};
|
||||
|
||||
// This macro accepts following arguments:
|
||||
// * `type_path`: path to the module with type definitions (in the module tree)
|
||||
// * `normal_macro`: ident for a normal macro
|
||||
// * zero or more:
|
||||
// * `override_macro`: ident for an override macro
|
||||
// * `override_fns`: list of override functions
|
||||
// Then macro goes through every function in rust.rs, and for every fn `foo`:
|
||||
@ -166,391 +32,202 @@ impl<'ast> Visit<'ast> for CollectTypesForSendSync {
|
||||
// Additionally, it does a fixup of CUDA types so they get prefixed with `type_path`
|
||||
#[proc_macro]
|
||||
pub fn cuda_function_declarations(tokens: TokenStream) -> TokenStream {
|
||||
function_declarations(tokens, CUDA_RS)
|
||||
}
|
||||
|
||||
fn function_declarations(tokens: TokenStream, module: &str) -> TokenStream {
|
||||
let input = parse_macro_input!(tokens as FnDeclInput);
|
||||
let cuda_module = syn::parse_str::<File>(CUDA_RS).unwrap();
|
||||
let override_fns = input
|
||||
.override_fns
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect::<FxHashSet<_>>();
|
||||
let (normal_macro_args, override_macro_args): (Vec<_>, Vec<_>) = cuda_module
|
||||
.items
|
||||
.into_iter()
|
||||
.filter_map(|item| match item {
|
||||
Item::ForeignMod(ItemForeignMod { mut items, .. }) => match items.pop().unwrap() {
|
||||
ForeignItem::Fn(ForeignItemFn {
|
||||
sig:
|
||||
Signature {
|
||||
ident,
|
||||
inputs,
|
||||
output,
|
||||
..
|
||||
},
|
||||
..
|
||||
}) => {
|
||||
let use_normal_macro = !override_fns.contains(&ident.to_string());
|
||||
let inputs = inputs
|
||||
.into_iter()
|
||||
.map(|fn_arg| match fn_arg {
|
||||
FnArg::Typed(mut pat_type) => {
|
||||
pat_type.ty =
|
||||
prepend_cuda_path_to_type(&input.type_path, pat_type.ty);
|
||||
FnArg::Typed(pat_type)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.collect::<Punctuated<_, Token![,]>>();
|
||||
let output = match output {
|
||||
ReturnType::Type(_, type_) => type_,
|
||||
ReturnType::Default => unreachable!(),
|
||||
let mut cuda_module = syn::parse_str::<File>(module).unwrap();
|
||||
let mut choose_macro = ChooseMacro::new(input);
|
||||
syn::visit_mut::visit_file_mut(&mut FixFnSignatures, &mut cuda_module);
|
||||
let extern_ = if let Item::ForeignMod(extern_) = cuda_module.items.pop().unwrap() {
|
||||
extern_
|
||||
} else {
|
||||
unreachable!()
|
||||
};
|
||||
let type_path = input.type_path.clone();
|
||||
Some((
|
||||
quote! {
|
||||
"system" fn #ident(#inputs) -> #type_path :: #output
|
||||
},
|
||||
use_normal_macro,
|
||||
))
|
||||
let abi = extern_.abi.name;
|
||||
for mut item in extern_.items {
|
||||
if let ForeignItem::Fn(ForeignItemFn {
|
||||
sig: Signature { ref ident, .. },
|
||||
ref mut attrs,
|
||||
..
|
||||
}) = item
|
||||
{
|
||||
*attrs = Vec::new();
|
||||
choose_macro.add(ident, quote! { #abi #item });
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
_ => None,
|
||||
})
|
||||
.partition(|(_, use_normal_macro)| *use_normal_macro);
|
||||
let mut result = proc_macro2::TokenStream::new();
|
||||
if !normal_macro_args.is_empty() {
|
||||
let punctuated_normal_macro_args = to_punctuated::<Token![;]>(normal_macro_args);
|
||||
let macro_ = &input.normal_macro;
|
||||
result.extend(iter::once(quote! {
|
||||
#macro_ ! (#punctuated_normal_macro_args);
|
||||
}));
|
||||
for (path, items) in
|
||||
iter::once(choose_macro.default).chain(choose_macro.override_sets.into_iter())
|
||||
{
|
||||
if items.is_empty() {
|
||||
continue;
|
||||
}
|
||||
if !override_macro_args.is_empty() {
|
||||
let punctuated_override_macro_args = to_punctuated::<Token![;]>(override_macro_args);
|
||||
let macro_ = &input.override_macro;
|
||||
result.extend(iter::once(quote! {
|
||||
#macro_ ! (#punctuated_override_macro_args);
|
||||
}));
|
||||
quote! {
|
||||
#path ! { #(#items)* }
|
||||
}
|
||||
.to_tokens(&mut result);
|
||||
}
|
||||
result.into()
|
||||
}
|
||||
|
||||
fn to_punctuated<P: ToTokens + Default>(
|
||||
elms: Vec<(proc_macro2::TokenStream, bool)>,
|
||||
) -> proc_macro2::TokenStream {
|
||||
let mut collection = Punctuated::<proc_macro2::TokenStream, P>::new();
|
||||
collection.extend(elms.into_iter().map(|(token_stream, _)| token_stream));
|
||||
collection.into_token_stream()
|
||||
#[proc_macro]
|
||||
pub fn nvml_function_declarations(tokens: TokenStream) -> TokenStream {
|
||||
function_declarations(tokens, NVML_RS)
|
||||
}
|
||||
|
||||
fn prepend_cuda_path_to_type(base_path: &Path, type_: Box<Type>) -> Box<Type> {
|
||||
match *type_ {
|
||||
Type::Path(mut type_path) => {
|
||||
type_path.path = prepend_cuda_path_to_path(base_path, type_path.path);
|
||||
Box::new(Type::Path(type_path))
|
||||
}
|
||||
Type::Ptr(mut type_ptr) => {
|
||||
type_ptr.elem = prepend_cuda_path_to_type(base_path, type_ptr.elem);
|
||||
Box::new(Type::Ptr(type_ptr))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn prepend_cuda_path_to_path(base_path: &Path, path: Path) -> Path {
|
||||
if path.leading_colon.is_some() {
|
||||
return path;
|
||||
}
|
||||
if path.segments.len() == 1 {
|
||||
let ident = path.segments[0].ident.to_string();
|
||||
if ident.starts_with("CU")
|
||||
|| ident.starts_with("cu")
|
||||
|| ident.starts_with("GL")
|
||||
|| ident == "HGPUNV"
|
||||
{
|
||||
let mut base_path = base_path.clone();
|
||||
base_path.segments.extend(path.segments);
|
||||
return base_path;
|
||||
}
|
||||
}
|
||||
path
|
||||
}
|
||||
|
||||
struct FnDeclInput {
|
||||
type_path: Path,
|
||||
normal_macro: Path,
|
||||
override_macro: Path,
|
||||
override_fns: Punctuated<Ident, Token![,]>,
|
||||
overrides: Punctuated<OverrideMacro, Token![,]>,
|
||||
}
|
||||
|
||||
impl Parse for FnDeclInput {
|
||||
fn parse(input: ParseStream) -> syn::Result<Self> {
|
||||
let type_path = input.parse::<Path>()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
let normal_macro = input.parse::<Path>()?;
|
||||
let overrides = if input.is_empty() {
|
||||
Punctuated::new()
|
||||
} else {
|
||||
input.parse::<Token![,]>()?;
|
||||
let override_macro = input.parse::<Path>()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
let override_fns_content;
|
||||
bracketed!(override_fns_content in input);
|
||||
let override_fns = override_fns_content.parse_terminated(Ident::parse)?;
|
||||
input.parse_terminated(OverrideMacro::parse, Token![,])?
|
||||
};
|
||||
Ok(Self {
|
||||
type_path,
|
||||
normal_macro,
|
||||
override_macro,
|
||||
override_fns,
|
||||
overrides,
|
||||
})
|
||||
}
|
||||
}
|
||||
struct OverrideMacro {
|
||||
macro_: Path,
|
||||
functions: Punctuated<Ident, Token![,]>,
|
||||
}
|
||||
|
||||
impl Parse for OverrideMacro {
|
||||
fn parse(input: ParseStream) -> syn::Result<Self> {
|
||||
let macro_ = input.parse::<Path>()?;
|
||||
input.parse::<Token![<=]>()?;
|
||||
let functions_content;
|
||||
bracketed!(functions_content in input);
|
||||
let functions = functions_content.parse_terminated(Ident::parse, Token![,])?;
|
||||
Ok(Self { macro_, functions })
|
||||
}
|
||||
}
|
||||
|
||||
struct ChooseMacro {
|
||||
default: (Path, Vec<proc_macro2::TokenStream>),
|
||||
override_lookup: FxHashMap<Ident, Path>,
|
||||
override_sets: FxHashMap<Path, Vec<proc_macro2::TokenStream>>,
|
||||
}
|
||||
|
||||
impl ChooseMacro {
|
||||
fn new(input: FnDeclInput) -> Self {
|
||||
let mut override_lookup = FxHashMap::default();
|
||||
let mut override_sets = FxHashMap::default();
|
||||
for OverrideMacro { macro_, functions } in input.overrides {
|
||||
for ident in functions {
|
||||
override_lookup.insert(ident, macro_.clone());
|
||||
override_sets.insert(macro_.clone(), Vec::new());
|
||||
}
|
||||
}
|
||||
Self {
|
||||
default: (input.normal_macro, Vec::new()),
|
||||
override_lookup,
|
||||
override_sets,
|
||||
}
|
||||
}
|
||||
|
||||
fn add(&mut self, ident: &Ident, tokens: proc_macro2::TokenStream) {
|
||||
match self.override_lookup.get(ident) {
|
||||
Some(override_macro) => {
|
||||
self.override_sets
|
||||
.get_mut(override_macro)
|
||||
.unwrap()
|
||||
.push(tokens);
|
||||
}
|
||||
None => self.default.1.push(tokens),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For some reason prettyplease will append trailing comma *only*
|
||||
// if there are two or more arguments
|
||||
struct FixFnSignatures;
|
||||
|
||||
impl VisitMut for FixFnSignatures {
|
||||
fn visit_signature_mut(&mut self, s: &mut syn::Signature) {
|
||||
s.inputs.pop_punct();
|
||||
}
|
||||
}
|
||||
|
||||
const MODULES: &[&str] = &[
|
||||
"context", "device", "driver", "function", "link", "memory", "module", "pointer",
|
||||
];
|
||||
|
||||
// This trait accepts following parameters:
|
||||
// * `type_path`: path to the module with type definitions (in the module tree)
|
||||
// * `trait_`: name of the trait to be derived
|
||||
// * `ignore_types`: bracketed list of types to ignore
|
||||
// * `ignore_fns`: bracketed list of fns to ignore
|
||||
#[proc_macro]
|
||||
pub fn cuda_derive_display_trait(tokens: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(tokens as DeriveDisplayInput);
|
||||
let cuda_module = syn::parse_str::<File>(CUDA_RS).unwrap();
|
||||
let mut derive_state = DeriveDisplayState::new(input);
|
||||
cuda_module
|
||||
.items
|
||||
.into_iter()
|
||||
.filter_map(|i| cuda_derive_display_trait_for_item(&mut derive_state, i))
|
||||
.collect::<proc_macro2::TokenStream>()
|
||||
pub fn cuda_normalize_fn(tokens: TokenStream) -> TokenStream {
|
||||
let mut path = parse_macro_input!(tokens as syn::Path);
|
||||
let fn_ = path
|
||||
.segments
|
||||
.pop()
|
||||
.unwrap()
|
||||
.into_tuple()
|
||||
.0
|
||||
.ident
|
||||
.to_string();
|
||||
let already_has_module = MODULES.contains(&&*path.segments.last().unwrap().ident.to_string());
|
||||
let segments: Vec<String> = split(&fn_[2..]); // skip "cu"
|
||||
let fn_path = join(segments, !already_has_module);
|
||||
quote! {
|
||||
#path #fn_path
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
fn cuda_derive_display_trait_for_item(
|
||||
state: &mut DeriveDisplayState,
|
||||
item: Item,
|
||||
) -> Option<proc_macro2::TokenStream> {
|
||||
let path_prefix = &state.type_path;
|
||||
let path_prefix_iter = iter::repeat(&path_prefix);
|
||||
let trait_ = &state.trait_;
|
||||
let trait_iter = iter::repeat(&state.trait_);
|
||||
match item {
|
||||
Item::Const(_) => None,
|
||||
Item::ForeignMod(ItemForeignMod { mut items, .. }) => match items.pop().unwrap() {
|
||||
ForeignItem::Fn(ForeignItemFn {
|
||||
sig: Signature { ident, inputs, .. },
|
||||
..
|
||||
}) => {
|
||||
if state.ignore_fns.contains(&ident) {
|
||||
return None;
|
||||
}
|
||||
let inputs = inputs
|
||||
.into_iter()
|
||||
.map(|fn_arg| match fn_arg {
|
||||
FnArg::Typed(mut pat_type) => {
|
||||
pat_type.ty = prepend_cuda_path_to_type(path_prefix, pat_type.ty);
|
||||
FnArg::Typed(pat_type)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let inputs_iter = inputs.iter();
|
||||
let mut arg_name_iter = inputs.iter().map(|fn_arg| match fn_arg {
|
||||
FnArg::Typed(PatType { pat, .. }) => pat,
|
||||
_ => unreachable!(),
|
||||
});
|
||||
let fn_name = format_ident!("write_{}", ident);
|
||||
let original_fn_name = ident.to_string();
|
||||
Some(match arg_name_iter.next() {
|
||||
Some(first_arg_name) => quote! {
|
||||
pub fn #fn_name(writer: &mut (impl std::io::Write + ?Sized), #(#inputs_iter,)*) -> std::io::Result<()> {
|
||||
writer.write_all(concat!("(", stringify!(#first_arg_name), ": ").as_bytes())?;
|
||||
let mut arg_idx = 0usize;
|
||||
CudaDisplay::write(&#first_arg_name, #original_fn_name, arg_idx, writer)?;
|
||||
#(
|
||||
writer.write_all(b", ")?;
|
||||
writer.write_all(concat!(stringify!(#arg_name_iter), ": ").as_bytes())?;
|
||||
CudaDisplay::write(&#arg_name_iter, #original_fn_name, arg_idx, writer)?;
|
||||
arg_idx += 1;
|
||||
)*
|
||||
writer.write_all(b")")
|
||||
}
|
||||
},
|
||||
None => quote! {
|
||||
pub fn #fn_name(writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> {
|
||||
writer.write_all(b"()")
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
Item::Impl(mut item_impl) => {
|
||||
let enum_ = match *(item_impl.self_ty) {
|
||||
Type::Path(mut path) => path.path.segments.pop().unwrap().into_value().ident,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let variant_ = match item_impl.items.pop().unwrap() {
|
||||
syn::ImplItem::Const(item_const) => item_const.ident,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
state.record_enum_variant(enum_, variant_);
|
||||
None
|
||||
}
|
||||
Item::Struct(item_struct) => {
|
||||
let item_struct_name = item_struct.ident.to_string();
|
||||
if state.ignore_types.contains(&item_struct.ident) {
|
||||
return None;
|
||||
}
|
||||
if item_struct_name.ends_with("_enum") {
|
||||
let enum_ = &item_struct.ident;
|
||||
let enum_iter = iter::repeat(&item_struct.ident);
|
||||
let variants = state.enums.get(&item_struct.ident).unwrap().iter();
|
||||
Some(quote! {
|
||||
impl #trait_ for #path_prefix :: #enum_ {
|
||||
fn write(&self, _fn_name: &'static str, _index: usize, writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> {
|
||||
match self {
|
||||
#(& #path_prefix_iter :: #enum_iter :: #variants => writer.write_all(stringify!(#variants).as_bytes()),)*
|
||||
_ => write!(writer, "{}", self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
fn split(fn_: &str) -> Vec<String> {
|
||||
let mut result = Vec::new();
|
||||
for c in fn_.chars() {
|
||||
if c.is_ascii_uppercase() {
|
||||
result.push(c.to_ascii_lowercase().to_string());
|
||||
} else {
|
||||
let struct_ = &item_struct.ident;
|
||||
let (first_field, rest_of_fields) = match item_struct.fields {
|
||||
Fields::Named(fields) => {
|
||||
let mut all_idents = fields.named.into_iter().filter_map(|f| {
|
||||
let f_ident = f.ident.unwrap();
|
||||
let name = f_ident.to_string();
|
||||
if name.starts_with("reserved") || name == "_unused" {
|
||||
None
|
||||
} else {
|
||||
Some(f_ident)
|
||||
result.last_mut().unwrap().push(c);
|
||||
}
|
||||
});
|
||||
let first = match all_idents.next() {
|
||||
Some(f) => f,
|
||||
None => return None,
|
||||
};
|
||||
(first, all_idents)
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn join(fn_: Vec<String>, find_module: bool) -> Punctuated<Ident, Token![::]> {
|
||||
fn full_form(segment: &str) -> Option<&[&str]> {
|
||||
Some(match segment {
|
||||
"ctx" => &["context"],
|
||||
"func" => &["function"],
|
||||
"mem" => &["memory"],
|
||||
"memcpy" => &["memory", "copy"],
|
||||
"memset" => &["memory", "set"],
|
||||
_ => return None,
|
||||
};
|
||||
Some(quote! {
|
||||
impl #trait_ for #path_prefix :: #struct_ {
|
||||
fn write(&self, _fn_name: &'static str, _index: usize, writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> {
|
||||
writer.write_all(concat!("{ ", stringify!(#first_field), ": ").as_bytes())?;
|
||||
#trait_::write(&self.#first_field, "", 0, writer)?;
|
||||
#(
|
||||
writer.write_all(concat!(", ", stringify!(#rest_of_fields), ": ").as_bytes())?;
|
||||
#trait_iter::write(&self.#rest_of_fields, "", 0, writer)?;
|
||||
)*
|
||||
writer.write_all(b" }")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Item::Type(item_type) => {
|
||||
if state.ignore_types.contains(&item_type.ident) {
|
||||
return None;
|
||||
};
|
||||
match *(item_type.ty) {
|
||||
Type::Ptr(_) => {
|
||||
let type_ = item_type.ident;
|
||||
Some(quote! {
|
||||
impl #trait_ for #path_prefix :: #type_ {
|
||||
fn write(&self, _fn_name: &'static str, _index: usize, writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> {
|
||||
write!(writer, "{:p}", *self)
|
||||
let mut normalized: Vec<&str> = Vec::new();
|
||||
for segment in fn_.iter() {
|
||||
match full_form(segment) {
|
||||
Some(segments) => normalized.extend(segments.into_iter()),
|
||||
None => normalized.push(&*segment),
|
||||
}
|
||||
}
|
||||
})
|
||||
if !find_module {
|
||||
return [Ident::new(&normalized.join("_"), Span::call_site())]
|
||||
.into_iter()
|
||||
.collect();
|
||||
}
|
||||
Type::Path(type_path) => {
|
||||
if type_path.path.leading_colon.is_some() {
|
||||
let option_seg = type_path.path.segments.last().unwrap();
|
||||
if option_seg.ident == "Option" {
|
||||
match &option_seg.arguments {
|
||||
PathArguments::AngleBracketed(generic) => match generic.args[0] {
|
||||
syn::GenericArgument::Type(Type::BareFn(_)) => {
|
||||
let type_ = &item_type.ident;
|
||||
return Some(quote! {
|
||||
impl #trait_ for #path_prefix :: #type_ {
|
||||
fn write(&self, _fn_name: &'static str, _index: usize, writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> {
|
||||
write!(writer, "{:p}", unsafe { std::mem::transmute::<#path_prefix :: #type_, *mut ::std::ffi::c_void>(*self) })
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
Item::Union(_) => None,
|
||||
Item::Use(_) => None,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
struct DeriveDisplayState {
|
||||
type_path: Path,
|
||||
trait_: Path,
|
||||
ignore_types: FxHashSet<Ident>,
|
||||
ignore_fns: FxHashSet<Ident>,
|
||||
enums: FxHashMap<Ident, Vec<Ident>>,
|
||||
}
|
||||
|
||||
impl DeriveDisplayState {
|
||||
fn new(input: DeriveDisplayInput) -> Self {
|
||||
DeriveDisplayState {
|
||||
type_path: input.type_path,
|
||||
trait_: input.trait_,
|
||||
ignore_types: input.ignore_types.into_iter().collect(),
|
||||
ignore_fns: input.ignore_fns.into_iter().collect(),
|
||||
enums: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn record_enum_variant(&mut self, enum_: Ident, variant: Ident) {
|
||||
match self.enums.entry(enum_) {
|
||||
hash_map::Entry::Occupied(mut entry) => {
|
||||
entry.get_mut().push(variant);
|
||||
}
|
||||
hash_map::Entry::Vacant(entry) => {
|
||||
entry.insert(vec![variant]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DeriveDisplayInput {
|
||||
type_path: Path,
|
||||
trait_: Path,
|
||||
ignore_types: Punctuated<Ident, Token![,]>,
|
||||
ignore_fns: Punctuated<Ident, Token![,]>,
|
||||
}
|
||||
|
||||
impl Parse for DeriveDisplayInput {
|
||||
fn parse(input: ParseStream) -> syn::Result<Self> {
|
||||
let type_path = input.parse::<Path>()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
let trait_ = input.parse::<Path>()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
let ignore_types_buffer;
|
||||
bracketed!(ignore_types_buffer in input);
|
||||
let ignore_types = ignore_types_buffer.parse_terminated(Ident::parse)?;
|
||||
input.parse::<Token![,]>()?;
|
||||
let ignore_fns_buffer;
|
||||
bracketed!(ignore_fns_buffer in input);
|
||||
let ignore_fns = ignore_fns_buffer.parse_terminated(Ident::parse)?;
|
||||
Ok(Self {
|
||||
type_path,
|
||||
trait_,
|
||||
ignore_types,
|
||||
ignore_fns,
|
||||
})
|
||||
if !MODULES.contains(&normalized[0]) {
|
||||
let mut globalized = vec!["driver"];
|
||||
globalized.extend(normalized);
|
||||
normalized = globalized;
|
||||
}
|
||||
let (module, path) = normalized.split_first().unwrap();
|
||||
let path = path.join("_");
|
||||
[module, &&*path]
|
||||
.into_iter()
|
||||
.map(|s| Ident::new(s, Span::call_site()))
|
||||
.collect()
|
||||
}
|
||||
|
7857
cuda_base/src/nvml.rs
Normal file
7857
cuda_base/src/nvml.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,3 +6,4 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cuda_base = { path = "../cuda_base" }
|
||||
hip_runtime-sys = { path = "../ext/hip_runtime-sys" }
|
||||
|
8110
cuda_types/src/cuda.rs
Normal file
8110
cuda_types/src/cuda.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,2 @@
|
||||
use cuda_base::cuda_type_declarations;
|
||||
|
||||
cuda_type_declarations!();
|
||||
|
||||
impl From<CUresult> for Result<(), CUresult> {
|
||||
fn from(value: CUresult) -> Self {
|
||||
match value {
|
||||
CUresult::CUDA_SUCCESS => Ok(()),
|
||||
err => Err(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub mod cuda;
|
||||
pub mod nvml;
|
4185
cuda_types/src/nvml.rs
Normal file
4185
cuda_types/src/nvml.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -28,12 +28,88 @@ pub struct _GUID {
|
||||
pub Data3: ::std::os::raw::c_ushort,
|
||||
pub Data4: [::std::os::raw::c_uchar; 8usize],
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout__GUID() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<_GUID>(),
|
||||
16usize,
|
||||
concat!("Size of: ", stringify!(_GUID))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<_GUID>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(_GUID))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_GUID>())).Data1 as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_GUID),
|
||||
"::",
|
||||
stringify!(Data1)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_GUID>())).Data2 as *const _ as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_GUID),
|
||||
"::",
|
||||
stringify!(Data2)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_GUID>())).Data3 as *const _ as usize },
|
||||
6usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_GUID),
|
||||
"::",
|
||||
stringify!(Data3)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_GUID>())).Data4 as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_GUID),
|
||||
"::",
|
||||
stringify!(Data4)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type GUID = _GUID;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct HINSTANCE__ {
|
||||
pub unused: ::std::os::raw::c_int,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_HINSTANCE__() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<HINSTANCE__>(),
|
||||
4usize,
|
||||
concat!("Size of: ", stringify!(HINSTANCE__))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<HINSTANCE__>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(HINSTANCE__))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<HINSTANCE__>())).unused as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(HINSTANCE__),
|
||||
"::",
|
||||
stringify!(unused)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type HINSTANCE = *mut HINSTANCE__;
|
||||
pub type HMODULE = HINSTANCE;
|
||||
#[repr(C)]
|
||||
@ -41,6 +117,29 @@ pub type HMODULE = HINSTANCE;
|
||||
pub struct HWND__ {
|
||||
pub unused: ::std::os::raw::c_int,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_HWND__() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<HWND__>(),
|
||||
4usize,
|
||||
concat!("Size of: ", stringify!(HWND__))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<HWND__>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(HWND__))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<HWND__>())).unused as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(HWND__),
|
||||
"::",
|
||||
stringify!(unused)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type HWND = *mut HWND__;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@ -49,6 +148,54 @@ pub struct _SECURITY_ATTRIBUTES {
|
||||
pub lpSecurityDescriptor: LPVOID,
|
||||
pub bInheritHandle: BOOL,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout__SECURITY_ATTRIBUTES() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<_SECURITY_ATTRIBUTES>(),
|
||||
24usize,
|
||||
concat!("Size of: ", stringify!(_SECURITY_ATTRIBUTES))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<_SECURITY_ATTRIBUTES>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(_SECURITY_ATTRIBUTES))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_SECURITY_ATTRIBUTES>())).nLength as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_SECURITY_ATTRIBUTES),
|
||||
"::",
|
||||
stringify!(nLength)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<_SECURITY_ATTRIBUTES>())).lpSecurityDescriptor as *const _
|
||||
as usize
|
||||
},
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_SECURITY_ATTRIBUTES),
|
||||
"::",
|
||||
stringify!(lpSecurityDescriptor)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<_SECURITY_ATTRIBUTES>())).bInheritHandle as *const _ as usize
|
||||
},
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_SECURITY_ATTRIBUTES),
|
||||
"::",
|
||||
stringify!(bInheritHandle)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type LPSECURITY_ATTRIBUTES = *mut _SECURITY_ATTRIBUTES;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@ -58,6 +205,61 @@ pub struct _PROCESS_INFORMATION {
|
||||
pub dwProcessId: DWORD,
|
||||
pub dwThreadId: DWORD,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout__PROCESS_INFORMATION() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<_PROCESS_INFORMATION>(),
|
||||
24usize,
|
||||
concat!("Size of: ", stringify!(_PROCESS_INFORMATION))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<_PROCESS_INFORMATION>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(_PROCESS_INFORMATION))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_PROCESS_INFORMATION>())).hProcess as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_PROCESS_INFORMATION),
|
||||
"::",
|
||||
stringify!(hProcess)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_PROCESS_INFORMATION>())).hThread as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_PROCESS_INFORMATION),
|
||||
"::",
|
||||
stringify!(hThread)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<_PROCESS_INFORMATION>())).dwProcessId as *const _ as usize
|
||||
},
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_PROCESS_INFORMATION),
|
||||
"::",
|
||||
stringify!(dwProcessId)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_PROCESS_INFORMATION>())).dwThreadId as *const _ as usize },
|
||||
20usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_PROCESS_INFORMATION),
|
||||
"::",
|
||||
stringify!(dwThreadId)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type LPPROCESS_INFORMATION = *mut _PROCESS_INFORMATION;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@ -81,6 +283,199 @@ pub struct _STARTUPINFOA {
|
||||
pub hStdOutput: HANDLE,
|
||||
pub hStdError: HANDLE,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout__STARTUPINFOA() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<_STARTUPINFOA>(),
|
||||
104usize,
|
||||
concat!("Size of: ", stringify!(_STARTUPINFOA))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<_STARTUPINFOA>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(_STARTUPINFOA))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).cb as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(cb)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).lpReserved as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(lpReserved)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).lpDesktop as *const _ as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(lpDesktop)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).lpTitle as *const _ as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(lpTitle)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwX as *const _ as usize },
|
||||
32usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwX)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwY as *const _ as usize },
|
||||
36usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwY)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwXSize as *const _ as usize },
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwXSize)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwYSize as *const _ as usize },
|
||||
44usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwYSize)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwXCountChars as *const _ as usize },
|
||||
48usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwXCountChars)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwYCountChars as *const _ as usize },
|
||||
52usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwYCountChars)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwFillAttribute as *const _ as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwFillAttribute)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).dwFlags as *const _ as usize },
|
||||
60usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(dwFlags)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).wShowWindow as *const _ as usize },
|
||||
64usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(wShowWindow)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).cbReserved2 as *const _ as usize },
|
||||
66usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(cbReserved2)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).lpReserved2 as *const _ as usize },
|
||||
72usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(lpReserved2)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).hStdInput as *const _ as usize },
|
||||
80usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(hStdInput)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).hStdOutput as *const _ as usize },
|
||||
88usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(hStdOutput)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOA>())).hStdError as *const _ as usize },
|
||||
96usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOA),
|
||||
"::",
|
||||
stringify!(hStdError)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type LPSTARTUPINFOA = *mut _STARTUPINFOA;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@ -104,6 +499,199 @@ pub struct _STARTUPINFOW {
|
||||
pub hStdOutput: HANDLE,
|
||||
pub hStdError: HANDLE,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout__STARTUPINFOW() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<_STARTUPINFOW>(),
|
||||
104usize,
|
||||
concat!("Size of: ", stringify!(_STARTUPINFOW))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<_STARTUPINFOW>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(_STARTUPINFOW))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).cb as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(cb)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).lpReserved as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(lpReserved)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).lpDesktop as *const _ as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(lpDesktop)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).lpTitle as *const _ as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(lpTitle)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwX as *const _ as usize },
|
||||
32usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwX)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwY as *const _ as usize },
|
||||
36usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwY)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwXSize as *const _ as usize },
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwXSize)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwYSize as *const _ as usize },
|
||||
44usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwYSize)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwXCountChars as *const _ as usize },
|
||||
48usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwXCountChars)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwYCountChars as *const _ as usize },
|
||||
52usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwYCountChars)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwFillAttribute as *const _ as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwFillAttribute)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).dwFlags as *const _ as usize },
|
||||
60usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(dwFlags)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).wShowWindow as *const _ as usize },
|
||||
64usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(wShowWindow)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).cbReserved2 as *const _ as usize },
|
||||
66usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(cbReserved2)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).lpReserved2 as *const _ as usize },
|
||||
72usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(lpReserved2)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).hStdInput as *const _ as usize },
|
||||
80usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(hStdInput)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).hStdOutput as *const _ as usize },
|
||||
88usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(hStdOutput)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<_STARTUPINFOW>())).hStdError as *const _ as usize },
|
||||
96usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(_STARTUPINFOW),
|
||||
"::",
|
||||
stringify!(hStdError)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type LPSTARTUPINFOW = *mut _STARTUPINFOW;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "hipblaslt-sys"
|
||||
name = "amd_comgr-sys"
|
||||
version = "0.0.0"
|
||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||
edition = "2018"
|
||||
links = "hipblaslt"
|
||||
edition = "2021"
|
||||
links = "amd_comgr"
|
||||
|
||||
[lib]
|
1
ext/amd_comgr-sys/README
vendored
Normal file
1
ext/amd_comgr-sys/README
vendored
Normal file
@ -0,0 +1 @@
|
||||
bindgen --rust-target 1.77 /opt/rocm/include/amd_comgr/amd_comgr.h -o /tmp/amd_comgr.rs --no-layout-tests --default-enum-style=newtype --allowlist-function "amd_comgr.*" --allowlist-type "amd_comgr.*" --no-derive-debug --must-use-type amd_comgr_status_t --allowlist-var "^AMD_COMGR.*$"
|
@ -2,8 +2,8 @@ use std::env::VarError;
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
fn main() -> Result<(), VarError> {
|
||||
println!("cargo:rustc-link-lib=dylib=amdhip64");
|
||||
if cfg!(windows) {
|
||||
println!("cargo:rustc-link-lib=dylib=amd_comgr_2");
|
||||
let env = env::var("CARGO_CFG_TARGET_ENV")?;
|
||||
if env == "msvc" {
|
||||
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
|
||||
@ -13,6 +13,7 @@ fn main() -> Result<(), VarError> {
|
||||
println!("cargo:rustc-link-search=native=C:\\Windows\\System32");
|
||||
};
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=dylib:+verbatim=libamd_comgr.so.2");
|
||||
println!("cargo:rustc-link-search=native=/opt/rocm/lib/");
|
||||
}
|
||||
Ok(())
|
68
ext/amd_comgr-sys/lib/amd_comgr_2.def
vendored
Normal file
68
ext/amd_comgr-sys/lib/amd_comgr_2.def
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
;
|
||||
; Definition file of amd_comgr_2.dll
|
||||
; Automatic generated by gendef
|
||||
; written by Kai Tietz 2008
|
||||
;
|
||||
LIBRARY "amd_comgr_2.dll"
|
||||
EXPORTS
|
||||
amd_comgr_action_data_count
|
||||
amd_comgr_action_data_get_data
|
||||
amd_comgr_action_info_get_isa_name
|
||||
amd_comgr_action_info_get_language
|
||||
amd_comgr_action_info_get_logging
|
||||
amd_comgr_action_info_get_option_list_count
|
||||
amd_comgr_action_info_get_option_list_item
|
||||
amd_comgr_action_info_get_options
|
||||
amd_comgr_action_info_get_working_directory_path
|
||||
amd_comgr_action_info_set_isa_name
|
||||
amd_comgr_action_info_set_language
|
||||
amd_comgr_action_info_set_logging
|
||||
amd_comgr_action_info_set_option_list
|
||||
amd_comgr_action_info_set_options
|
||||
amd_comgr_action_info_set_working_directory_path
|
||||
amd_comgr_create_action_info
|
||||
amd_comgr_create_data
|
||||
amd_comgr_create_data_set
|
||||
amd_comgr_create_disassembly_info
|
||||
amd_comgr_create_symbolizer_info
|
||||
amd_comgr_data_set_add
|
||||
amd_comgr_data_set_remove
|
||||
amd_comgr_demangle_symbol_name
|
||||
amd_comgr_destroy_action_info
|
||||
amd_comgr_destroy_data_set
|
||||
amd_comgr_destroy_disassembly_info
|
||||
amd_comgr_destroy_metadata
|
||||
amd_comgr_destroy_symbolizer_info
|
||||
amd_comgr_disassemble_instruction
|
||||
amd_comgr_do_action
|
||||
amd_comgr_get_data
|
||||
amd_comgr_get_data_isa_name
|
||||
amd_comgr_get_data_kind
|
||||
amd_comgr_get_data_metadata
|
||||
amd_comgr_get_data_name
|
||||
amd_comgr_get_isa_count
|
||||
amd_comgr_get_isa_metadata
|
||||
amd_comgr_get_isa_name
|
||||
amd_comgr_get_mangled_name
|
||||
amd_comgr_get_metadata_kind
|
||||
amd_comgr_get_metadata_list_size
|
||||
amd_comgr_get_metadata_map_size
|
||||
amd_comgr_get_metadata_string
|
||||
amd_comgr_get_version
|
||||
amd_comgr_index_list_metadata
|
||||
amd_comgr_iterate_map_metadata
|
||||
amd_comgr_iterate_symbols
|
||||
amd_comgr_lookup_code_object
|
||||
amd_comgr_map_elf_virtual_address_to_code_object_offset
|
||||
amd_comgr_map_name_expression_to_symbol_name
|
||||
amd_comgr_metadata_lookup
|
||||
amd_comgr_populate_mangled_names
|
||||
amd_comgr_populate_name_expression_map
|
||||
amd_comgr_release_data
|
||||
amd_comgr_set_data
|
||||
amd_comgr_set_data_from_file_slice
|
||||
amd_comgr_set_data_name
|
||||
amd_comgr_status_string
|
||||
amd_comgr_symbol_get_info
|
||||
amd_comgr_symbol_lookup
|
||||
amd_comgr_symbolize
|
BIN
ext/amd_comgr-sys/lib/amd_comgr_2.lib
vendored
Normal file
BIN
ext/amd_comgr-sys/lib/amd_comgr_2.lib
vendored
Normal file
Binary file not shown.
941
ext/amd_comgr-sys/src/amd_comgr.rs
vendored
Normal file
941
ext/amd_comgr-sys/src/amd_comgr.rs
vendored
Normal file
@ -0,0 +1,941 @@
|
||||
/* automatically generated by rust-bindgen 0.70.1 */
|
||||
|
||||
pub const AMD_COMGR_INTERFACE_VERSION_MAJOR: u32 = 2;
|
||||
pub const AMD_COMGR_INTERFACE_VERSION_MINOR: u32 = 7;
|
||||
impl amd_comgr_status_s {
|
||||
#[doc = " The function has been executed successfully."]
|
||||
pub const AMD_COMGR_STATUS_SUCCESS: amd_comgr_status_s =
|
||||
amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(0) });
|
||||
}
|
||||
impl amd_comgr_status_s {
|
||||
#[doc = " A generic error has occurred."]
|
||||
pub const AMD_COMGR_STATUS_ERROR: amd_comgr_status_s =
|
||||
amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(1) });
|
||||
}
|
||||
impl amd_comgr_status_s {
|
||||
#[doc = " One of the actual arguments does not meet a precondition stated\n in the documentation of the corresponding formal argument. This\n includes both invalid Action types, and invalid arguments to\n valid Action types."]
|
||||
pub const AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT: amd_comgr_status_s =
|
||||
amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(2) });
|
||||
}
|
||||
impl amd_comgr_status_s {
|
||||
#[doc = " Failed to allocate the necessary resources."]
|
||||
pub const AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES: amd_comgr_status_s =
|
||||
amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(3) });
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief Status codes."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
|
||||
pub struct amd_comgr_status_s(pub ::std::num::NonZeroU32);
|
||||
type amd_comgr_status_t = Result<(), self::amd_comgr_status_s>;
|
||||
// Size check
|
||||
const _: fn() = || {
|
||||
let _ = std::mem::transmute::<amd_comgr_status_t, u32>;
|
||||
};
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " No high level language."]
|
||||
pub const AMD_COMGR_LANGUAGE_NONE: amd_comgr_language_s = amd_comgr_language_s(0);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " OpenCL 1.2."]
|
||||
pub const AMD_COMGR_LANGUAGE_OPENCL_1_2: amd_comgr_language_s = amd_comgr_language_s(1);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " OpenCL 2.0."]
|
||||
pub const AMD_COMGR_LANGUAGE_OPENCL_2_0: amd_comgr_language_s = amd_comgr_language_s(2);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " AMD Hetrogeneous C++ (HC)."]
|
||||
pub const AMD_COMGR_LANGUAGE_HC: amd_comgr_language_s = amd_comgr_language_s(3);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " HIP."]
|
||||
pub const AMD_COMGR_LANGUAGE_HIP: amd_comgr_language_s = amd_comgr_language_s(4);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " LLVM IR, either textual (.ll) or bitcode (.bc) format."]
|
||||
pub const AMD_COMGR_LANGUAGE_LLVM_IR: amd_comgr_language_s = amd_comgr_language_s(5);
|
||||
}
|
||||
impl amd_comgr_language_s {
|
||||
#[doc = " Marker for last valid language."]
|
||||
pub const AMD_COMGR_LANGUAGE_LAST: amd_comgr_language_s = amd_comgr_language_s(5);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief The source languages supported by the compiler."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_language_s(pub ::std::os::raw::c_uint);
|
||||
#[doc = " @brief The source languages supported by the compiler."]
|
||||
pub use self::amd_comgr_language_s as amd_comgr_language_t;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Query additional information about a status code.\n\n @param[in] status Status code.\n\n @param[out] status_string A NUL-terminated string that describes\n the error status.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n status is an invalid status code, or @p status_string is NULL."]
|
||||
pub fn amd_comgr_status_string(
|
||||
status: amd_comgr_status_t,
|
||||
status_string: *mut *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[doc = " @brief Get the version of the code object manager interface\n supported.\n\n An interface is backwards compatible with an implementation with an\n equal major version, and a greater than or equal minor version.\n\n @param[out] major Major version number.\n\n @param[out] minor Minor version number."]
|
||||
pub fn amd_comgr_get_version(major: *mut usize, minor: *mut usize);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " No data is available."]
|
||||
pub const AMD_COMGR_DATA_KIND_UNDEF: amd_comgr_data_kind_s = amd_comgr_data_kind_s(0);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a textual main source."]
|
||||
pub const AMD_COMGR_DATA_KIND_SOURCE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(1);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a textual source that is included in the main source\n or other include source."]
|
||||
pub const AMD_COMGR_DATA_KIND_INCLUDE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(2);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a precompiled-header source that is included in the main\n source or other include source."]
|
||||
pub const AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER: amd_comgr_data_kind_s =
|
||||
amd_comgr_data_kind_s(3);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a diagnostic output."]
|
||||
pub const AMD_COMGR_DATA_KIND_DIAGNOSTIC: amd_comgr_data_kind_s = amd_comgr_data_kind_s(4);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a textual log output."]
|
||||
pub const AMD_COMGR_DATA_KIND_LOG: amd_comgr_data_kind_s = amd_comgr_data_kind_s(5);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is compiler LLVM IR bit code for a specific isa."]
|
||||
pub const AMD_COMGR_DATA_KIND_BC: amd_comgr_data_kind_s = amd_comgr_data_kind_s(6);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a relocatable machine code object for a specific isa."]
|
||||
pub const AMD_COMGR_DATA_KIND_RELOCATABLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(7);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is an executable machine code object for a specific\n isa. An executable is the kind of code object that can be loaded\n and executed."]
|
||||
pub const AMD_COMGR_DATA_KIND_EXECUTABLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(8);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a block of bytes."]
|
||||
pub const AMD_COMGR_DATA_KIND_BYTES: amd_comgr_data_kind_s = amd_comgr_data_kind_s(9);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a fat binary (clang-offload-bundler output)."]
|
||||
pub const AMD_COMGR_DATA_KIND_FATBIN: amd_comgr_data_kind_s = amd_comgr_data_kind_s(16);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is an archive."]
|
||||
pub const AMD_COMGR_DATA_KIND_AR: amd_comgr_data_kind_s = amd_comgr_data_kind_s(17);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a bundled bitcode."]
|
||||
pub const AMD_COMGR_DATA_KIND_BC_BUNDLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(18);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " The data is a bundled archive."]
|
||||
pub const AMD_COMGR_DATA_KIND_AR_BUNDLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(19);
|
||||
}
|
||||
impl amd_comgr_data_kind_s {
|
||||
#[doc = " Marker for last valid data kind."]
|
||||
pub const AMD_COMGR_DATA_KIND_LAST: amd_comgr_data_kind_s = amd_comgr_data_kind_s(19);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief The kinds of data supported."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_data_kind_s(pub ::std::os::raw::c_uint);
|
||||
#[doc = " @brief The kinds of data supported."]
|
||||
pub use self::amd_comgr_data_kind_s as amd_comgr_data_kind_t;
|
||||
#[doc = " @brief A handle to a data object.\n\n Data objects are used to hold the data which is either an input or\n output of a code object manager action."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_data_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to a data object.\n\n Data objects are used to hold the data which is either an input or\n output of a code object manager action."]
|
||||
pub type amd_comgr_data_t = amd_comgr_data_s;
|
||||
#[doc = " @brief A handle to an action data object.\n\n An action data object holds a set of data objects. These can be\n used as inputs to an action, or produced as the result of an\n action."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_data_set_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to an action data object.\n\n An action data object holds a set of data objects. These can be\n used as inputs to an action, or produced as the result of an\n action."]
|
||||
pub type amd_comgr_data_set_t = amd_comgr_data_set_s;
|
||||
#[doc = " @brief A handle to an action information object.\n\n An action information object holds all the necessary information,\n excluding the input data objects, required to perform an action."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_action_info_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to an action information object.\n\n An action information object holds all the necessary information,\n excluding the input data objects, required to perform an action."]
|
||||
pub type amd_comgr_action_info_t = amd_comgr_action_info_s;
|
||||
#[doc = " @brief A handle to a metadata node.\n\n A metadata node handle is used to traverse the metadata associated\n with a data node."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_metadata_node_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to a metadata node.\n\n A metadata node handle is used to traverse the metadata associated\n with a data node."]
|
||||
pub type amd_comgr_metadata_node_t = amd_comgr_metadata_node_s;
|
||||
#[doc = " @brief A handle to a machine code object symbol.\n\n A symbol handle is used to obtain the properties of symbols of a machine code\n object. A symbol handle is invalidated when the data object containing the\n symbol is destroyed."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_symbol_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to a machine code object symbol.\n\n A symbol handle is used to obtain the properties of symbols of a machine code\n object. A symbol handle is invalidated when the data object containing the\n symbol is destroyed."]
|
||||
pub type amd_comgr_symbol_t = amd_comgr_symbol_s;
|
||||
#[doc = " @brief A handle to a disassembly information object.\n\n A disassembly information object holds all the necessary information,\n excluding the input data, required to perform disassembly."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_disassembly_info_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to a disassembly information object.\n\n A disassembly information object holds all the necessary information,\n excluding the input data, required to perform disassembly."]
|
||||
pub type amd_comgr_disassembly_info_t = amd_comgr_disassembly_info_s;
|
||||
#[doc = " @brief A handle to a symbolizer information object.\n\n A symbolizer information object holds all the necessary information\n required to perform symbolization."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct amd_comgr_symbolizer_info_s {
|
||||
pub handle: u64,
|
||||
}
|
||||
#[doc = " @brief A handle to a symbolizer information object.\n\n A symbolizer information object holds all the necessary information\n required to perform symbolization."]
|
||||
pub type amd_comgr_symbolizer_info_t = amd_comgr_symbolizer_info_s;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the number of isa names supported by this version of\n the code object manager library.\n\n The isa name specifies the instruction set architecture that should\n be used in the actions that involve machine code generation or\n inspection.\n\n @param[out] count The number of isa names supported.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_get_isa_count(count: *mut usize) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the Nth isa name supported by this version of the\n code object manager library.\n\n @param[in] index The index of the isa name to be returned. The\n first isa name is index 0.\n\n @param[out] isa_name A null terminated string that is the isa name\n being requested.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n index is greater than the number of isa name supported by this\n version of the code object manager library. @p isa_name is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_get_isa_name(
|
||||
index: usize,
|
||||
isa_name: *mut *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get a handle to the metadata of an isa name.\n\n The structure of the returned metadata is isa name specific and versioned\n with details specified in\n https://llvm.org/docs/AMDGPUUsage.html#code-object-metadata.\n It can include information about the\n limits for resources such as registers and memory addressing.\n\n @param[in] isa_name The isa name to query.\n\n @param[out] metadata A handle to the metadata of the isa name. If\n the isa name has no metadata then the returned handle has a kind of\n @p AMD_COMGR_METADATA_KIND_NULL. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n name is NULL or is not an isa name supported by this version of the\n code object manager library. @p metadata is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_isa_metadata(
|
||||
isa_name: *const ::std::os::raw::c_char,
|
||||
metadata: *mut amd_comgr_metadata_node_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Create a data object that can hold data of a specified kind.\n\n Data objects are reference counted and are destroyed when the\n reference count reaches 0. When a data object is created its\n reference count is 1, it has 0 bytes of data, it has an empty name,\n and it has no metadata.\n\n @param[in] kind The kind of data the object is intended to hold.\n\n @param[out] data A handle to the data object created. Its reference\n count is set to 1.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n kind is an invalid data kind, or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p data is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."]
|
||||
pub fn amd_comgr_create_data(
|
||||
kind: amd_comgr_data_kind_t,
|
||||
data: *mut amd_comgr_data_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Indicate that no longer using a data object handle.\n\n The reference count of the associated data object is\n decremented. If it reaches 0 it is destroyed.\n\n @param[in] data The data object to release.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_release_data(data: amd_comgr_data_t) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the kind of the data object.\n\n @param[in] data The data object to query.\n\n @param[out] kind The kind of data the object.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object. @p kind is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."]
|
||||
pub fn amd_comgr_get_data_kind(
|
||||
data: amd_comgr_data_t,
|
||||
kind: *mut amd_comgr_data_kind_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the data content of a data object to the specified\n bytes.\n\n Any previous value of the data object is overwritten. Any metadata\n associated with the data object is also replaced which invalidates\n all metadata handles to the old metadata.\n\n @param[in] data The data object to update.\n\n @param[in] size The number of bytes in the data specified by @p bytes.\n\n @param[in] bytes The bytes to set the data object to. The bytes are\n copied into the data object and can be freed after the call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_set_data(
|
||||
data: amd_comgr_data_t,
|
||||
size: usize,
|
||||
bytes: *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief For the given open posix file descriptor, map a slice of the\n file into the data object. The slice is specified by @p offset and @p size.\n Internally this API calls amd_comgr_set_data and resets data object's\n current state.\n\n @param[in, out] data The data object to update.\n\n @param[in] file_descriptor The native file descriptor for an open file.\n The @p file_descriptor must not be passed into a system I/O function\n by any other thread while this function is executing. The offset in\n the file descriptor may be updated based on the requested size and\n underlying platform. The @p file_descriptor may be closed immediately\n after this function returns.\n\n @param[in] offset position relative to the start of the file\n specifying the beginning of the slice in @p file_descriptor.\n\n @param[in] size Size in bytes of the slice.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The operation is successful.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid or\n the map operation failed."]
|
||||
pub fn amd_comgr_set_data_from_file_slice(
|
||||
data: amd_comgr_data_t,
|
||||
file_descriptor: ::std::os::raw::c_int,
|
||||
offset: u64,
|
||||
size: u64,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the name associated with a data object.\n\n When compiling, the full name of an include directive is used to\n reference the contents of the include data object with the same\n name. The name may also be used for other data objects in log and\n diagnostic output.\n\n @param[in] data The data object to update.\n\n @param[in] name A null terminated string that specifies the name to\n use for the data object. If NULL then the name is set to the empty\n string.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_set_data_name(
|
||||
data: amd_comgr_data_t,
|
||||
name: *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the data contents, and/or the size of the data\n associated with a data object.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p bytes. On return, if @p bytes\n is NULL, set to the size of the data object contents.\n\n @param[out] bytes If not NULL, then the first @p size bytes of the\n data object contents is copied. If NULL, no data is copied, and\n only @p size is updated (useful in order to find the size of buffer\n required to copy the data).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_data(
|
||||
data: amd_comgr_data_t,
|
||||
size: *mut usize,
|
||||
bytes: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the data object name and/or name length.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p name. On return, the size of\n the data object name including the terminating null character.\n\n @param[out] name If not NULL, then the first @p size characters of the\n data object name are copied. If @p name is NULL, only @p size is updated\n (useful in order to find the size of buffer required to copy the name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_data_name(
|
||||
data: amd_comgr_data_t,
|
||||
size: *mut usize,
|
||||
name: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the data object isa name and/or isa name length.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p isa_name. On return, if @p\n isa_name is NULL, set to the size of the isa name including the terminating\n null character.\n\n @param[out] isa_name If not NULL, then the first @p size characters\n of the isa name are copied. If NULL, no isa name is copied, and\n only @p size is updated (useful in order to find the size of buffer\n required to copy the isa name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, has kind @p\n AMD_COMGR_DATA_KIND_UNDEF, or is not an isa specific\n kind. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_data_isa_name(
|
||||
data: amd_comgr_data_t,
|
||||
size: *mut usize,
|
||||
isa_name: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Create a symbolizer info object.\n\n @param[in] code_object A data object denoting a code object for which\n symbolization should be performed. The kind of this object must be\n ::AMD_COMGR_DATA_KIND_RELOCATABLE, ::AMD_COMGR_DATA_KIND_EXECUTABLE,\n or ::AMD_COMGR_DATA_KIND_BYTES.\n\n @param[in] print_symbol_callback Function called by a successfull\n symbolize query. @p symbol is a null-terminated string containing the\n symbolization of the address and @p user_data is an arbitary user data.\n The callback does not own @p symbol, and it cannot be referenced once\n the callback returns.\n\n @param[out] symbolizer_info A handle to the symbolizer info object created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if @p code_object is\n invalid or @p print_symbol_callback is null.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create @p symbolizer_info as out of resources."]
|
||||
pub fn amd_comgr_create_symbolizer_info(
|
||||
code_object: amd_comgr_data_t,
|
||||
print_symbol_callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
symbol: *const ::std::os::raw::c_char,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
),
|
||||
>,
|
||||
symbolizer_info: *mut amd_comgr_symbolizer_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Destroy symbolizer info object.\n\n @param[in] symbolizer_info A handle to symbolizer info object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS on successful execution.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if @p\n symbolizer_info is invalid."]
|
||||
pub fn amd_comgr_destroy_symbolizer_info(
|
||||
symbolizer_info: amd_comgr_symbolizer_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Symbolize an address.\n\n The @p address is symbolized using the symbol definitions of the\n @p code_object specified when the @p symbolizer_info was created.\n The @p print_symbol_callback callback function specified when the\n @p symbolizer_info was created is called passing the\n symbolization result as @p symbol and @p user_data value.\n\n If symbolization is not possible ::AMD_COMGR_STATUS_SUCCESS is returned and\n the string passed to the @p symbol argument of the @p print_symbol_callback\n specified when the @p symbolizer_info was created contains the text\n \"<invalid>\" or \"??\". This is consistent with `llvm-symbolizer` utility.\n\n @param[in] symbolizer_info A handle to symbolizer info object which should be\n used to symbolize the @p address.\n\n @param[in] address An unrelocated ELF address to which symbolization\n query should be performed.\n\n @param[in] is_code if true, the symbolizer symbolize the address as code\n and the symbolization result contains filename, function name, line number\n and column number, else the symbolizer symbolize the address as data and\n the symbolizaion result contains symbol name, symbol's starting address\n and symbol size.\n\n @param[in] user_data Arbitrary user-data passed to @p print_symbol_callback\n callback as described for @p symbolizer_info argument.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n symbolizer_info is an invalid data object."]
|
||||
pub fn amd_comgr_symbolize(
|
||||
symbolizer_info: amd_comgr_symbolizer_info_t,
|
||||
address: u64,
|
||||
is_code: bool,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get a handle to the metadata of a data object.\n\n @param[in] data The data object to query.\n\n @param[out] metadata A handle to the metadata of the data\n object. If the data object has no metadata then the returned handle\n has a kind of @p AMD_COMGR_METADATA_KIND_NULL. The\n handle must be destroyed using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p metadata is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_data_metadata(
|
||||
data: amd_comgr_data_t,
|
||||
metadata: *mut amd_comgr_metadata_node_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Destroy a metadata handle.\n\n @param[in] metadata A metadata handle to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p metadata is an invalid\n metadata handle.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update metadata\n handle as out of resources."]
|
||||
pub fn amd_comgr_destroy_metadata(metadata: amd_comgr_metadata_node_t) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Create a data set object.\n\n @param[out] data_set A handle to the data set created. Initially it\n contains no data objects.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to create the data\n set object as out of resources."]
|
||||
pub fn amd_comgr_create_data_set(data_set: *mut amd_comgr_data_set_t) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Destroy a data set object.\n\n The reference counts of any associated data objects are decremented. Any\n handles to the data set object become invalid.\n\n @param[in] data_set A handle to the data set object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."]
|
||||
pub fn amd_comgr_destroy_data_set(data_set: amd_comgr_data_set_t) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Add a data object to a data set object if it is not already added.\n\n The reference count of the data object is incremented.\n\n @param[in] data_set A handle to the data set object to be updated.\n\n @param[in] data A handle to the data object to be added. If @p data_set\n already has the specified handle present, then it is not added. The order\n that data objects are added is preserved.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data is an invalid data object; has undef kind; has\n include kind but does not have a name.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."]
|
||||
pub fn amd_comgr_data_set_add(
|
||||
data_set: amd_comgr_data_set_t,
|
||||
data: amd_comgr_data_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Remove all data objects of a specified kind from a data set object.\n\n The reference count of the removed data objects is decremented.\n\n @param[in] data_set A handle to the data set object to be updated.\n\n @param[in] data_kind The data kind of the data objects to be removed. If @p\n AMD_COMGR_DATA_KIND_UNDEF is specified then all data objects are removed.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."]
|
||||
pub fn amd_comgr_data_set_remove(
|
||||
data_set: amd_comgr_data_set_t,
|
||||
data_kind: amd_comgr_data_kind_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the number of data objects of a specified data kind that are\n added to a data set object.\n\n @param[in] data_set A handle to the data set object to be queried.\n\n @param[in] data_kind The data kind of the data objects to be counted.\n\n @param[out] count The number of data objects of data kind @p data_kind.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query data set\n object as out of resources."]
|
||||
pub fn amd_comgr_action_data_count(
|
||||
data_set: amd_comgr_data_set_t,
|
||||
data_kind: amd_comgr_data_kind_t,
|
||||
count: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the Nth data object of a specified data kind that is added to a\n data set object.\n\n The reference count of the returned data object is incremented.\n\n @param[in] data_set A handle to the data set object to be queried.\n\n @param[in] data_kind The data kind of the data object to be returned.\n\n @param[in] index The index of the data object of data kind @data_kind to be\n returned. The first data object is index 0. The order of data objects matches\n the order that they were added to the data set object.\n\n @param[out] data The data object being requested.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p index is greater than the number of data\n objects of kind @p data_kind. @p data is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query data set\n object as out of resources."]
|
||||
pub fn amd_comgr_action_data_get_data(
|
||||
data_set: amd_comgr_data_set_t,
|
||||
data_kind: amd_comgr_data_kind_t,
|
||||
index: usize,
|
||||
data: *mut amd_comgr_data_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Create an action info object.\n\n @param[out] action_info A handle to the action info object created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the action info object as out of resources."]
|
||||
pub fn amd_comgr_create_action_info(
|
||||
action_info: *mut amd_comgr_action_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Destroy an action info object.\n\n @param[in] action_info A handle to the action info object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_destroy_action_info(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the isa name of an action info object.\n\n When an action info object is created it has no isa name. Some\n actions require that the action info object has an isa name\n defined.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] isa_name A null terminated string that is the isa name. If NULL\n or the empty string then the isa name is cleared. The isa name is defined as\n the Code Object Target Identification string, described at\n https://llvm.org/docs/AMDGPUUsage.html#code-object-target-identification\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p isa_name is not an\n isa name supported by this version of the code object manager\n library.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_action_info_set_isa_name(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
isa_name: *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the isa name and/or isa name length.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p isa_name. On return, if @p\n isa_name is NULL, set to the size of the isa name including the terminating\n null character.\n\n @param[out] isa_name If not NULL, then the first @p size characters of the\n isa name are copied into @p isa_name. If the isa name is not set then an\n empty string is copied into @p isa_name. If NULL, no name is copied, and\n only @p size is updated (useful in order to find the size of buffer required\n to copy the name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_isa_name(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
size: *mut usize,
|
||||
isa_name: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the source language of an action info object.\n\n When an action info object is created it has no language defined\n which is represented by @p\n AMD_COMGR_LANGUAGE_NONE. Some actions require that\n the action info object has a source language defined.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] language The language to set. If @p\n AMD_COMGR_LANGUAGE_NONE then the language is cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p language is an\n invalid language.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_action_info_set_language(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
language: amd_comgr_language_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the language for an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[out] language The language of the action info opject. @p\n AMD_COMGR_LANGUAGE_NONE if not defined,\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p language is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_language(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
language: *mut amd_comgr_language_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the options string of an action info object.\n\n When an action info object is created it has an empty options string.\n\n This overrides any option strings or arrays previously set by calls to this\n function or @p amd_comgr_action_info_set_option_list.\n\n An @p action_info object which had its options set with this function can\n only have its option inspected with @p amd_comgr_action_info_get_options.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] options A null terminated string that is the options. If\n NULL or the empty string then the options are cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources.\n\n @deprecated since 1.3\n @see amd_comgr_action_info_set_option_list"]
|
||||
pub fn amd_comgr_action_info_set_options(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
options: *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the options string and/or options strings length of an action\n info object.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_options.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p options. On return, if @p\n options is NULL, set to the size of the options including the terminating\n null character.\n\n @param[out] options If not NULL, then the first @p size characters of\n the options are copied. If the options are not set then an empty\n string is copied. If NULL, options is not copied, and only @p size\n is updated (useful inorder to find the size of buffer required to\n copy the options).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were not set\n with @p amd_comgr_action_info_set_options.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources.\n\n @deprecated since 1.3\n @see amd_comgr_action_info_get_option_list_count and\n amd_comgr_action_info_get_option_list_item"]
|
||||
pub fn amd_comgr_action_info_get_options(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
size: *mut usize,
|
||||
options: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the options array of an action info object.\n\n This overrides any option strings or arrays previously set by calls to this\n function or @p amd_comgr_action_info_set_options.\n\n An @p action_info object which had its options set with this function can\n only have its option inspected with @p\n amd_comgr_action_info_get_option_list_count and @p\n amd_comgr_action_info_get_option_list_item.\n\n @param[in] action_info A handle to the action info object to be updated.\n\n @param[in] options An array of null terminated strings. May be NULL if @p\n count is zero, which will result in an empty options array.\n\n @param[in] count The number of null terminated strings in @p options.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, or @p options is NULL and @p count is non-zero.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update action\n info object as out of resources."]
|
||||
pub fn amd_comgr_action_info_set_option_list(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
options: *mut *const ::std::os::raw::c_char,
|
||||
count: usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the number of options in the options array.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_option_list.\n\n @param[in] action_info The action info object to query.\n\n @param[out] count The number of options in the options array.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were never\n set, or not set with @p amd_comgr_action_info_set_option_list.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, or @p count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query the data\n object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_option_list_count(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
count: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the Nth option string in the options array and/or that\n option's length.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_option_list.\n\n @param[in] action_info The action info object to query.\n\n @param[in] index The index of the option to be returned. The first option\n index is 0. The order is the same as the options when they were added in @p\n amd_comgr_action_info_set_options.\n\n @param[in, out] size On entry, the size of @p option. On return, if @option\n is NULL, set to the size of the Nth option string including the terminating\n null character.\n\n @param[out] option If not NULL, then the first @p size characters of the Nth\n option string are copied into @p option. If NULL, no option string is\n copied, and only @p size is updated (useful in order to find the size of\n buffer required to copy the option string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were never\n set, or not set with @p amd_comgr_action_info_set_option_list.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, @p index is invalid, or @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query the data\n object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_option_list_item(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
index: usize,
|
||||
size: *mut usize,
|
||||
option: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set the working directory of an action info object.\n\n When an action info object is created it has an empty working\n directory. Some actions use the working directory to resolve\n relative file paths.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] path A null terminated string that is the working\n directory path. If NULL or the empty string then the working\n directory is cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_action_info_set_working_directory_path(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
path: *const ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the working directory path and/or working directory path\n length of an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p path. On return, if @p path is\n NULL, set to the size of the working directory path including the\n terminating null character.\n\n @param[out] path If not NULL, then the first @p size characters of\n the working directory path is copied. If the working directory path\n is not set then an empty string is copied. If NULL, the working\n directory path is not copied, and only @p size is updated (useful\n in order to find the size of buffer required to copy the working\n directory path).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_working_directory_path(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
size: *mut usize,
|
||||
path: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Set whether logging is enabled for an action info object.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] logging Whether logging should be enabled or disable.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."]
|
||||
pub fn amd_comgr_action_info_set_logging(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
logging: bool,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get whether logging is enabled for an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[out] logging Whether logging is enabled.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p logging is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_action_info_get_logging(
|
||||
action_info: amd_comgr_action_info_t,
|
||||
logging: *mut bool,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Preprocess each source data object in @p input in order. For each\n successful preprocessor invocation, add a source data object to @p result.\n Resolve any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the working\n directory path in @p info. Preprocess the source for the language in @p\n info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any preprocessing fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."]
|
||||
pub const AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(0);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Copy all existing data objects in @p input to @p output, then add the\n device-specific and language-specific precompiled headers required for\n compilation.\n\n Currently the only supported languages are @p AMD_COMGR_LANGUAGE_OPENCL_1_2\n and @p AMD_COMGR_LANGUAGE_OPENCL_2_0.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name or language\n is not set in @p info, or the language is not supported."]
|
||||
pub const AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(1);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a bc data object to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce bc for isa name in @p\n info. Compile the source for the language in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."]
|
||||
pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(2);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Copy all existing data objects in @p input to @p output, then add the\n device-specific and language-specific bitcode libraries required for\n compilation.\n\n Currently the only supported languages are @p AMD_COMGR_LANGUAGE_OPENCL_1_2,\n @p AMD_COMGR_LANGUAGE_OPENCL_2_0, and @p AMD_COMGR_LANGUAGE_HIP.\n\n The options in @p info should be set to a set of language-specific flags.\n For OpenCL and HIP these include:\n\n correctly_rounded_sqrt\n daz_opt\n finite_only\n unsafe_math\n wavefrontsize64\n\n For example, to enable daz_opt and unsafe_math, the options should be set\n as:\n\n const char *options[] = {\"daz_opt, \"unsafe_math\"};\n size_t optionsCount = sizeof(options) / sizeof(options[0]);\n amd_comgr_action_info_set_option_list(info, options, optionsCount);\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name or language\n is not set in @p info, the language is not supported, an unknown\n language-specific flag is supplied, or a language-specific flag is\n repeated.\n\n @deprecated since 1.7\n @warning This action, followed by @c AMD_COMGR_ACTION_LINK_BC_TO_BC, may\n result in subtle bugs due to incorrect linking of the device libraries.\n The @c AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC action can\n be used as a workaround which ensures the link occurs correctly."]
|
||||
pub const AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(3);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Link a collection of bitcodes, bundled bitcodes, and bundled bitcode\n archives in @p into a single composite (unbundled) bitcode @p.\n Any device library bc data object must be explicitly added to @p input if\n needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link or unbundling fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if IsaName is not set in @p info and does not match the isa name\n of all bc data objects in @p input, or if the Name field is not set for\n any DataObject in the input set."]
|
||||
pub const AMD_COMGR_ACTION_LINK_BC_TO_BC: amd_comgr_action_kind_s = amd_comgr_action_kind_s(4);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Optimize each bc data object in @p input and create an optimized bc data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if the optimization fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_OPTIMIZE_BC_TO_BC: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(5);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Perform code generation for each bc data object in @p input in\n order. For each successful code generation add a relocatable data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any code\n generation fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(6);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Perform code generation for each bc data object in @p input in\n order. For each successful code generation add an assembly source data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any code\n generation fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(7);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Link each relocatable data object in @p input together and add\n the linked relocatable data object to @p result. Any device\n library relocatable data object must be explicitly added to @p\n input if needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_RELOCATABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(8);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Link each relocatable data object in @p input together and add\n the linked executable data object to @p result. Any device\n library relocatable data object must be explicitly added to @p\n input if needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(9);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Assemble each source data object in @p input in order into machine code.\n For each successful assembly add a relocatable data object to @p result.\n Resolve any include source names using the names of include data objects in\n @p input. Resolve any include relative path names using the working\n directory path in @p info. Produce relocatable for isa name in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any assembly fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name is not set in\n @p info."]
|
||||
pub const AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(10);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Disassemble each relocatable data object in @p input in\n order. For each successful disassembly add a source data object to\n @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_DISASSEMBLE_RELOCATABLE_TO_SOURCE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(11);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Disassemble each executable data object in @p input in order. For\n each successful disassembly add a source data object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."]
|
||||
pub const AMD_COMGR_ACTION_DISASSEMBLE_EXECUTABLE_TO_SOURCE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(12);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Disassemble each bytes data object in @p input in order. For each\n successful disassembly add a source data object to @p\n result. Only simple assembly language commands are generate that\n corresponf to raw bytes are supported, not any directives that\n control the code object layout, or symbolic branch targets or\n names.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info"]
|
||||
pub const AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(13);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a fat binary to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce fat binary for isa name in @p\n info. Compile the source for the language in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info.\n\n @deprecated since 2.5\n @see in-process compilation via AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC, etc.\n insteaad"]
|
||||
pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_FATBIN: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(14);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a bc data object to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce bc for isa name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."]
|
||||
pub const AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(15);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Compile a single source data object in @p input in order. For each\n successful compilation add a relocatable data object to @p result.\n Resolve any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce relocatable for hip name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation. Currently only supports HIP language.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."]
|
||||
pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_RELOCATABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(16);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Compile each source data object in @p input and create a single executabele\n in @p result. Resolve any include source names using the names of include\n data objects in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce executable for isa name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."]
|
||||
pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_EXECUTABLE: amd_comgr_action_kind_s =
|
||||
amd_comgr_action_kind_s(17);
|
||||
}
|
||||
impl amd_comgr_action_kind_s {
|
||||
#[doc = " Marker for last valid action kind."]
|
||||
pub const AMD_COMGR_ACTION_LAST: amd_comgr_action_kind_s = amd_comgr_action_kind_s(17);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief The kinds of actions that can be performed."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_action_kind_s(pub ::std::os::raw::c_uint);
|
||||
#[doc = " @brief The kinds of actions that can be performed."]
|
||||
pub use self::amd_comgr_action_kind_s as amd_comgr_action_kind_t;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Perform an action.\n\n Each action ignores any data objects in @p input that it does not\n use. If logging is enabled in @info then @p result will have a log\n data object added. Any diagnostic data objects produced by the\n action will be added to @p result. See the description of each\n action in @p amd_comgr_action_kind_t.\n\n @param[in] kind The action to perform.\n\n @param[in] info The action info to use when performing the action.\n\n @param[in] input The input data objects to the @p kind action.\n\n @param[out] result Any data objects are removed before performing\n the action which then adds all data objects produced by the action.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported when executing the action.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n kind is an invalid action kind. @p input_data or @p result_data are\n invalid action data object handles. See the description of each\n action in @p amd_comgr_action_kind_t for other\n conditions that result in this status.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_do_action(
|
||||
kind: amd_comgr_action_kind_t,
|
||||
info: amd_comgr_action_info_t,
|
||||
input: amd_comgr_data_set_t,
|
||||
result: amd_comgr_data_set_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
impl amd_comgr_metadata_kind_s {
|
||||
#[doc = " The NULL metadata handle."]
|
||||
pub const AMD_COMGR_METADATA_KIND_NULL: amd_comgr_metadata_kind_s =
|
||||
amd_comgr_metadata_kind_s(0);
|
||||
}
|
||||
impl amd_comgr_metadata_kind_s {
|
||||
#[doc = " A sting value."]
|
||||
pub const AMD_COMGR_METADATA_KIND_STRING: amd_comgr_metadata_kind_s =
|
||||
amd_comgr_metadata_kind_s(1);
|
||||
}
|
||||
impl amd_comgr_metadata_kind_s {
|
||||
#[doc = " A map that consists of a set of key and value pairs."]
|
||||
pub const AMD_COMGR_METADATA_KIND_MAP: amd_comgr_metadata_kind_s = amd_comgr_metadata_kind_s(2);
|
||||
}
|
||||
impl amd_comgr_metadata_kind_s {
|
||||
#[doc = " A list that consists of a sequence of values."]
|
||||
pub const AMD_COMGR_METADATA_KIND_LIST: amd_comgr_metadata_kind_s =
|
||||
amd_comgr_metadata_kind_s(3);
|
||||
}
|
||||
impl amd_comgr_metadata_kind_s {
|
||||
#[doc = " Marker for last valid metadata kind."]
|
||||
pub const AMD_COMGR_METADATA_KIND_LAST: amd_comgr_metadata_kind_s =
|
||||
amd_comgr_metadata_kind_s(3);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief The kinds of metadata nodes."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_metadata_kind_s(pub ::std::os::raw::c_uint);
|
||||
#[doc = " @brief The kinds of metadata nodes."]
|
||||
pub use self::amd_comgr_metadata_kind_s as amd_comgr_metadata_kind_t;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the kind of the metadata node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] kind The kind of the metadata node.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node. @p kind is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."]
|
||||
pub fn amd_comgr_get_metadata_kind(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
kind: *mut amd_comgr_metadata_kind_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the string and/or string length from a metadata string\n node.\n\n @param[in] metadata The metadata node to query.\n\n @param[in, out] size On entry, the size of @p string. On return, if @p\n string is NULL, set to the size of the string including the terminating null\n character.\n\n @param[out] string If not NULL, then the first @p size characters\n of the string are copied. If NULL, no string is copied, and only @p\n size is updated (useful in order to find the size of buffer required\n to copy the string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or does not have kind @p\n AMD_COMGR_METADATA_KIND_STRING. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_metadata_string(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
size: *mut usize,
|
||||
string: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the map size from a metadata map node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] size The number of entries in the map.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_metadata_map_size(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
size: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Iterate over the elements a metadata map node.\n\n @warning The metadata nodes which are passed to the callback are not owned\n by the callback, and are freed just after the callback returns. The callback\n must not save any references to its parameters between iterations.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] callback The function to call for each entry in the map. The\n entry's key is passed in @p key, the entry's value is passed in @p value, and\n @p user_data is passed as @p user_data. If the function returns with a status\n other than @p AMD_COMGR_STATUS_SUCCESS then iteration is stopped.\n\n @param[in] user_data The value to pass to each invocation of @p\n callback. Allows context to be passed into the call back function.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported by @p callback.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to iterate the metadata as out of resources."]
|
||||
pub fn amd_comgr_iterate_map_metadata(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
key: amd_comgr_metadata_node_t,
|
||||
value: amd_comgr_metadata_node_t,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t,
|
||||
>,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Use a string key to lookup an element of a metadata map\n node and return the entry value.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] key A null terminated string that is the key to lookup.\n\n @param[out] value The metadata node of the @p key element of the\n @p metadata map metadata node. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The map has no entry\n with a string key with the value @p key.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p key or @p value is\n NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to lookup metadata as out of resources."]
|
||||
pub fn amd_comgr_metadata_lookup(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
key: *const ::std::os::raw::c_char,
|
||||
value: *mut amd_comgr_metadata_node_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Get the list size from a metadata list node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] size The number of entries in the list.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or does nopt have kind @p\n AMD_COMGR_METADATA_KIND_LIST. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."]
|
||||
pub fn amd_comgr_get_metadata_list_size(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
size: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Return the Nth metadata node of a list metadata node.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] index The index being requested. The first list element\n is index 0.\n\n @param[out] value The metadata node of the @p index element of the\n @p metadata list metadata node. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node or not of kind @p\n AMD_COMGR_METADATA_INFO_LIST. @p index is greater\n than the number of list elements. @p value is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action data object as out of resources."]
|
||||
pub fn amd_comgr_index_list_metadata(
|
||||
metadata: amd_comgr_metadata_node_t,
|
||||
index: usize,
|
||||
value: *mut amd_comgr_metadata_node_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Iterate over the symbols of a machine code object.\n\n For a AMD_COMGR_DATA_KIND_RELOCATABLE the symbols in the ELF symtab section\n are iterated. For a AMD_COMGR_DATA_KIND_EXECUTABLE the symbols in the ELF\n dynsymtab are iterated.\n\n @param[in] data The data object to query.\n\n @param[in] callback The function to call for each symbol in the machine code\n data object. The symbol handle is passed in @p symbol and @p user_data is\n passed as @p user_data. If the function returns with a status other than @p\n AMD_COMGR_STATUS_SUCCESS then iteration is stopped.\n\n @param[in] user_data The value to pass to each invocation of @p\n callback. Allows context to be passed into the call back function.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported by @p callback.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid data\n object, or not of kind @p AMD_COMGR_DATA_KIND_RELOCATABLE or\n AMD_COMGR_DATA_KIND_EXECUTABLE. @p callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to iterate the data object as out of resources."]
|
||||
pub fn amd_comgr_iterate_symbols(
|
||||
data: amd_comgr_data_t,
|
||||
callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
symbol: amd_comgr_symbol_t,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t,
|
||||
>,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Lookup a symbol in a machine code object by name.\n\n For a AMD_COMGR_DATA_KIND_RELOCATABLE the symbols in the ELF symtab section\n are inspected. For a AMD_COMGR_DATA_KIND_EXECUTABLE the symbols in the ELF\n dynsymtab are inspected.\n\n @param[in] data The data object to query.\n\n @param[in] name A null terminated string that is the symbol name to lookup.\n\n @param[out] symbol The symbol with the @p name.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The machine code object has no symbol\n with @p name.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid data\n object, or not of kind @p AMD_COMGR_DATA_KIND_RELOCATABLE or\n AMD_COMGR_DATA_KIND_EXECUTABLE.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to lookup symbol as out of resources."]
|
||||
pub fn amd_comgr_symbol_lookup(
|
||||
data: amd_comgr_data_t,
|
||||
name: *const ::std::os::raw::c_char,
|
||||
symbol: *mut amd_comgr_symbol_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol's type is unknown.\n\n The user should not infer any specific type for symbols which return\n `AMD_COMGR_SYMBOL_TYPE_UNKNOWN`, and these symbols may return different\n types in future releases."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_UNKNOWN: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(-1);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol's type is not specified."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_NOTYPE: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(0);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol is associated with a data object, such as a variable, an array,\n and so on."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_OBJECT: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(1);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol is associated with a function or other executable code."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_FUNC: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(2);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol is associated with a section. Symbol table entries of this type\n exist primarily for relocation."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_SECTION: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(3);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " Conventionally, the symbol's name gives the name of the source file\n associated with the object file."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_FILE: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(4);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol labels an uninitialized common block."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_COMMON: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(5);
|
||||
}
|
||||
impl amd_comgr_symbol_type_s {
|
||||
#[doc = " The symbol is associated with an AMDGPU Code Object V2 kernel function."]
|
||||
pub const AMD_COMGR_SYMBOL_TYPE_AMDGPU_HSA_KERNEL: amd_comgr_symbol_type_s =
|
||||
amd_comgr_symbol_type_s(10);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief Machine code object symbol type."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_symbol_type_s(pub ::std::os::raw::c_int);
|
||||
#[doc = " @brief Machine code object symbol type."]
|
||||
pub use self::amd_comgr_symbol_type_s as amd_comgr_symbol_type_t;
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " The length of the symbol name in bytes. Does not include the NUL\n terminator. The type of this attribute is uint64_t."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_NAME_LENGTH: amd_comgr_symbol_info_s =
|
||||
amd_comgr_symbol_info_s(0);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " The name of the symbol. The type of this attribute is character array with\n the length equal to the value of the @p AMD_COMGR_SYMBOL_INFO_NAME_LENGTH\n attribute plus 1 for a NUL terminator."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_NAME: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(1);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " The kind of the symbol. The type of this attribute is @p\n amd_comgr_symbol_type_t."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_TYPE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(2);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " Size of the variable. The value of this attribute is undefined if the\n symbol is not a variable. The type of this attribute is uint64_t."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_SIZE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(3);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " Indicates whether the symbol is undefined. The type of this attribute is\n bool."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_IS_UNDEFINED: amd_comgr_symbol_info_s =
|
||||
amd_comgr_symbol_info_s(4);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " The value of the symbol. The type of this attribute is uint64_t."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_VALUE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(5);
|
||||
}
|
||||
impl amd_comgr_symbol_info_s {
|
||||
#[doc = " Marker for last valid symbol info."]
|
||||
pub const AMD_COMGR_SYMBOL_INFO_LAST: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(5);
|
||||
}
|
||||
#[repr(transparent)]
|
||||
#[doc = " @brief Machine code object symbol attributes."]
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct amd_comgr_symbol_info_s(pub ::std::os::raw::c_uint);
|
||||
#[doc = " @brief Machine code object symbol attributes."]
|
||||
pub use self::amd_comgr_symbol_info_s as amd_comgr_symbol_info_t;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Query information about a machine code object symbol.\n\n @param[in] symbol The symbol to query.\n\n @param[in] attribute Attribute to query.\n\n @param[out] value Pointer to an application-allocated buffer where to store\n the value of the attribute. If the buffer passed by the application is not\n large enough to hold the value of attribute, the behavior is undefined. The\n type of value returned is specified by @p amd_comgr_symbol_info_t.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The @p symbol does not have the requested @p\n attribute.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p symbol is an invalid\n symbol. @p attribute is an invalid value. @p value is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to query symbol as out of resources."]
|
||||
pub fn amd_comgr_symbol_get_info(
|
||||
symbol: amd_comgr_symbol_t,
|
||||
attribute: amd_comgr_symbol_info_t,
|
||||
value: *mut ::std::os::raw::c_void,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Create a disassembly info object.\n\n @param[in] isa_name A null terminated string that is the isa name of the\n target to disassemble for. The isa name is defined as the Code Object Target\n Identification string, described at\n https://llvm.org/docs/AMDGPUUsage.html#code-object-target-identification\n\n @param[in] read_memory_callback Function called to request @p size bytes\n from the program address space at @p from be read into @p to. The requested\n @p size is never zero. Returns the number of bytes which could be read, with\n the guarantee that no additional bytes will be available in any subsequent\n call.\n\n @param[in] print_instruction_callback Function called after a successful\n disassembly. @p instruction is a null terminated string containing the\n disassembled instruction. The callback does not own @p instruction, and it\n cannot be referenced once the callback returns.\n\n @param[in] print_address_annotation_callback Function called after @c\n print_instruction_callback returns, once for each instruction operand which\n was resolved to an absolute address. @p address is the absolute address in\n the program address space. It is intended to append a symbolic\n form of the address, perhaps as a comment, after the instruction disassembly\n produced by @c print_instruction_callback.\n\n @param[out] disassembly_info A handle to the disassembly info object\n created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly info object was created.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p isa_name is NULL or\n invalid; or @p read_memory_callback, @p print_instruction_callback,\n or @p print_address_annotation_callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to create the\n disassembly info object as out of resources."]
|
||||
pub fn amd_comgr_create_disassembly_info(
|
||||
isa_name: *const ::std::os::raw::c_char,
|
||||
read_memory_callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
from: u64,
|
||||
to: *mut ::std::os::raw::c_char,
|
||||
size: u64,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
) -> u64,
|
||||
>,
|
||||
print_instruction_callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
instruction: *const ::std::os::raw::c_char,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
),
|
||||
>,
|
||||
print_address_annotation_callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(address: u64, user_data: *mut ::std::os::raw::c_void),
|
||||
>,
|
||||
disassembly_info: *mut amd_comgr_disassembly_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Destroy a disassembly info object.\n\n @param[in] disassembly_info A handle to the disassembly info object to\n destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly info object was\n destroyed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p disassembly_info is an\n invalid disassembly info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to destroy the\n disassembly info object as out of resources."]
|
||||
pub fn amd_comgr_destroy_disassembly_info(
|
||||
disassembly_info: amd_comgr_disassembly_info_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Disassemble a single instruction.\n\n @param[in] address The address of the first byte of the instruction in the\n program address space.\n\n @param[in] user_data Arbitrary user-data passed to each callback function\n during disassembly.\n\n @param[out] size The number of bytes consumed to decode the\n instruction, or consumed while failing to decode an invalid instruction.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly was successful.\n\n @retval ::AMD_COMGR_STATUS_ERROR The disassembly failed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p disassembly_info is\n invalid or @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to disassemble the\n instruction as out of resources."]
|
||||
pub fn amd_comgr_disassemble_instruction(
|
||||
disassembly_info: amd_comgr_disassembly_info_t,
|
||||
address: u64,
|
||||
user_data: *mut ::std::os::raw::c_void,
|
||||
size: *mut u64,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Demangle a symbol name.\n\n @param[in] mangled_symbol_name A data object of kind @p\n AMD_COMGR_DATA_KIND_BYTES containing the mangled symbol name.\n\n @param[out] demangled_symbol_name A handle to the data object of kind @p\n AMD_COMGR_DATA_KIND_BYTES created and set to contain the demangled symbol\n name in case of successful completion. The handle must be released using\n @c amd_comgr_release_data. @p demangled_symbol_name is not updated for\n an error case.\n\n @note If the @p mangled_symbol_name cannot be demangled, it will be copied\n without changes to the @p demangled_symbol_name and AMD_COMGR_STATUS_SUCCESS\n is returned.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p mangled_symbol_name is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_BYTES or\n @p demangled_symbol_name is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Out of resources."]
|
||||
pub fn amd_comgr_demangle_symbol_name(
|
||||
mangled_symbol_name: amd_comgr_data_t,
|
||||
demangled_symbol_name: *mut amd_comgr_data_t,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Fetch mangled symbol names from a code object.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC\n\n @param[out] count The number of mangled names retrieved. This value\n can be used as an upper bound to the Index provided to the corresponding\n amd_comgr_get_mangled_name() call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_EXECUTABLE or\n @p AMD_COMGR_DATA_KIND_BC.\n"]
|
||||
pub fn amd_comgr_populate_mangled_names(
|
||||
data: amd_comgr_data_t,
|
||||
count: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Fetch the Nth specific mangled name from a set of populated names or\n that name's length.\n\n The @p data must have had its mangled names populated with @p\n amd_comgr_populate_mangled_names.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC used to\n identify which set of mangled names to retrive from.\n\n @param[in] index The index of the mangled name to be returned.\n\n @param[in, out] size For out, the size of @p mangled_name. For in,\n if @mangled_name is NULL, set to the size of the Nth option string including\n the terminating null character.\n\n @param[out] mangled_name If not NULL, then the first @p size characters of\n the Nth mangled name string are copied into @p mangled_name. If NULL, no\n mangled name string is copied, and only @p size is updated (useful in order\n to find the size of the buffer requried to copy the mangled_name string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR @p data has not been used to\n populate a set of mangled names, or index is greater than the count of\n mangled names for that data object\n"]
|
||||
pub fn amd_comgr_get_mangled_name(
|
||||
data: amd_comgr_data_t,
|
||||
index: usize,
|
||||
size: *mut usize,
|
||||
mangled_name: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Populate a name expression map from a given code object.\n\n Used to map stub names *__amdgcn_name_expr_* in bitcodes and code\n objects generated by hip runtime to an associated (unmangled) name\n expression and (mangled) symbol name.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC\n\n @param[out] count The number of name expressions mapped. This value\n can be used as an upper bound to the Index provided to the corresponding\n amd_comgr_map_name_expression_to_symbol_name() call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_EXECUTABLE or\n @p AMD_COMGR_DATA_KIND_BC.\n\n @retval ::AMD_COMGR_STATUS_ERROR LLVM API failure, which should be\n accompanied by an LLVM error message to stderr\n"]
|
||||
pub fn amd_comgr_populate_name_expression_map(
|
||||
data: amd_comgr_data_t,
|
||||
count: *mut usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @brief Fetch a related symbol name for a given name expression;\n or that name's length.\n\n The @p data must have had its name expression map populated with @p\n amd_comgr_populate_name_expression_map.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC used to\n identify which map of name expressions to retrieve from.\n\n @param[in, out] size For out, the size of @p symbol_name. For in,\n if @symbol_name is NULL, set to the size of the Nth option string including\n the terminating null character.\n\n @param[in] name_expression A character array of a name expression. This name\n is used as the key to the name expression map in order to locate the desired\n @symbol_name.\n\n @param[out] symbol_name If not NULL, then the first @p size characters of\n the symbol name string mapped from @name_expression are copied into @p\n symbol_name. If NULL, no symbol name string is copied, and only @p size is\n updated (useful in order to find the size of the buffer required to copy the\n symbol_name string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR @p data object is not valid (NULL or not of\n type bitcode or code object)\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p name_expression is not\n present in the name expression map.\n"]
|
||||
pub fn amd_comgr_map_name_expression_to_symbol_name(
|
||||
data: amd_comgr_data_t,
|
||||
size: *mut usize,
|
||||
name_expression: *mut ::std::os::raw::c_char,
|
||||
symbol_name: *mut ::std::os::raw::c_char,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
#[doc = " @brief A data structure for Code object information."]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct code_object_info_s {
|
||||
#[doc = " ISA name representing the code object."]
|
||||
pub isa: *const ::std::os::raw::c_char,
|
||||
#[doc = " The size of the code object."]
|
||||
pub size: usize,
|
||||
pub offset: u64,
|
||||
}
|
||||
#[doc = " @brief A data structure for Code object information."]
|
||||
pub type amd_comgr_code_object_info_t = code_object_info_s;
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @ brief Given a bundled code object and list of target id strings, extract\n correponding code object information.\n\n @param[in] data The data object for bundled code object. This should be\n of kind AMD_COMGR_DATA_KIND_FATBIN or AMD_COMGR_DATA_KIND_EXECUTABLE or\n AMD_COMGR_DATA_KIND_BYTES. The API interprets the data object of kind\n AMD_COMGR_DATA_KIND_FATBIN as a clang offload bundle and of kind\n AMD_COMGR_DATA_KIND_EXECUTABLE as an executable shared object. For a data\n object of type AMD_COMGR_DATA_KIND_BYTES the API first inspects the data\n passed to determine if it is a fatbin or an executable and performs\n the lookup.\n\n @param[in, out] info_list A list of code object information structure\n initialized with null terminated target id strings. If the target id\n is matched in the code object bundle the corresponding code object\n information is updated with offset and size of the code object. If the\n target id is not found the offset and size are set to 0.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The code object bundle header is incorrect\n or reading bundle entries failed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is not of\n kind AMD_COMGR_DATA_KIND_FATBIN, or AMD_COMGR_DATA_KIND_BYTES or\n AMD_COMGR_DATA_KIND_EXECUTABLE or either @p info_list is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if the @p data has\n invalid data."]
|
||||
pub fn amd_comgr_lookup_code_object(
|
||||
data: amd_comgr_data_t,
|
||||
info_list: *mut amd_comgr_code_object_info_t,
|
||||
info_list_size: usize,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
||||
extern "C" {
|
||||
#[must_use]
|
||||
#[doc = " @ brief Given a code object and an ELF virtual address, map the ELF virtual\n address to a code object offset. Also, determine if the ELF virtual address\n maps to an offset in a data region that is defined by the ELF file, but that\n does not occupy bytes in the ELF file. This is typically true of offsets that\n that refer to runtime or heap allocated memory. For ELF files with defined\n sections, these data regions are referred to as NOBITS or .bss sections.\n\n @param[in] data The data object to be inspected for the given ELF virtual\n address. This should be of kind AMD_COMGR_DATA_KIND_EXECUTABLE.\n\n @param[in] elf_virtual_address The address used to calculate the code object\n offset.\n\n @param[out] code_object_offset The code object offset returned to the caller\n based on the given ELF virtual address.\n\n @param[out] slice_size For nobits regions: the size in bytes, starting from\n the provided virtual address up to the end of the segment. In this case, the\n slice size represents the number of contiguous unreadable addresses following\n the provided address.\n\n For bits regions: the size in bytes, starting from the provided virtual\n address up to either the end of the segment, or the start of a NOBITS region.\n In this case, slice size represents the number of contiguous readable\n addresses following the provided address.\n\n @param[out] nobits Set to true if the code object offset points to a location\n in a data region that does not occupy bytes in the ELF file, as described\n above.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The provided code object has an invalid\n header due to a mismatch in magic, class, data, version, abi, type, or\n machine.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is not of\n kind AMD_COMGR_DATA_KIND_EXECUTABLE or invalid, or that the provided @p\n elf_virtual_address is not within the ranges covered by the object's\n load-type program headers."]
|
||||
pub fn amd_comgr_map_elf_virtual_address_to_code_object_offset(
|
||||
data: amd_comgr_data_t,
|
||||
elf_virtual_address: u64,
|
||||
code_object_offset: *mut u64,
|
||||
slice_size: *mut u64,
|
||||
nobits: *mut bool,
|
||||
) -> amd_comgr_status_t;
|
||||
}
|
3
ext/amd_comgr-sys/src/lib.rs
vendored
Normal file
3
ext/amd_comgr-sys/src/lib.rs
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#![allow(warnings)]
|
||||
pub mod amd_comgr;
|
||||
pub use amd_comgr::*;
|
@ -2,10 +2,7 @@
|
||||
name = "hip_runtime-sys"
|
||||
version = "0.0.0"
|
||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
links = "amdhip"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
rustc-hash = "1.1"
|
@ -2,8 +2,8 @@ use std::env::VarError;
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
fn main() -> Result<(), VarError> {
|
||||
println!("cargo:rustc-link-lib=dylib=atiadlxx");
|
||||
if cfg!(windows) {
|
||||
println!("cargo:rustc-link-lib=dylib=amdhip64_6");
|
||||
let env = env::var("CARGO_CFG_TARGET_ENV")?;
|
||||
if env == "msvc" {
|
||||
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
|
||||
@ -13,6 +13,7 @@ fn main() -> Result<(), VarError> {
|
||||
println!("cargo:rustc-link-search=native=C:\\Windows\\System32");
|
||||
};
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=dylib:+verbatim=libamdhip64.so.6");
|
||||
println!("cargo:rustc-link-search=native=/opt/rocm/lib/");
|
||||
}
|
||||
Ok(())
|
@ -1,18 +1,25 @@
|
||||
;
|
||||
; Definition file of amdhip64.dll
|
||||
; Definition file of amdhip64_6.dll
|
||||
; Automatic generated by gendef
|
||||
; written by Kai Tietz 2008
|
||||
;
|
||||
LIBRARY "amdhip64.dll"
|
||||
LIBRARY "amdhip64_6.dll"
|
||||
EXPORTS
|
||||
hipCreateSurfaceObject
|
||||
hipDestroySurfaceObject
|
||||
hipExtModuleLaunchKernel
|
||||
hipHccModuleLaunchKernel
|
||||
hipModuleLaunchKernelExt
|
||||
; enum hipError_t __cdecl hipExtModuleLaunchKernel(struct ihipModuleSymbol_t *__ptr64,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned __int64,struct ihipStream_t *__ptr64,void *__ptr64 *__ptr64,void *__ptr64 *__ptr64,struct ihipEvent_t *__ptr64,struct ihipEvent_t *__ptr64,unsigned int)
|
||||
?hipExtModuleLaunchKernel@@YA?AW4hipError_t@@PEAUihipModuleSymbol_t@@IIIIII_KPEAUihipStream_t@@PEAPEAX3PEAUihipEvent_t@@4I@Z
|
||||
hipExternalMemoryGetMappedMipmappedArray
|
||||
hipGraphAddExternalSemaphoresSignalNode
|
||||
hipGraphAddExternalSemaphoresWaitNode
|
||||
hipGraphExecExternalSemaphoresSignalNodeSetParams
|
||||
hipGraphExecExternalSemaphoresWaitNodeSetParams
|
||||
hipGraphExternalSemaphoresSignalNodeGetParams
|
||||
hipGraphExternalSemaphoresSignalNodeSetParams
|
||||
hipGraphExternalSemaphoresWaitNodeGetParams
|
||||
hipGraphExternalSemaphoresWaitNodeSetParams
|
||||
; enum hipError_t __cdecl hipHccModuleLaunchKernel(struct ihipModuleSymbol_t *__ptr64,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned __int64,struct ihipStream_t *__ptr64,void *__ptr64 *__ptr64,void *__ptr64 *__ptr64,struct ihipEvent_t *__ptr64,struct ihipEvent_t *__ptr64)
|
||||
?hipHccModuleLaunchKernel@@YA?AW4hipError_t@@PEAUihipModuleSymbol_t@@IIIIII_KPEAUihipStream_t@@PEAPEAX3PEAUihipEvent_t@@4@Z
|
||||
hipTexRefGetArray
|
||||
hipTexRefGetBorderColor
|
||||
hipTexRefGetMipmappedArray
|
||||
AMD_CPU_AFFINITY DATA
|
||||
AMD_DIRECT_DISPATCH DATA
|
||||
AMD_GPU_FORCE_SINGLE_FP_DENORM DATA
|
||||
@ -23,7 +30,6 @@ AMD_OCL_BUILD_OPTIONS DATA
|
||||
AMD_OCL_BUILD_OPTIONS_APPEND DATA
|
||||
AMD_OCL_LINK_OPTIONS DATA
|
||||
AMD_OCL_LINK_OPTIONS_APPEND DATA
|
||||
AMD_OCL_SC_LIB DATA
|
||||
AMD_OCL_WAIT_COMMAND DATA
|
||||
AMD_OPT_FLUSH DATA
|
||||
AMD_SERIALIZE_COPY DATA
|
||||
@ -32,75 +38,64 @@ AMD_THREAD_TRACE_ENABLE DATA
|
||||
CL_KHR_FP64 DATA
|
||||
CQ_THREAD_STACK_SIZE DATA
|
||||
CUDA_VISIBLE_DEVICES DATA
|
||||
DEBUG_CLR_GRAPH_PACKET_CAPTURE DATA
|
||||
DEBUG_CLR_LIMIT_BLIT_WG DATA
|
||||
DEBUG_HIP_GRAPH_DOT_PRINT DATA
|
||||
DISABLE_DEFERRED_ALLOC DATA
|
||||
GPU_ADD_HBCC_SIZE DATA
|
||||
GPU_ANALYZE_HANG DATA
|
||||
GPU_BLIT_ENGINE_TYPE DATA
|
||||
GPU_CP_DMA_COPY_SIZE DATA
|
||||
GPU_DEBUG_ENABLE DATA
|
||||
GPU_DEVICE_ORDINAL DATA
|
||||
GPU_DUMP_BLIT_KERNELS DATA
|
||||
GPU_DUMP_CODE_OBJECT DATA
|
||||
GPU_ENABLE_COOP_GROUPS DATA
|
||||
GPU_ENABLE_HW_P2P DATA
|
||||
GPU_ENABLE_LARGE_ALLOCATION DATA
|
||||
GPU_ENABLE_LC DATA
|
||||
GPU_ENABLE_PAL DATA
|
||||
GPU_ENABLE_WAVE32_MODE DATA
|
||||
GPU_ENABLE_WGP_MODE DATA
|
||||
GPU_FLUSH_ON_EXECUTION DATA
|
||||
GPU_FORCE_64BIT_PTR DATA
|
||||
GPU_FORCE_BLIT_COPY_SIZE DATA
|
||||
GPU_FORCE_OCL20_32BIT DATA
|
||||
GPU_FORCE_QUEUE_PROFILING DATA
|
||||
GPU_IFH_MODE DATA
|
||||
GPU_IMAGE_BUFFER_WAR DATA
|
||||
GPU_IMAGE_DMA DATA
|
||||
GPU_MAX_COMMAND_BUFFERS DATA
|
||||
GPU_MAX_COMMAND_QUEUES DATA
|
||||
GPU_MAX_HEAP_SIZE DATA
|
||||
GPU_MAX_HW_QUEUES DATA
|
||||
GPU_MAX_REMOTE_MEM_SIZE DATA
|
||||
GPU_MAX_SUBALLOC_SIZE DATA
|
||||
GPU_MAX_USWC_ALLOC_SIZE DATA
|
||||
GPU_MAX_WORKGROUP_SIZE DATA
|
||||
GPU_MAX_WORKGROUP_SIZE_2D_X DATA
|
||||
GPU_MAX_WORKGROUP_SIZE_2D_Y DATA
|
||||
GPU_MAX_WORKGROUP_SIZE_3D_X DATA
|
||||
GPU_MAX_WORKGROUP_SIZE_3D_Y DATA
|
||||
GPU_MAX_WORKGROUP_SIZE_3D_Z DATA
|
||||
GPU_MIPMAP DATA
|
||||
GPU_NUM_COMPUTE_RINGS DATA
|
||||
GPU_NUM_MEM_DEPENDENCY DATA
|
||||
GPU_PINNED_MIN_XFER_SIZE DATA
|
||||
GPU_PINNED_XFER_SIZE DATA
|
||||
GPU_PRINT_CHILD_KERNEL DATA
|
||||
GPU_RAW_TIMESTAMP DATA
|
||||
GPU_RESOURCE_CACHE_SIZE DATA
|
||||
GPU_SELECT_COMPUTE_RINGS_ID DATA
|
||||
GPU_SINGLE_ALLOC_PERCENT DATA
|
||||
GPU_STAGING_BUFFER_SIZE DATA
|
||||
GPU_STREAMOPS_CP_WAIT DATA
|
||||
GPU_USE_DEVICE_QUEUE DATA
|
||||
GPU_USE_SINGLE_SCRATCH DATA
|
||||
GPU_USE_SYNC_OBJECTS DATA
|
||||
GPU_WAVES_PER_SIMD DATA
|
||||
GPU_WAVE_LIMIT_ENABLE DATA
|
||||
GPU_WORKLOAD_SPLIT DATA
|
||||
GPU_XFER_BUFFER_SIZE DATA
|
||||
HIPRTC_COMPILE_OPTIONS_APPEND DATA
|
||||
HIPRTC_LINK_OPTIONS_APPEND DATA
|
||||
HIPRTC_USE_RUNTIME_UNBUNDLER DATA
|
||||
HIP_FORCE_DEV_KERNARG DATA
|
||||
HIP_HIDDEN_FREE_MEM DATA
|
||||
HIP_HOST_COHERENT DATA
|
||||
HIP_INITIAL_DM_SIZE DATA
|
||||
HIP_LAUNCH_BLOCKING DATA
|
||||
HIP_MEM_POOL_SUPPORT DATA
|
||||
HIP_MEM_POOL_USE_VM DATA
|
||||
HIP_USE_RUNTIME_UNBUNDLER DATA
|
||||
HIP_VISIBLE_DEVICES DATA
|
||||
HSA_ENABLE_COARSE_GRAIN_SVM DATA
|
||||
HIP_VMEM_MANAGE_SUPPORT DATA
|
||||
HSA_KERNARG_POOL_SIZE DATA
|
||||
HSA_LOCAL_MEMORY_ENABLE DATA
|
||||
OCL_CODE_CACHE_ENABLE DATA
|
||||
OCL_CODE_CACHE_RESET DATA
|
||||
OCL_SET_SVM_SIZE DATA
|
||||
OCL_STUB_PROGRAMS DATA
|
||||
OPENCL_VERSION DATA
|
||||
@ -108,6 +103,7 @@ PAL_ALWAYS_RESIDENT DATA
|
||||
PAL_DISABLE_SDMA DATA
|
||||
PAL_EMBED_KERNEL_MD DATA
|
||||
PAL_FORCE_ASIC_REVISION DATA
|
||||
PAL_HIP_IPC_FLAG DATA
|
||||
PAL_MALL_POLICY DATA
|
||||
PAL_PREPINNED_MEMORY_SIZE DATA
|
||||
PAL_RGP_DISP_COUNT DATA
|
||||
@ -116,12 +112,10 @@ ROC_ACTIVE_WAIT_TIMEOUT DATA
|
||||
ROC_AQL_QUEUE_SIZE DATA
|
||||
ROC_CPU_WAIT_FOR_SIGNAL DATA
|
||||
ROC_ENABLE_LARGE_BAR DATA
|
||||
ROC_ENABLE_PRE_VEGA DATA
|
||||
ROC_GLOBAL_CU_MASK DATA
|
||||
ROC_HMM_FLAGS DATA
|
||||
ROC_P2P_SDMA_SIZE DATA
|
||||
ROC_SIGNAL_POOL_SIZE DATA
|
||||
ROC_SKIP_COPY_SYNC DATA
|
||||
ROC_SKIP_KERNEL_ARG_COPY DATA
|
||||
ROC_SYSTEM_SCOPE_SIGNAL DATA
|
||||
ROC_USE_FGS_KERNARG DATA
|
||||
@ -151,8 +145,11 @@ hipBindTexture2D
|
||||
hipBindTextureToArray
|
||||
hipBindTextureToMipmappedArray
|
||||
hipChooseDevice
|
||||
hipChooseDeviceR0000
|
||||
hipChooseDeviceR0600
|
||||
hipConfigureCall
|
||||
hipCreateChannelDesc
|
||||
hipCreateSurfaceObject
|
||||
hipCreateTextureObject
|
||||
hipCtxCreate
|
||||
hipCtxDestroy
|
||||
@ -172,6 +169,7 @@ hipCtxSetSharedMemConfig
|
||||
hipCtxSynchronize
|
||||
hipDestroyExternalMemory
|
||||
hipDestroyExternalSemaphore
|
||||
hipDestroySurfaceObject
|
||||
hipDestroyTextureObject
|
||||
hipDeviceCanAccessPeer
|
||||
hipDeviceComputeCapability
|
||||
@ -208,6 +206,8 @@ hipDeviceTotalMem
|
||||
hipDriverGetVersion
|
||||
hipDrvGetErrorName
|
||||
hipDrvGetErrorString
|
||||
hipDrvGraphAddMemcpyNode
|
||||
hipDrvGraphAddMemsetNode
|
||||
hipDrvMemcpy2DUnaligned
|
||||
hipDrvMemcpy3D
|
||||
hipDrvMemcpy3DAsync
|
||||
@ -220,10 +220,12 @@ hipEventQuery
|
||||
hipEventRecord
|
||||
hipEventRecord_spt
|
||||
hipEventSynchronize
|
||||
hipExtGetLastError
|
||||
hipExtGetLinkTypeAndHopCount
|
||||
hipExtLaunchKernel
|
||||
hipExtLaunchMultiKernelMultiDevice
|
||||
hipExtMallocWithFlags
|
||||
hipExtModuleLaunchKernel
|
||||
hipExtStreamCreateWithCUMask
|
||||
hipExtStreamGetCUMask
|
||||
hipExternalMemoryGetMappedBuffer
|
||||
@ -244,6 +246,8 @@ hipGetDevice
|
||||
hipGetDeviceCount
|
||||
hipGetDeviceFlags
|
||||
hipGetDeviceProperties
|
||||
hipGetDevicePropertiesR0000
|
||||
hipGetDevicePropertiesR0600
|
||||
hipGetErrorName
|
||||
hipGetErrorString
|
||||
hipGetLastError
|
||||
@ -332,6 +336,7 @@ hipGraphicsResourceGetMappedPointer
|
||||
hipGraphicsSubResourceGetMappedArray
|
||||
hipGraphicsUnmapResources
|
||||
hipGraphicsUnregisterResource
|
||||
hipHccModuleLaunchKernel
|
||||
hipHostAlloc
|
||||
hipHostFree
|
||||
hipHostGetDevicePointer
|
||||
@ -537,6 +542,7 @@ hipTexRefGetFilterMode
|
||||
hipTexRefGetFlags
|
||||
hipTexRefGetFormat
|
||||
hipTexRefGetMaxAnisotropy
|
||||
hipTexRefGetMipMappedArray
|
||||
hipTexRefGetMipmapFilterMode
|
||||
hipTexRefGetMipmapLevelBias
|
||||
hipTexRefGetMipmapLevelClamp
|
BIN
ext/hip_runtime-sys/lib/amdhip64_6.lib
vendored
Normal file
BIN
ext/hip_runtime-sys/lib/amdhip64_6.lib
vendored
Normal file
Binary file not shown.
12668
ext/hip_runtime-sys/src/lib.rs
vendored
Normal file
12668
ext/hip_runtime-sys/src/lib.rs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
ext/llvm-project
vendored
2
ext/llvm-project
vendored
@ -1 +1 @@
|
||||
Subproject commit 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a
|
||||
Subproject commit 6009708b4367171ccdbf4b5905cb6a803753fe18
|
3
ext/llvm-sys.rs/.gitignore
vendored
3
ext/llvm-sys.rs/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
# Generated by Cargo.
|
||||
/target
|
||||
Cargo.lock
|
19
ext/llvm-sys.rs/.gitlab-ci.yml
vendored
19
ext/llvm-sys.rs/.gitlab-ci.yml
vendored
@ -1,19 +0,0 @@
|
||||
image: rust:buster
|
||||
|
||||
variables:
|
||||
LLVM_SYS_150_FFI_WORKAROUND: "YES"
|
||||
|
||||
before_script:
|
||||
- apt-get update -qq && apt-get install -qq -y lsb-release software-properties-common
|
||||
- wget https://apt.llvm.org/llvm.sh
|
||||
- chmod +x llvm.sh
|
||||
- ./llvm.sh 15
|
||||
- apt-get install libpolly-15-dev
|
||||
|
||||
test:
|
||||
script:
|
||||
- cargo build
|
||||
- cargo test
|
||||
- cargo run --example nop-function
|
||||
- cargo run --example jit-function
|
||||
- echo "Hello, world!" | cargo run --example disassembler
|
21
ext/llvm-sys.rs/Cargo.toml
vendored
21
ext/llvm-sys.rs/Cargo.toml
vendored
@ -1,21 +0,0 @@
|
||||
[package]
|
||||
description = "Bindings to LLVM's C API"
|
||||
repository = "https://gitlab.com/taricorp/llvm-sys.rs"
|
||||
readme = "README.md"
|
||||
license = "MIT"
|
||||
keywords = ["bindings", "llvm"]
|
||||
categories = ["external-ffi-bindings"]
|
||||
links = "llvm-15"
|
||||
name = "llvm-sys"
|
||||
version = "150.1.2"
|
||||
authors = [
|
||||
"Peter Marheine <peter@taricorp.net>",
|
||||
]
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
cmake = "0.1"
|
||||
convert_case = "0.5"
|
19
ext/llvm-sys.rs/LICENSE
vendored
19
ext/llvm-sys.rs/LICENSE
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2015 Peter Marheine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
188
ext/llvm-sys.rs/README.md
vendored
188
ext/llvm-sys.rs/README.md
vendored
@ -1,188 +0,0 @@
|
||||
Rust bindings to LLVM's C API.
|
||||
|
||||
# Usage
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
llvm-sys = "150"
|
||||
```
|
||||
|
||||
There must be a compatible version of LLVM available. By default `llvm-sys`
|
||||
will look for `llvm-config` on `PATH` to find a system-wide copy of LLVM and
|
||||
use that if it is a compatible version. Custom options for finding LLVM
|
||||
on your system can be specified via environment variables. See
|
||||
[LLVM compatibility](#llvm-compatibility) for more information.
|
||||
|
||||
## Documentation
|
||||
|
||||
See the `examples` directory in this repository for API examples. There also
|
||||
exist some other projects using these bindings which may be
|
||||
informative or useful:
|
||||
|
||||
* Safe, "Rusty" APIs for using LLVM:
|
||||
* [Inkwell](https://github.com/TheDan64/inkwell)
|
||||
* [llvm-ir](https://github.com/cdisselkoen/llvm-ir)
|
||||
* [Tari's merthc](https://bitbucket.org/tari/merthc)
|
||||
* [Wilfred's BF compiler](https://crates.io/crates/bfc)
|
||||
* Jay Phelps wrote about [building a minimal compiler targeting
|
||||
WebAssembly](https://medium.com/@jayphelps/93e8c193fdb4)
|
||||
|
||||
Most of the interfaces are not documented in these bindings. Refer to the
|
||||
[LLVM documentation](http://llvm.org/docs/) for more information, particularly
|
||||
the [generated API documentation](http://llvm.org/doxygen/).
|
||||
|
||||
If you have your own project using these bindings that you think is worth
|
||||
mentioning here, by all means let me know.
|
||||
|
||||
## LLVM compatibility
|
||||
|
||||
Because the LLVM C [API stability guarantees][c-api-stability] are relatively
|
||||
weak, this crate enforces that the LLVM release in use match the one it was made
|
||||
for. The crate version is constructed by treating the LLVM version as a real
|
||||
number and multiplying by 10, ignoring any fractional part. Thus `llvm-sys`
|
||||
version 37 is compatible with LLVM 3.7.x, and `llvm-sys` 41 would be compatible
|
||||
with LLVM 4.1.x.
|
||||
|
||||
[c-api-stability]: http://llvm.org/docs/DeveloperPolicy.html#c-api-changes
|
||||
|
||||
The build scripts will not enforce this compatibility matrix strictly,
|
||||
permitting compilation against any version of LLVM that is at least as new as
|
||||
the crate target version. This is safe in most cases because the LLVM C API is
|
||||
meant to maintain binary compatibility across releases with the exception of
|
||||
when functions are deprecated and later removed. An incompatible LLVM version
|
||||
will generally fail to compile with a link-time error, rather than cause runtime
|
||||
errors. Where versions are known to break binary compatibility, the build script
|
||||
will prevent compilation.
|
||||
|
||||
Depending on your use of the C API, your program may require that only a
|
||||
version of LLVM exactly matching your crate version be allowed. This can be set
|
||||
with the cargo feature flag `strict-versioning` or by setting the environment
|
||||
variable `LLVM_SYS_<version>_STRICT_VERSIONING` (where `<version>` is the target
|
||||
crate version) to any value.
|
||||
|
||||
llvm-sys blocklists some versions of LLVM that are known to be
|
||||
binary-incompatible. If you're feeling lucky, setting
|
||||
`LLVM_SYS_<version>_IGNORE_BLOCKLIST` to "YES" will permit the use of
|
||||
blocklisted library versions (which may cause vexing bugs).
|
||||
|
||||
---
|
||||
|
||||
This crate declares that it links to `llvm-<MAJOR VERSION>`, not just `llvm`.
|
||||
This makes it possible to declare a crate that depends on multiple
|
||||
versions of `llvm-sys` (corresponding to different versions of LLVM) as long as
|
||||
only one of them is actually used:
|
||||
|
||||
```toml
|
||||
llvm-sys-90 = { package = "llvm-sys", version = "90", optional = true }
|
||||
llvm-sys-100 = { package = "llvm-sys", version = "100", optional = true }
|
||||
```
|
||||
|
||||
This requires that the target LLVM version (`llvm-10` for instance) be declared
|
||||
as the linking target rather than just `llvm` because Cargo requires that all
|
||||
linked libraries be unique regardless of what is actually enabled. Note that
|
||||
although Cargo will not prevent you from enabling multiple versions of LLVM at
|
||||
once as a result, doing so will likely cause errors at link time.
|
||||
|
||||
---
|
||||
|
||||
It may be difficult or even impossible to provide a compatible LLVM version
|
||||
system-wide for a given project (consider a program using two libraries that
|
||||
internally use different versions of LLVM!) so environment variables can be set
|
||||
to help the build scripts find your copy of the libraries. This is also helpful
|
||||
if you are unable to provide a system-wide version of LLVM but can still
|
||||
compile it yourself.
|
||||
|
||||
`LLVM_SYS_<version>_PREFIX` specifies the install prefix for a compiled and
|
||||
installed copy of the libraries, where `<version>` is the major version of
|
||||
`llvm-sys` (for example, `LLVM_SYS_37_PREFIX`). For information on compiling
|
||||
a copy of LLVM yourself, see [Compiling LLVM](#compiling-llvm).
|
||||
|
||||
In the future this library may offer the ability to download and compile LLVM
|
||||
automatically, but such a feature should only be considered for building
|
||||
one-off releases because its high cost is ill-suited to repeated builds.
|
||||
|
||||
## Compiling LLVM
|
||||
|
||||
If you need to compile LLVM or manage multiple versions,
|
||||
[llvmenv](https://crates.io/crates/llvmenv) may simplify the process. Consider
|
||||
using it if you don't have special requirements or previous experience with
|
||||
LLVM!
|
||||
|
||||
While the [getting started guide](http://llvm.org/docs/GettingStarted.html) is
|
||||
the official guide to compiling LLVM, this section will attempt to provide
|
||||
minimum guidance in creating usable libraries. If you encounter problems, refer
|
||||
to the official documentation.
|
||||
|
||||
### Download sources
|
||||
|
||||
Download and unpack a copy of the source for the required version.
|
||||
|
||||
```sh
|
||||
wget https://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
|
||||
tar xJf llvm-3.9.0.src.tar.xz
|
||||
```
|
||||
|
||||
Note that you do not need to compile Clang or the test suite.
|
||||
|
||||
### Configure
|
||||
|
||||
Configure the build using [CMake][cmake] (you will need a copy of CMake
|
||||
installed).
|
||||
|
||||
[cmake]: https://cmake.org/
|
||||
|
||||
```sh
|
||||
mkdir -p llvm-3.9.0.src/build
|
||||
cd llvm-3.9.0.src/build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/llvm-3.9.0
|
||||
```
|
||||
|
||||
Some of the useful options that can be specified at configuration-time
|
||||
(via `-D` passed to CMake):
|
||||
|
||||
* `CMAKE_INSTALL_PREFIX` sets the location to install everything in the install
|
||||
step (later). In the above example this is under your home directory.
|
||||
* `CMAKE_BUILD_TYPE` specifies the build mode, one of Debug, Release,
|
||||
MinSizeRel or RelWithDebInfo. Unless you plan to debug LLVM itself,
|
||||
Release or MinSizeRel is probably a good choice.
|
||||
* `LLVM_ENABLE_ASSERTIONS` enables internal sanity checks, highly recommended
|
||||
when writing and debugging your own program that uses LLVM because it can
|
||||
detect many usage errors that could otherwise result in hard-to-debug
|
||||
crashes.
|
||||
|
||||
Passing `-G <generator>` to CMake will make it use a different build system, but
|
||||
by default it will select one appropriate to your system. If you have
|
||||
[ninja][ninja] available, it is recommended due to its speed (`-G Ninja`).
|
||||
|
||||
[ninja]: https://ninja-build.org/
|
||||
|
||||
### Compile and install
|
||||
|
||||
```sh
|
||||
cmake --build . --target install
|
||||
```
|
||||
|
||||
This will automatically invoke the build system and copy binaries into the
|
||||
prefix specified at configuration-time when done. Then you can compile llvm-sys
|
||||
against it.
|
||||
|
||||
```sh
|
||||
cd your/crate/path
|
||||
LLVM_SYS_39_PREFIX=$HOME/llvm-3.9.0 cargo build
|
||||
```
|
||||
|
||||
Some build tools (like Visual Studio on Windows) support all configurations
|
||||
concurrently so you also need to specify the build type (which defaults to Debug
|
||||
on Windows), adding an option like `--config MinSizeRel` to this invocation of
|
||||
cmake.
|
||||
|
||||
## Windows
|
||||
|
||||
You must use a version of Rust that uses the same compiler as you build LLVM
|
||||
with, either MSVC or MinGW. Fortunately, a mismatch like this will cause errors
|
||||
at compile-time when llvm-config provides options which are supported by only
|
||||
one of them, so if you're using the other it will cause the build to fail.
|
||||
|
||||
## Cross-compilation
|
||||
|
||||
Will theoretically work, but hasn't been tested. Let us know if you try.
|
20
ext/llvm-sys.rs/appveyor.yml
vendored
20
ext/llvm-sys.rs/appveyor.yml
vendored
@ -1,20 +0,0 @@
|
||||
version: 1.0.{build}
|
||||
|
||||
image: macos
|
||||
install:
|
||||
- sh: >-
|
||||
brew install llvm
|
||||
- sh: >-
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh && sh rustup.sh -y
|
||||
build: off
|
||||
test_script:
|
||||
- sh: |
|
||||
export PATH=/usr/local/bin:$PATH
|
||||
source ~/.cargo/env
|
||||
export LLVM_SYS_110_PREFIX=/usr/local/opt/llvm
|
||||
export LLVM_CONFIG_PATH=${LLVM_SYS_110_PREFIX}/bin/llvm-config
|
||||
|
||||
cargo test
|
||||
cargo run --example nop-function
|
||||
cargo run --example jit-function
|
||||
echo "Hello, world!" | cargo run --example disassembler
|
2
ext/llvm-sys.rs/build.cmake
vendored
2
ext/llvm-sys.rs/build.cmake
vendored
@ -1,2 +0,0 @@
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
140
ext/llvm-sys.rs/build.rs
vendored
140
ext/llvm-sys.rs/build.rs
vendored
@ -1,140 +0,0 @@
|
||||
extern crate cmake;
|
||||
extern crate convert_case;
|
||||
|
||||
use convert_case::{Case, Casing, StateConverter};
|
||||
use std::{
|
||||
env,
|
||||
path::PathBuf,
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
use cmake::Config;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
let llvm_components = ["core", "analysis", "bit_reader", "bit_writer", "i_r_reader"]
|
||||
.iter()
|
||||
.map(|comp| comp.from_case(Case::Snake));
|
||||
let msvc = is_msvc();
|
||||
let (llvm_dir, additonal_cmake_file) = get_llvm_dir();
|
||||
let out_dir = build_cmake_targets(llvm_components.clone(), llvm_dir, additonal_cmake_file);
|
||||
emit_compile_and_linking_information(llvm_components, out_dir, msvc)
|
||||
}
|
||||
|
||||
fn is_msvc() -> bool {
|
||||
env::var("CARGO_CFG_TARGET_ENV").unwrap() == "msvc"
|
||||
}
|
||||
|
||||
fn get_llvm_dir() -> (PathBuf, PathBuf) {
|
||||
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let mut additional_cmake_file = manifest_dir.clone();
|
||||
additional_cmake_file.push("build.cmake");
|
||||
let mut llvm_dir = manifest_dir.parent().unwrap().to_path_buf();
|
||||
llvm_dir.push("llvm-project");
|
||||
llvm_dir.push("llvm");
|
||||
println!("cargo:rerun-if-changed={}", llvm_dir.display());
|
||||
println!("cargo:rerun-if-changed={}", additional_cmake_file.display());
|
||||
(llvm_dir, additional_cmake_file)
|
||||
}
|
||||
|
||||
fn build_cmake_targets<'a>(
|
||||
components: impl Iterator<Item = StateConverter<'a, &'static str>>,
|
||||
llvm_dir: PathBuf,
|
||||
additional_cmake_file: PathBuf,
|
||||
) -> PathBuf {
|
||||
let mut cmake = Config::new(llvm_dir);
|
||||
use_ninja(&mut cmake);
|
||||
cmake
|
||||
.always_configure(true)
|
||||
.define("LLVM_ENABLE_TERMINFO", "OFF")
|
||||
.define("LLVM_BUILD_TOOLS", "OFF")
|
||||
.define("LLVM_TARGETS_TO_BUILD", "")
|
||||
.define("LLVM_ENABLE_PROJECTS", "")
|
||||
.define("CMAKE_PROJECT_INCLUDE_BEFORE", additional_cmake_file);
|
||||
// Unfortunately CMake crate does not support building mutliple targets at once
|
||||
for component in components {
|
||||
cmake
|
||||
.build_target(&format!("LLVM{}", component.to_case(Case::Pascal)))
|
||||
.build();
|
||||
}
|
||||
cmake.build_target("llvm-config").build()
|
||||
}
|
||||
|
||||
fn use_ninja(cmake: &mut Config) {
|
||||
if let Ok(exit_status) = Command::new("ninja")
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.arg("--version")
|
||||
.status()
|
||||
{
|
||||
if !exit_status.success() {
|
||||
return;
|
||||
}
|
||||
cmake.generator("Ninja");
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_compile_and_linking_information<'a>(
|
||||
llvm_components: impl Iterator<Item = StateConverter<'a, &'static str>>,
|
||||
out_dir: PathBuf,
|
||||
is_msvc: bool,
|
||||
) {
|
||||
let mut llvm_config_path = out_dir.clone();
|
||||
llvm_config_path.push("build");
|
||||
llvm_config_path.push("bin");
|
||||
llvm_config_path.push("llvm-config");
|
||||
let mut llvm_config_cmd = Command::new(&llvm_config_path);
|
||||
llvm_config_cmd.args([
|
||||
"--cxxflags",
|
||||
"--ldflags",
|
||||
"--libdir",
|
||||
"--libnames",
|
||||
"--system-libs",
|
||||
"--link-static",
|
||||
]);
|
||||
for component in llvm_components {
|
||||
llvm_config_cmd.arg(&component.to_case(Case::Flat));
|
||||
}
|
||||
let llvm_config_output = llvm_config_cmd
|
||||
.stdin(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.output()
|
||||
.unwrap();
|
||||
if !llvm_config_output.status.success() {
|
||||
panic!()
|
||||
}
|
||||
let output = String::from_utf8_lossy(&llvm_config_output.stdout);
|
||||
let lines = (&output).lines().collect::<Vec<_>>();
|
||||
let (cxxflags, ldflags, libdir, libnames, system_libs) = match &*lines {
|
||||
[cxxflags, ldflags, libdir, libnames, system_libs, ..] => {
|
||||
(cxxflags, ldflags, libdir, libnames, system_libs)
|
||||
}
|
||||
_ => panic!(),
|
||||
};
|
||||
println!("cargo:cxxflags={}", cxxflags);
|
||||
println!("cargo:rustc-link-arg={}", ldflags);
|
||||
println!("cargo:rustc-link-search={}", libdir);
|
||||
for lib in libnames.split_ascii_whitespace() {
|
||||
let lib = if is_msvc {
|
||||
// For some reason rustc appends .lib twice on msvc
|
||||
&lib[..lib.len() - 4]
|
||||
} else {
|
||||
// On Linux, we get "libLLVMIRReader.a", so we cut "lib" and ".a"
|
||||
&lib[3..lib.len() - 2]
|
||||
};
|
||||
println!("cargo:rustc-link-lib=static={}", lib);
|
||||
}
|
||||
for lib in system_libs.split_ascii_whitespace() {
|
||||
let lib = if is_msvc {
|
||||
&lib[..lib.len() - 4]
|
||||
} else {
|
||||
// On Linux, we get it as "-lxml2", so we cut "-l" part
|
||||
&lib[2..]
|
||||
};
|
||||
println!("cargo:rustc-link-lib={}", lib);
|
||||
}
|
||||
if !is_msvc {
|
||||
println!("cargo:rustc-link-lib=stdc++");
|
||||
}
|
||||
}
|
24
ext/llvm-sys.rs/scripts/RELEASE_CHECKLIST.md
vendored
24
ext/llvm-sys.rs/scripts/RELEASE_CHECKLIST.md
vendored
@ -1,24 +0,0 @@
|
||||
For new LLVM major versions:
|
||||
|
||||
* [ ] Diff llvm/include/llvm-c/ between previous and current release.
|
||||
This requires a local repo that's in sync with the remote, and tags
|
||||
will be needed. A bare repository is fine, however.
|
||||
|
||||
```
|
||||
git clone --mirror https://github.com/llvm/llvm-project.git
|
||||
git diff llvmorg-9.0.0 llvmorg-10.0.0 -- llvm/include/llvm-c/
|
||||
```
|
||||
|
||||
Apply matching changes to Rust bindings.
|
||||
* [ ] Update `links` key in Cargo.toml for new LLVM version
|
||||
* [ ] Update usage example in README.md for new crate version
|
||||
* [ ] Update CI to refer to new version
|
||||
|
||||
For all versions:
|
||||
|
||||
* [ ] Update `version` key in Cargo.toml for new crate version
|
||||
* [ ] Commit changes
|
||||
* [ ] Tag new version; `git tag v100.1.0`
|
||||
* [ ] Update latest branch to follow master: `git branch -f llvm-10.0 master`
|
||||
* [ ] Test and publish
|
||||
* [ ] Push changes and tags; `git push --all && git push --tags`
|
32
ext/llvm-sys.rs/scripts/build-binaries.sh
vendored
32
ext/llvm-sys.rs/scripts/build-binaries.sh
vendored
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ $? -lt 1 ]
|
||||
then
|
||||
echo "Usage: $0 <version>" >&2
|
||||
echo "Example: $0 3.9.1" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
|
||||
# Dependencies (for Ubuntu):
|
||||
# * wget
|
||||
# * xz-utils
|
||||
# * ninja-build
|
||||
# * cmake
|
||||
# * build-essential
|
||||
# * python
|
||||
|
||||
wget http://releases.llvm.org/$VERSION/llvm-$VERSION.src.tar.xz
|
||||
tar xJf llvm-$VERSION.src.tar.xz
|
||||
mkdir build llvm-$VERSION
|
||||
cd build
|
||||
cmake -G Ninja ../llvm-$VERSION.src -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=/usr/local/llvm-$VERSION -DCMAKE_INSTALL_UTILS
|
||||
cmake --build . --target install
|
||||
cd ..
|
||||
tar cJf llvm-$VERSION.linux.tar.xz /usr/local/llvm-$VERSION
|
||||
|
||||
# Additional flags for MSVC
|
||||
# (CXX) /GL /Gy /Gw
|
||||
# (link) /LTCG /OPT:REF,ICF
|
35
ext/llvm-sys.rs/src/analysis.rs
vendored
35
ext/llvm-sys.rs/src/analysis.rs
vendored
@ -1,35 +0,0 @@
|
||||
//! Various analyses of the LLVM IR.
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMVerifierFailureAction {
|
||||
/// Print to stderr and abort the process.
|
||||
LLVMAbortProcessAction = 0,
|
||||
/// Print to stderr and return 1.
|
||||
LLVMPrintMessageAction = 1,
|
||||
/// Return 1 and print nothing.
|
||||
LLVMReturnStatusAction = 2,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// Verify that a module is valid, taking the specified action if not.
|
||||
///
|
||||
/// Optionally returns a human-readable description of any invalid constructs,
|
||||
/// which must be disposed with `LLVMDisposeMessage`.
|
||||
pub fn LLVMVerifyModule(
|
||||
M: LLVMModuleRef,
|
||||
Action: LLVMVerifierFailureAction,
|
||||
OutMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
/// Verify that a single function is valid, taking the specified action.
|
||||
///
|
||||
/// Useful for debugging.
|
||||
pub fn LLVMVerifyFunction(Fn: LLVMValueRef, Action: LLVMVerifierFailureAction) -> LLVMBool;
|
||||
/// Open a ghostview window displaying the CFG of the given function.
|
||||
///
|
||||
/// Useful for debugging.
|
||||
pub fn LLVMViewFunctionCFG(Fn: LLVMValueRef);
|
||||
pub fn LLVMViewFunctionCFGOnly(Fn: LLVMValueRef);
|
||||
}
|
70
ext/llvm-sys.rs/src/bit_reader.rs
vendored
70
ext/llvm-sys.rs/src/bit_reader.rs
vendored
@ -1,70 +0,0 @@
|
||||
//! Input of the LLVM bitcode format.
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
extern "C" {
|
||||
///// Build a module from the bitcode in the specified memory buffer.
|
||||
/////
|
||||
///// Returns 0 on success and the generated module in `OutModule`.
|
||||
///// Optionally returns a human-readable error message in `OutMessage`.
|
||||
//#[deprecated(since = "3.8", note = "Use LLVMParseBitcode2")]
|
||||
//pub fn LLVMParseBitcode(
|
||||
// MemBuf: LLVMMemoryBufferRef,
|
||||
// OutModule: *mut LLVMModuleRef,
|
||||
// OutMessage: *mut *mut ::libc::c_char,
|
||||
//) -> LLVMBool;
|
||||
///// Build a module from the bitcode in the specified memory buffer.
|
||||
/////
|
||||
///// Returns the created module in OutModule, returns 0 on success.
|
||||
//pub fn LLVMParseBitcode2(
|
||||
// MemBuf: LLVMMemoryBufferRef,
|
||||
// OutModule: *mut LLVMModuleRef,
|
||||
//) -> LLVMBool;
|
||||
|
||||
#[deprecated(since = "3.8", note = "Use LLVMParseBitcodeInContext2")]
|
||||
pub fn LLVMParseBitcodeInContext(
|
||||
ContextRef: LLVMContextRef,
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutModule: *mut LLVMModuleRef,
|
||||
OutMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMParseBitcodeInContext2(
|
||||
ContextRef: LLVMContextRef,
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutModule: *mut LLVMModuleRef,
|
||||
) -> LLVMBool;
|
||||
|
||||
/// Read a module from the specified path, returning a module provider
|
||||
/// performing lazy deserialization.
|
||||
///
|
||||
/// Returns 0 on success and an optional error message.
|
||||
#[deprecated(since = "3.8", note = "Use LLVMGetBitcodeModuleInContext2")]
|
||||
pub fn LLVMGetBitcodeModuleInContext(
|
||||
ContextRef: LLVMContextRef,
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutM: *mut LLVMModuleRef,
|
||||
OutMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
/// Read a module from the specified path, returning a module provider
|
||||
/// performing lazy deserialization.
|
||||
///
|
||||
/// Returns 0 on success.
|
||||
pub fn LLVMGetBitcodeModuleInContext2(
|
||||
ContextRef: LLVMContextRef,
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutM: *mut LLVMModuleRef,
|
||||
) -> LLVMBool;
|
||||
|
||||
#[deprecated(since = "3.8", note = "Use LLVMGetBitcodeModule2")]
|
||||
pub fn LLVMGetBitcodeModule(
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutM: *mut LLVMModuleRef,
|
||||
OutMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
/// Read a module from the specified path.
|
||||
///
|
||||
/// Outputs a module provider which performs lazy deserialization.
|
||||
/// Returns 0 on success.
|
||||
pub fn LLVMGetBitcodeModule2(MemBuf: LLVMMemoryBufferRef, OutM: *mut LLVMModuleRef)
|
||||
-> LLVMBool;
|
||||
}
|
23
ext/llvm-sys.rs/src/bit_writer.rs
vendored
23
ext/llvm-sys.rs/src/bit_writer.rs
vendored
@ -1,23 +0,0 @@
|
||||
//! Output of the LLVM bitcode format.
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
extern "C" {
|
||||
/// Write a module to the specified path.
|
||||
///
|
||||
/// Returns 0 on success.
|
||||
pub fn LLVMWriteBitcodeToFile(M: LLVMModuleRef, Path: *const ::libc::c_char) -> ::libc::c_int;
|
||||
/// Write a module to an open file descriptor.
|
||||
///
|
||||
/// Returns 0 on success.
|
||||
pub fn LLVMWriteBitcodeToFD(
|
||||
M: LLVMModuleRef,
|
||||
FD: ::libc::c_int,
|
||||
ShouldClose: ::libc::c_int,
|
||||
Unbuffered: ::libc::c_int,
|
||||
) -> ::libc::c_int;
|
||||
/// Deprecated: use LLVMWriteBitcodeToFD
|
||||
pub fn LLVMWriteBitcodeToFileHandle(M: LLVMModuleRef, Handle: ::libc::c_int) -> ::libc::c_int;
|
||||
/// Writes a module to a new memory buffer.
|
||||
pub fn LLVMWriteBitcodeToMemoryBuffer(M: LLVMModuleRef) -> LLVMMemoryBufferRef;
|
||||
}
|
66
ext/llvm-sys.rs/src/blake3.rs
vendored
66
ext/llvm-sys.rs/src/blake3.rs
vendored
@ -1,66 +0,0 @@
|
||||
//! LLVM's BLAKE3 implementation.
|
||||
//! Original BLAKE3 C API: <https://github.com/BLAKE3-team/BLAKE3/tree/1.3.1/c>
|
||||
|
||||
pub const LLVM_BLAKE3_VERSION_STRING: &str = "1.3.1";
|
||||
pub const LLVM_BLAKE3_KEY_LEN: usize = 32;
|
||||
pub const LLVM_BLAKE3_OUT_LEN: usize = 32;
|
||||
pub const LLVM_BLAKE3_BLOCK_LEN: usize = 64;
|
||||
pub const LLVM_BLAKE3_CHUNK_LEN: usize = 1024;
|
||||
pub const LLVM_BLAKE3_MAX_DEPTH: usize = 54;
|
||||
|
||||
/// This struct is a private implementation detail. It has to be here because
|
||||
/// it's part of llvm_blake3_hasher below.
|
||||
#[repr(C)]
|
||||
struct llvm_blake3_chunk_state {
|
||||
cv: [u32; 8],
|
||||
chunk_counter: u64,
|
||||
buf: [u8; LLVM_BLAKE3_BLOCK_LEN],
|
||||
buf_len: u8,
|
||||
blocks_compressed: u8,
|
||||
flags: u8,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct llvm_blake3_hasher {
|
||||
key: [u32; 8],
|
||||
chunk: llvm_blake3_chunk_state,
|
||||
cv_stack_len: u8,
|
||||
/// The stack size is MAX_DEPTH + 1 because we do lazy merging. For example,
|
||||
/// with 7 chunks, we have 3 entries in the stack. Adding an 8th chunk
|
||||
/// requires a 4th entry, rather than merging everything down to 1, because we
|
||||
/// don't know whether more input is coming. This is different from how the
|
||||
/// reference implementation does things.
|
||||
cv_stack: [u8; (LLVM_BLAKE3_MAX_DEPTH + 1) * LLVM_BLAKE3_OUT_LEN],
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn llvm_blake3_version() -> *const ::libc::c_char;
|
||||
pub fn llvm_blake3_hasher_init(hasher: *mut llvm_blake3_hasher);
|
||||
pub fn llvm_blake3_hasher_init_keyed(hasher: *mut llvm_blake3_hasher, key: *const u8);
|
||||
pub fn llvm_blake3_hasher_init_derive_key(
|
||||
hasher: *mut llvm_blake3_hasher,
|
||||
context: *const ::libc::c_char,
|
||||
);
|
||||
pub fn llvm_blake3_hasher_init_derive_key_raw(
|
||||
hasher: *mut llvm_blake3_hasher,
|
||||
context: *const ::libc::c_char,
|
||||
context_len: usize,
|
||||
);
|
||||
pub fn llvm_blake3_hasher_update(
|
||||
hasher: *mut llvm_blake3_hasher,
|
||||
input: *const ::libc::c_void,
|
||||
input_len: usize,
|
||||
);
|
||||
pub fn llvm_blake3_hasher_finalize(
|
||||
hasher: *mut llvm_blake3_hasher,
|
||||
out: *mut u8,
|
||||
out_len: usize,
|
||||
);
|
||||
pub fn llvm_blake3_hasher_finalize_seek(
|
||||
hasher: *mut llvm_blake3_hasher,
|
||||
seek: u64,
|
||||
out: *mut u8,
|
||||
out_len: usize,
|
||||
);
|
||||
pub fn llvm_blake3_hasher_reset(hasher: *mut llvm_blake3_hasher);
|
||||
}
|
34
ext/llvm-sys.rs/src/comdat.rs
vendored
34
ext/llvm-sys.rs/src/comdat.rs
vendored
@ -1,34 +0,0 @@
|
||||
//! COMDAT
|
||||
use super::*;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMComdatSelectionKind {
|
||||
/// The linker may choose any COMDAT.
|
||||
LLVMAnyComdatSelectionKind,
|
||||
/// The data referenced by the COMDAT must be the same.
|
||||
LLVMExactMatchComdatSelectionKind,
|
||||
/// The linker will choose the largest COMDAT.
|
||||
LLVMLargestComdatSelectionKind,
|
||||
/// No deduplication is performed.
|
||||
LLVMNoDuplicatesComdatSelectionKind,
|
||||
/// The data referenced by the COMDAT must be the same size.
|
||||
LLVMSameSizeComdatSelectionKind,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// Return the Comdat in the module with the specified name. It is created if it didn't already exist.
|
||||
pub fn LLVMGetOrInsertComdat(M: LLVMModuleRef, Name: *const ::libc::c_char) -> LLVMComdatRef;
|
||||
|
||||
/// Get the Comdat assigned to the given global object.
|
||||
pub fn LLVMGetComdat(V: LLVMValueRef) -> LLVMComdatRef;
|
||||
|
||||
/// Assign the Comdat to the given global object.
|
||||
pub fn LLVMSetComdat(V: LLVMValueRef, C: LLVMComdatRef);
|
||||
|
||||
/// Get the conflict resolution selection kind for the Comdat.
|
||||
pub fn LLVMGetComdatSelectionKind(C: LLVMComdatRef) -> LLVMComdatSelectionKind;
|
||||
|
||||
/// Set the conflict resolution selection kind for the Comdat.
|
||||
pub fn LLVMSetComdatSelectionKind(C: LLVMComdatRef, Kind: LLVMComdatSelectionKind);
|
||||
}
|
2095
ext/llvm-sys.rs/src/core.rs
vendored
2095
ext/llvm-sys.rs/src/core.rs
vendored
File diff suppressed because it is too large
Load Diff
880
ext/llvm-sys.rs/src/debuginfo.rs
vendored
880
ext/llvm-sys.rs/src/debuginfo.rs
vendored
@ -1,880 +0,0 @@
|
||||
//! Generation of DWARF debug info.
|
||||
use super::*;
|
||||
|
||||
// Debug info flags.
|
||||
pub type LLVMDIFlags = ::libc::c_int;
|
||||
pub const LLVMDIFlagZero: LLVMDIFlags = 0;
|
||||
pub const LLVMDIFlagPrivate: LLVMDIFlags = 1;
|
||||
pub const LLVMDIFlagProtected: LLVMDIFlags = 2;
|
||||
pub const LLVMDIFlagPublic: LLVMDIFlags = 3;
|
||||
pub const LLVMDIFlagFwdDecl: LLVMDIFlags = 1 << 2;
|
||||
pub const LLVMDIFlagAppleBlock: LLVMDIFlags = 1 << 3;
|
||||
pub const LLVMDIFlagReservedBit4: LLVMDIFlags = 1 << 4;
|
||||
pub const LLVMDIFlagVirtual: LLVMDIFlags = 1 << 5;
|
||||
pub const LLVMDIFlagArtificial: LLVMDIFlags = 1 << 6;
|
||||
pub const LLVMDIFlagExplicit: LLVMDIFlags = 1 << 7;
|
||||
pub const LLVMDIFlagPrototyped: LLVMDIFlags = 1 << 8;
|
||||
pub const LLVMDIFlagObjcClassComplete: LLVMDIFlags = 1 << 9;
|
||||
pub const LLVMDIFlagObjectPointer: LLVMDIFlags = 1 << 10;
|
||||
pub const LLVMDIFlagVector: LLVMDIFlags = 1 << 11;
|
||||
pub const LLVMDIFlagStaticMember: LLVMDIFlags = 1 << 12;
|
||||
pub const LLVMDIFlagLValueReference: LLVMDIFlags = 1 << 13;
|
||||
pub const LLVMDIFlagRValueReference: LLVMDIFlags = 1 << 14;
|
||||
pub const LLVMDIFlagReserved: LLVMDIFlags = 1 << 15;
|
||||
pub const LLVMDIFlagSingleInheritance: LLVMDIFlags = 1 << 16;
|
||||
pub const LLVMDIFlagMultipleInheritance: LLVMDIFlags = 2 << 16;
|
||||
pub const LLVMDIFlagVirtualInheritance: LLVMDIFlags = 3 << 16;
|
||||
pub const LLVMDIFlagIntroducedVirtual: LLVMDIFlags = 1 << 18;
|
||||
pub const LLVMDIFlagBitField: LLVMDIFlags = 1 << 19;
|
||||
pub const LLVMDIFlagNoReturn: LLVMDIFlags = 1 << 20;
|
||||
pub const LLVMDIFlagTypePassByValue: LLVMDIFlags = 1 << 22;
|
||||
pub const LLVMDIFlagTypePassByReference: LLVMDIFlags = 1 << 23;
|
||||
pub const LLVMDIFlagEnumClass: LLVMDIFlags = 1 << 24;
|
||||
pub const LLVMDIFlagThunk: LLVMDIFlags = 1 << 25;
|
||||
pub const LLVMDIFlagNonTrivial: LLVMDIFlags = 1 << 26;
|
||||
pub const LLVMDIFlagBigendian: LLVMDIFlags = 1 << 27;
|
||||
pub const LLVMDIFlagLittleEndian: LLVMDIFlags = 1 << 28;
|
||||
pub const LLVMDIFlagIndirectVirtualBase: LLVMDIFlags = (1 << 2) | (1 << 5);
|
||||
pub const LLVMDIFlagAccessibility: LLVMDIFlags =
|
||||
LLVMDIFlagProtected | LLVMDIFlagPrivate | LLVMDIFlagPublic;
|
||||
pub const LLVMDIFlagPtrToMemberRep: LLVMDIFlags =
|
||||
LLVMDIFlagSingleInheritance | LLVMDIFlagMultipleInheritance | LLVMDIFlagVirtualInheritance;
|
||||
|
||||
/// Source languages known by DWARF.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMDWARFSourceLanguage {
|
||||
LLVMDWARFSourceLanguageC89,
|
||||
LLVMDWARFSourceLanguageC,
|
||||
LLVMDWARFSourceLanguageAda83,
|
||||
LLVMDWARFSourceLanguageC_plus_plus,
|
||||
LLVMDWARFSourceLanguageCobol74,
|
||||
LLVMDWARFSourceLanguageCobol85,
|
||||
LLVMDWARFSourceLanguageFortran77,
|
||||
LLVMDWARFSourceLanguageFortran90,
|
||||
LLVMDWARFSourceLanguagePascal83,
|
||||
LLVMDWARFSourceLanguageModula2,
|
||||
// New in DWARF v3:
|
||||
LLVMDWARFSourceLanguageJava,
|
||||
LLVMDWARFSourceLanguageC99,
|
||||
LLVMDWARFSourceLanguageAda95,
|
||||
LLVMDWARFSourceLanguageFortran95,
|
||||
LLVMDWARFSourceLanguagePLI,
|
||||
LLVMDWARFSourceLanguageObjC,
|
||||
LLVMDWARFSourceLanguageObjC_plus_plus,
|
||||
LLVMDWARFSourceLanguageUPC,
|
||||
LLVMDWARFSourceLanguageD,
|
||||
// New in DWARF v4:
|
||||
LLVMDWARFSourceLanguagePython,
|
||||
// New in DWARF v5:
|
||||
LLVMDWARFSourceLanguageOpenCL,
|
||||
LLVMDWARFSourceLanguageGo,
|
||||
LLVMDWARFSourceLanguageModula3,
|
||||
LLVMDWARFSourceLanguageHaskell,
|
||||
LLVMDWARFSourceLanguageC_plus_plus_03,
|
||||
LLVMDWARFSourceLanguageC_plus_plus_11,
|
||||
LLVMDWARFSourceLanguageOCaml,
|
||||
LLVMDWARFSourceLanguageRust,
|
||||
LLVMDWARFSourceLanguageC11,
|
||||
LLVMDWARFSourceLanguageSwift,
|
||||
LLVMDWARFSourceLanguageJulia,
|
||||
LLVMDWARFSourceLanguageDylan,
|
||||
LLVMDWARFSourceLanguageC_plus_plus_14,
|
||||
LLVMDWARFSourceLanguageFortran03,
|
||||
LLVMDWARFSourceLanguageFortran08,
|
||||
LLVMDWARFSourceLanguageRenderScript,
|
||||
LLVMDWARFSourceLanguageBLISS,
|
||||
// Vendor extensions:
|
||||
LLVMDWARFSourceLanguageMips_Assembler,
|
||||
LLVMDWARFSourceLanguageGOOGLE_RenderScript,
|
||||
LLVMDWARFSourceLanguageBORLAND_Delphi,
|
||||
}
|
||||
|
||||
/// The amount of debug information to emit.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMDWARFEmissionKind {
|
||||
LLVMDWARFEmissionKindNone = 0,
|
||||
LLVMDWARFEmissionKindFull,
|
||||
LLVMDWARFEmissionKindLineTablesOnly,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMMetadataKind {
|
||||
LLVMMDStringMetadataKind,
|
||||
LLVMConstantAsMetadataMetadataKind,
|
||||
LLVMLocalAsMetadataMetadataKind,
|
||||
LLVMDistinctMDOperandPlaceholderMetadataKind,
|
||||
LLVMMDTupleMetadataKind,
|
||||
LLVMDILocationMetadataKind,
|
||||
LLVMDIExpressionMetadataKind,
|
||||
LLVMDIGlobalVariableExpressionMetadataKind,
|
||||
LLVMGenericDINodeMetadataKind,
|
||||
LLVMDISubrangeMetadataKind,
|
||||
LLVMDIEnumeratorMetadataKind,
|
||||
LLVMDIBasicTypeMetadataKind,
|
||||
LLVMDIDerivedTypeMetadataKind,
|
||||
LLVMDICompositeTypeMetadataKind,
|
||||
LLVMDISubroutineTypeMetadataKind,
|
||||
LLVMDIFileMetadataKind,
|
||||
LLVMDICompileUnitMetadataKind,
|
||||
LLVMDISubprogramMetadataKind,
|
||||
LLVMDILexicalBlockMetadataKind,
|
||||
LLVMDILexicalBlockFileMetadataKind,
|
||||
LLVMDINamespaceMetadataKind,
|
||||
LLVMDIModuleMetadataKind,
|
||||
LLVMDITemplateTypeParameterMetadataKind,
|
||||
LLVMDITemplateValueParameterMetadataKind,
|
||||
LLVMDIGlobalVariableMetadataKind,
|
||||
LLVMDILocalVariableMetadataKind,
|
||||
LLVMDILabelMetadataKind,
|
||||
LLVMDIObjCPropertyMetadataKind,
|
||||
LLVMDIImportedEntityMetadataKind,
|
||||
LLVMDIMacroMetadataKind,
|
||||
LLVMDIMacroFileMetadataKind,
|
||||
LLVMDICommonBlockMetadataKind,
|
||||
LLVMDIStringTypeMetadataKind,
|
||||
LLVMDIGenericSubrangeMetadataKind,
|
||||
LLVMDIArgListMetadataKind,
|
||||
}
|
||||
|
||||
pub type LLVMDWARFTypeEncoding = ::libc::c_uint;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMDWARFMacinfoRecordType {
|
||||
LLVMDWARFMacinfoRecordTypeDefine = 0x01,
|
||||
LLVMDWARFMacinfoRecordTypeMacro = 0x02,
|
||||
LLVMDWARFMacinfoRecordTypeStartFile = 0x03,
|
||||
LLVMDWARFMacinfoRecordTypeEndFile = 0x04,
|
||||
LLVMDWARFMacinfoRecordTypeVendorExt = 0xff,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// The current debug metadata version number.
|
||||
pub fn LLVMDebugMetadataVersion() -> ::libc::c_uint;
|
||||
/// The version of debug metadata that's present in the provided Module.
|
||||
pub fn LLVMGetModuleDebugMetadataVersion(Module: LLVMModuleRef) -> ::libc::c_uint;
|
||||
/// Strip debug info in the module if it exists.
|
||||
pub fn LLVMStripModuleDebugInfo(Module: LLVMModuleRef) -> LLVMBool;
|
||||
/// Construct a builder for a module, do not allow unresolved nodes.
|
||||
pub fn LLVMCreateDIBuilderDisallowUnresolved(M: LLVMModuleRef) -> LLVMDIBuilderRef;
|
||||
/// Construct a builder for a module and collect unresolved nodes.
|
||||
pub fn LLVMCreateDIBuilder(M: LLVMModuleRef) -> LLVMDIBuilderRef;
|
||||
/// Deallocate a builder and everything it owns.
|
||||
///
|
||||
/// The builder must be finalized before this.
|
||||
pub fn LLVMDisposeDIBuilder(Builder: LLVMDIBuilderRef);
|
||||
/// Construct any deferred debug info descriptors.
|
||||
pub fn LLVMDIBuilderFinalize(Builder: LLVMDIBuilderRef);
|
||||
/// Finalize a specific subprogram.
|
||||
/// No new variables may be added to this subprogram afterwards.
|
||||
pub fn LLVMDIBuilderFinalizeSubprogram(Builder: LLVMDIBuilderRef, Subprogram: LLVMMetadataRef);
|
||||
pub fn LLVMDIBuilderCreateCompileUnit(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Lang: LLVMDWARFSourceLanguage,
|
||||
FileRef: LLVMMetadataRef,
|
||||
Producer: *const ::libc::c_char,
|
||||
ProducerLen: ::libc::size_t,
|
||||
isOptimized: LLVMBool,
|
||||
Flags: *const ::libc::c_char,
|
||||
FlagsLen: ::libc::size_t,
|
||||
RuntimeVer: ::libc::c_uint,
|
||||
SplitName: *const ::libc::c_char,
|
||||
SplitNameLen: ::libc::size_t,
|
||||
Kind: LLVMDWARFEmissionKind,
|
||||
DWOId: ::libc::c_uint,
|
||||
SplitDebugInlining: LLVMBool,
|
||||
DebugInfoForProfiling: LLVMBool,
|
||||
SysRoot: *const ::libc::c_char,
|
||||
SysRootLen: ::libc::size_t,
|
||||
SDK: *const ::libc::c_char,
|
||||
SDKLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
/// Create a file descriptor to hold debugging information for a file.
|
||||
pub fn LLVMDIBuilderCreateFile(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Filename: *const ::libc::c_char,
|
||||
FilenameLen: ::libc::size_t,
|
||||
Directory: *const ::libc::c_char,
|
||||
DirectoryLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Creates a new descriptor for a module with the specified parent scope.
|
||||
pub fn LLVMDIBuilderCreateModule(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
ParentScope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
ConfigMacros: *const ::libc::c_char,
|
||||
ConfigMacrosLen: ::libc::size_t,
|
||||
IncludePath: *const ::libc::c_char,
|
||||
IncludePathLen: ::libc::size_t,
|
||||
APINotesFile: *const ::libc::c_char,
|
||||
APINotesFileLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Creates a new descriptor for a namespace with the specified parent scope.
|
||||
pub fn LLVMDIBuilderCreateNameSpace(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
ParentScope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
ExportSymbols: LLVMBool,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a new descriptor for the specified subprogram.
|
||||
pub fn LLVMDIBuilderCreateFunction(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
LinkageName: *const ::libc::c_char,
|
||||
LinkageNameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
IsLocalToUnit: LLVMBool,
|
||||
IsDefinition: LLVMBool,
|
||||
ScopeLine: ::libc::c_uint,
|
||||
Flags: LLVMDIFlags,
|
||||
IsOptimized: LLVMBool,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for a lexical block with the specified parent context.
|
||||
pub fn LLVMDIBuilderCreateLexicalBlock(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
Column: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for a lexical block with a new file attached.
|
||||
pub fn LLVMDIBuilderCreateLexicalBlockFile(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Discriminator: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for an imported namespace. Suitable for e.g. C++ using declarations.
|
||||
pub fn LLVMDIBuilderCreateImportedModuleFromNamespace(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
NS: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for an imported module that aliases another imported entity descriptor.
|
||||
pub fn LLVMDIBuilderCreateImportedModuleFromAlias(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
ImportedEntity: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for an imported module.
|
||||
pub fn LLVMDIBuilderCreateImportedModuleFromModule(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
M: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a descriptor for an imported function, type, or variable.
|
||||
///
|
||||
/// Suitable for e.g. FORTRAN-style USE declarations.
|
||||
pub fn LLVMDIBuilderCreateImportedDeclaration(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Decl: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Creates a new DebugLocation that describes a source location.
|
||||
pub fn LLVMDIBuilderCreateDebugLocation(
|
||||
Ctx: LLVMContextRef,
|
||||
Line: ::libc::c_uint,
|
||||
Column: ::libc::c_uint,
|
||||
Scope: LLVMMetadataRef,
|
||||
InlinedAt: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the line number of this debug location.
|
||||
pub fn LLVMDILocationGetLine(Location: LLVMMetadataRef) -> ::libc::c_uint;
|
||||
|
||||
/// Get the column number of this debug location.
|
||||
pub fn LLVMDILocationGetColumn(Location: LLVMMetadataRef) -> ::libc::c_uint;
|
||||
|
||||
/// Get the local scope associated with this debug location.
|
||||
pub fn LLVMDILocationGetScope(Location: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the "inline at" location associated with this debug location.
|
||||
pub fn LLVMDILocationGetInlinedAt(Location: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the metadata of the file associated with a given scope.
|
||||
pub fn LLVMDIScopeGetFile(Scope: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the directory of a given file.
|
||||
pub fn LLVMDIFileGetDirectory(
|
||||
File: LLVMMetadataRef,
|
||||
Len: *mut ::libc::c_uint,
|
||||
) -> *const ::libc::c_char;
|
||||
|
||||
/// Get the name of a given file.
|
||||
pub fn LLVMDIFileGetFilename(
|
||||
File: LLVMMetadataRef,
|
||||
Len: *mut ::libc::c_uint,
|
||||
) -> *const ::libc::c_char;
|
||||
|
||||
/// Get the source of a given file.
|
||||
pub fn LLVMDIFileGetSource(
|
||||
File: LLVMMetadataRef,
|
||||
Len: *mut ::libc::c_uint,
|
||||
) -> *const ::libc::c_char;
|
||||
|
||||
/// Create a type array.
|
||||
pub fn LLVMDIBuilderGetOrCreateTypeArray(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Data: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create subroutine type.
|
||||
pub fn LLVMDIBuilderCreateSubroutineType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
File: LLVMMetadataRef,
|
||||
ParameterTypes: *mut LLVMMetadataRef,
|
||||
NumParameterTypes: ::libc::c_uint,
|
||||
Flags: LLVMDIFlags,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
pub fn LLVMDIBuilderCreateMacro(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
ParentMacroFile: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
RecordType: LLVMDWARFMacinfoRecordType,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: usize,
|
||||
Value: *const ::libc::c_char,
|
||||
ValueLen: usize,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
pub fn LLVMDIBuilderCreateTempMacroFile(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
ParentMacroFile: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
File: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for an enumerator.
|
||||
pub fn LLVMDIBuilderCreateEnumerator(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Value: i64,
|
||||
IsUnsigned: LLVMBool,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for an enumeration.
|
||||
pub fn LLVMDIBuilderCreateEnumerationType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
ClassTy: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a union.
|
||||
pub fn LLVMDIBuilderCreateUnionType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: LLVMDIFlags,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
RunTimeLang: ::libc::c_uint,
|
||||
UniqueId: *const ::libc::c_char,
|
||||
UniqueIdLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for an array.
|
||||
pub fn LLVMDIBuilderCreateArrayType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Size: u64,
|
||||
AlignInBits: u32,
|
||||
Ty: LLVMMetadataRef,
|
||||
Subscripts: *mut LLVMMetadataRef,
|
||||
NumSubscripts: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a vector type.
|
||||
pub fn LLVMDIBuilderCreateVectorType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Size: u64,
|
||||
AlignInBits: u32,
|
||||
Ty: LLVMMetadataRef,
|
||||
Subscripts: *mut LLVMMetadataRef,
|
||||
NumSubscripts: ::libc::c_uint,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a DWARF unspecified type.
|
||||
pub fn LLVMDIBuilderCreateUnspecifiedType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a basic type.
|
||||
pub fn LLVMDIBuilderCreateBasicType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
SizeInBits: u64,
|
||||
Encoding: LLVMDWARFTypeEncoding,
|
||||
Flags: LLVMDIFlags,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a pointer.
|
||||
pub fn LLVMDIBuilderCreatePointerType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
PointeeTy: LLVMMetadataRef,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
AddressSpace: ::libc::c_uint,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a struct.
|
||||
pub fn LLVMDIBuilderCreateStructType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: LLVMDIFlags,
|
||||
DerivedFrom: LLVMMetadataRef,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
RunTimeLang: ::libc::c_uint,
|
||||
VTableHolder: LLVMMetadataRef,
|
||||
UniqueId: *const ::libc::c_char,
|
||||
UniqueIdLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a member.
|
||||
pub fn LLVMDIBuilderCreateMemberType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
OffsetInBits: u64,
|
||||
Flags: LLVMDIFlags,
|
||||
Ty: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a C++ static data member.
|
||||
pub fn LLVMDIBuilderCreateStaticMemberType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
Type: LLVMMetadataRef,
|
||||
Flags: LLVMDIFlags,
|
||||
ConstantVal: LLVMValueRef,
|
||||
AlignInBits: u32,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a pointer to member.
|
||||
pub fn LLVMDIBuilderCreateMemberPointerType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
PointeeType: LLVMMetadataRef,
|
||||
ClassType: LLVMMetadataRef,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: LLVMDIFlags,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for Objective-C instance variable.
|
||||
pub fn LLVMDIBuilderCreateObjCIVar(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
OffsetInBits: u64,
|
||||
Flags: LLVMDIFlags,
|
||||
Ty: LLVMMetadataRef,
|
||||
PropertyNode: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for Objective-C property.
|
||||
pub fn LLVMDIBuilderCreateObjCProperty(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
GetterName: *const ::libc::c_char,
|
||||
GetterNameLen: ::libc::size_t,
|
||||
SetterName: *const ::libc::c_char,
|
||||
SetterNameLen: ::libc::size_t,
|
||||
PropertyAttributes: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
|
||||
pub fn LLVMDIBuilderCreateObjectPointerType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Type: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a qualified type, e.g. 'const int'.
|
||||
pub fn LLVMDIBuilderCreateQualifiedType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Tag: ::libc::c_uint,
|
||||
Type: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a c++ style reference or rvalue reference type.
|
||||
pub fn LLVMDIBuilderCreateReferenceType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Tag: ::libc::c_uint,
|
||||
Type: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create C++11 nullptr type.
|
||||
pub fn LLVMDIBuilderCreateNullPtrType(Builder: LLVMDIBuilderRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a typedef.
|
||||
pub fn LLVMDIBuilderCreateTypedef(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Type: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Scope: LLVMMetadataRef,
|
||||
AlignInBits: u32,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry to establish inheritance relationship between two types.
|
||||
pub fn LLVMDIBuilderCreateInheritance(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Ty: LLVMMetadataRef,
|
||||
BaseTy: LLVMMetadataRef,
|
||||
BaseOffset: u64,
|
||||
VBPtrOffset: u32,
|
||||
Flags: LLVMDIFlags,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a permanent forward-declared type.
|
||||
pub fn LLVMDIBuilderCreateForwardDecl(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Tag: ::libc::c_uint,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Scope: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
RuntimeLang: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
UniqueIdentifier: *const ::libc::c_char,
|
||||
UniqueIdentifierLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a temporary forward-declared type.
|
||||
pub fn LLVMDIBuilderCreateReplaceableCompositeType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Tag: ::libc::c_uint,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Scope: LLVMMetadataRef,
|
||||
File: LLVMMetadataRef,
|
||||
Line: ::libc::c_uint,
|
||||
RuntimeLang: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
Flags: LLVMDIFlags,
|
||||
UniqueIdentifier: *const ::libc::c_char,
|
||||
UniqueIdentifierLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a bit field member.
|
||||
pub fn LLVMDIBuilderCreateBitFieldMemberType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
OffsetInBits: u64,
|
||||
StorageOffsetInBits: u64,
|
||||
Flags: LLVMDIFlags,
|
||||
Type: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create debugging information entry for a class.
|
||||
pub fn LLVMDIBuilderCreateClassType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNumber: ::libc::c_uint,
|
||||
SizeInBits: u64,
|
||||
AlignInBits: u32,
|
||||
OffsetInBits: u64,
|
||||
Flags: LLVMDIFlags,
|
||||
DerivedFrom: LLVMMetadataRef,
|
||||
Elements: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::c_uint,
|
||||
VTableHolder: LLVMMetadataRef,
|
||||
TemplateParamsNode: LLVMMetadataRef,
|
||||
UniqueIdentifier: *const ::libc::c_char,
|
||||
UniqueIdentifierLen: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a uniqued DIType* clone with FlagArtificial set.
|
||||
pub fn LLVMDIBuilderCreateArtificialType(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Type: LLVMMetadataRef,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the name of this DIType.
|
||||
pub fn LLVMDITypeGetName(
|
||||
DType: LLVMMetadataRef,
|
||||
Length: *mut ::libc::size_t,
|
||||
) -> *const ::libc::c_char;
|
||||
|
||||
/// Get the size of this DIType in bits.
|
||||
pub fn LLVMDITypeGetSizeInBits(DType: LLVMMetadataRef) -> u64;
|
||||
|
||||
/// Get the offset of this DIType in bits.
|
||||
pub fn LLVMDITypeGetOffsetInBits(DType: LLVMMetadataRef) -> u64;
|
||||
|
||||
/// Get the alignment of this DIType in bits.
|
||||
pub fn LLVMDITypeGetAlignInBits(DType: LLVMMetadataRef) -> u32;
|
||||
|
||||
/// Get the source line where this DIType is declared.
|
||||
pub fn LLVMDITypeGetLine(DType: LLVMMetadataRef) -> ::libc::c_uint;
|
||||
|
||||
/// Get the flags associated with this DIType.
|
||||
pub fn LLVMDITypeGetFlags(DType: LLVMMetadataRef) -> LLVMDIFlags;
|
||||
|
||||
/// Create a descriptor for a value range.
|
||||
pub fn LLVMDIBuilderGetOrCreateSubrange(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
LowerBound: i64,
|
||||
Count: i64,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create an array of DI Nodes.
|
||||
pub fn LLVMDIBuilderGetOrCreateArray(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Data: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a new descriptor for the specified variable which has a complex
|
||||
pub fn LLVMDIBuilderCreateExpression(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Addr: *mut u64,
|
||||
Length: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a new descriptor for the specified variable that does not have an
|
||||
pub fn LLVMDIBuilderCreateConstantValueExpression(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Value: u64,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a new descriptor for the specified variable.
|
||||
pub fn LLVMDIBuilderCreateGlobalVariableExpression(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Linkage: *const ::libc::c_char,
|
||||
LinkLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
LocalToUnit: LLVMBool,
|
||||
Expr: LLVMMetadataRef,
|
||||
Decl: LLVMMetadataRef,
|
||||
AlignInBits: u32,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Retrieves the DIVariable associated with this global variable expression.
|
||||
pub fn LLVMDIGlobalVariableExpressionGetVariable(GVE: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Retrieves the DIExpression associated with this global variable expression.
|
||||
pub fn LLVMDIGlobalVariableExpressionGetExpression(GVE: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
///Get the metadata of the file associated with a given variable.
|
||||
pub fn LLVMDIVariableGetFile(Var: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the metadata of the scope associated with a given variable.
|
||||
pub fn LLVMDIVariableGetScope(Var: LLVMMetadataRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the source line where this \c DIVariable is declared.
|
||||
pub fn LLVMDIVariableGetLine(Var: LLVMMetadataRef) -> ::libc::c_uint;
|
||||
|
||||
/// Create a new temporary \c MDNode. Suitable for use in constructing cyclic
|
||||
pub fn LLVMTemporaryMDNode(
|
||||
Ctx: LLVMContextRef,
|
||||
Data: *mut LLVMMetadataRef,
|
||||
NumElements: ::libc::size_t,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Deallocate a temporary node.
|
||||
pub fn LLVMDisposeTemporaryMDNode(TempNode: LLVMMetadataRef);
|
||||
|
||||
/// Replace all uses of temporary metadata.
|
||||
pub fn LLVMMetadataReplaceAllUsesWith(
|
||||
TempTargetMetadata: LLVMMetadataRef,
|
||||
Replacement: LLVMMetadataRef,
|
||||
);
|
||||
|
||||
/// Create a new descriptor for the specified global variable that is temporary
|
||||
pub fn LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
Linkage: *const ::libc::c_char,
|
||||
LnkLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
LocalToUnit: LLVMBool,
|
||||
Decl: LLVMMetadataRef,
|
||||
AlignInBits: u32,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Insert a new llvm.dbg.declare intrinsic call before the given instruction.
|
||||
pub fn LLVMDIBuilderInsertDeclareBefore(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Storage: LLVMValueRef,
|
||||
VarInfo: LLVMMetadataRef,
|
||||
Expr: LLVMMetadataRef,
|
||||
DebugLoc: LLVMMetadataRef,
|
||||
Instr: LLVMValueRef,
|
||||
) -> LLVMValueRef;
|
||||
|
||||
/// Insert a new llvm.dbg.declare intrinsic call at the end of the given basic block. If the basic block has a terminator instruction, the intrinsic is inserted before that terminator instruction.
|
||||
pub fn LLVMDIBuilderInsertDeclareAtEnd(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Storage: LLVMValueRef,
|
||||
VarInfo: LLVMMetadataRef,
|
||||
Expr: LLVMMetadataRef,
|
||||
DebugLoc: LLVMMetadataRef,
|
||||
Block: LLVMBasicBlockRef,
|
||||
) -> LLVMValueRef;
|
||||
|
||||
/// Insert a new llvm.dbg.value intrinsic call before the given instruction.
|
||||
pub fn LLVMDIBuilderInsertDbgValueBefore(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Val: LLVMValueRef,
|
||||
VarInfo: LLVMMetadataRef,
|
||||
Expr: LLVMMetadataRef,
|
||||
DebugLoc: LLVMMetadataRef,
|
||||
Instr: LLVMValueRef,
|
||||
) -> LLVMValueRef;
|
||||
|
||||
/// Insert a new llvm.dbg.value intrinsic call at the end of the given basic block. If the basic block has a terminator instruction, the intrinsic is inserted before that terminator instruction.
|
||||
pub fn LLVMDIBuilderInsertDbgValueAtEnd(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Val: LLVMValueRef,
|
||||
VarInfo: LLVMMetadataRef,
|
||||
Expr: LLVMMetadataRef,
|
||||
DebugLoc: LLVMMetadataRef,
|
||||
Block: LLVMBasicBlockRef,
|
||||
) -> LLVMValueRef;
|
||||
|
||||
/// Create a new descriptor for a local auto variable.
|
||||
pub fn LLVMDIBuilderCreateAutoVariable(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
AlwaysPreserve: LLVMBool,
|
||||
Flags: LLVMDIFlags,
|
||||
AlignInBits: u32,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Create a new descriptor for a function parameter variable.
|
||||
pub fn LLVMDIBuilderCreateParameterVariable(
|
||||
Builder: LLVMDIBuilderRef,
|
||||
Scope: LLVMMetadataRef,
|
||||
Name: *const ::libc::c_char,
|
||||
NameLen: ::libc::size_t,
|
||||
ArgNo: ::libc::c_uint,
|
||||
File: LLVMMetadataRef,
|
||||
LineNo: ::libc::c_uint,
|
||||
Ty: LLVMMetadataRef,
|
||||
AlwaysPreserve: LLVMBool,
|
||||
Flags: LLVMDIFlags,
|
||||
) -> LLVMMetadataRef;
|
||||
|
||||
/// Get the metadata of the subprogram attached to a function.
|
||||
pub fn LLVMGetSubprogram(Func: LLVMValueRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Set the subprogram attached to a function.
|
||||
pub fn LLVMSetSubprogram(Func: LLVMValueRef, SP: LLVMMetadataRef);
|
||||
|
||||
/// Get the line associated with a given subprogram.
|
||||
pub fn LLVMDISubprogramGetLine(Subprogram: LLVMMetadataRef) -> ::libc::c_uint;
|
||||
|
||||
/// Get the debug location for the given instruction.
|
||||
pub fn LLVMInstructionGetDebugLoc(Inst: LLVMValueRef) -> LLVMMetadataRef;
|
||||
|
||||
/// Set the debug location for the given instruction.
|
||||
pub fn LLVMInstructionSetDebugLoc(Inst: LLVMValueRef, Loc: LLVMMetadataRef);
|
||||
|
||||
/// Obtain the enumerated type of a metadata instance.
|
||||
pub fn LLVMGetMetadataKind(Metadata: LLVMMetadataRef) -> LLVMMetadataKind;
|
||||
}
|
147
ext/llvm-sys.rs/src/disassembler.rs
vendored
147
ext/llvm-sys.rs/src/disassembler.rs
vendored
@ -1,147 +0,0 @@
|
||||
//! A disassembler library.
|
||||
|
||||
#![allow(non_upper_case_globals, non_snake_case)]
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueDisasmContext {}
|
||||
|
||||
pub type LLVMDisasmContextRef = *mut LLVMOpaqueDisasmContext;
|
||||
|
||||
pub type LLVMOpInfoCallback = Option<
|
||||
extern "C" fn(
|
||||
DisInfo: *mut ::libc::c_void,
|
||||
PC: u64,
|
||||
Offset: u64,
|
||||
OpSize: u64,
|
||||
InstSize: u64,
|
||||
TagType: ::libc::c_int,
|
||||
TagBuf: *mut ::libc::c_void,
|
||||
) -> ::libc::c_int,
|
||||
>;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOpInfoSymbol1 {
|
||||
/// 1 if this symbol is present.
|
||||
pub Present: u64,
|
||||
/// Symbol name if not NULL.
|
||||
pub Name: *const ::libc::c_char,
|
||||
/// Symbol value if name is NULL.
|
||||
pub Value: u64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct Struct_LLVMOpInfo1 {
|
||||
pub AddSymbol: LLVMOpInfoSymbol1,
|
||||
pub SubtractSymbol: LLVMOpInfoSymbol1,
|
||||
pub Value: u64,
|
||||
pub VariantKind: u64,
|
||||
}
|
||||
|
||||
pub const LLVMDisassembler_VariantKind_None: u64 = 0;
|
||||
pub const LLVMDisassembler_VariantKind_ARM_HI16: u64 = 1;
|
||||
pub const LLVMDisassembler_VariantKind_ARM_LO16: u64 = 2;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_PAGE: u64 = 1;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_PAGEOFF: u64 = 2;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_GOTPAGE: u64 = 3;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_GOTPAGEOFF: u64 = 4;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_TLVP: u64 = 5;
|
||||
pub const LLVMDisassembler_VariantKind_ARM64_TLVOFF: u64 = 6;
|
||||
|
||||
/// No input reference type or no output reference type.
|
||||
pub const LLVMDisassembler_ReferenceType_InOut_None: u64 = 0;
|
||||
|
||||
/// The input reference is from a branch instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_Branch: u64 = 1;
|
||||
/// The input reference is from a PC relative load instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_PCrel_Load: u64 = 2;
|
||||
|
||||
/// The input reference is from an ARM64::ADRP instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADRP: u64 = 0x100000001;
|
||||
/// The input reference is from an ARM64::ADDXri instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADDXri: u64 = 0x100000002;
|
||||
/// The input reference is from an ARM64::LDRXui instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_ARM64_LDRXui: u64 = 0x100000003;
|
||||
/// The input reference is from an ARM64::LDRXl instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_ARM64_LDRXl: u64 = 0x100000004;
|
||||
/// The input reference is from an ARM64::ADR instruction.
|
||||
pub const LLVMDisassembler_ReferenceType_In_ARM64_ADR: u64 = 0x100000005;
|
||||
|
||||
/// The output reference is to as symbol stub.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_SymbolStub: u64 = 1;
|
||||
/// The output reference is to a symbol address in a literal pool.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr: u64 = 2;
|
||||
/// The output reference is to a cstring address in a literal pool.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr: u64 = 3;
|
||||
|
||||
/// The output reference is to a Objective-C CoreFoundation string.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref: u64 = 4;
|
||||
/// The output reference is to a Objective-C message.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_Objc_Message: u64 = 5;
|
||||
/// The output reference is to a Objective-C message ref.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref: u64 = 6;
|
||||
/// The output reference is to a Objective-C selector ref.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref: u64 = 7;
|
||||
/// The output reference is to a Objective-C class ref.
|
||||
pub const LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref: u64 = 8;
|
||||
/// The output reference is to a C++ symbol name.
|
||||
pub const LLVMDisassembler_ReferenceType_DeMangled_Name: u64 = 9;
|
||||
|
||||
/// The option to produce marked up assembly.
|
||||
pub const LLVMDisassembler_Option_UseMarkup: u64 = 1;
|
||||
/// The option to print immediates as hex.
|
||||
pub const LLVMDisassembler_Option_PrintImmHex: u64 = 2;
|
||||
/// The option use the other assembler printer variant
|
||||
pub const LLVMDisassembler_Option_AsmPrinterVariant: u64 = 4;
|
||||
/// The option to set comment on instructions
|
||||
pub const LLVMDisassembler_Option_SetInstrComments: u64 = 8;
|
||||
/// The option to print latency information alongside instructions
|
||||
pub const LLVMDisassembler_Option_PrintLatency: u64 = 16;
|
||||
|
||||
pub type LLVMSymbolLookupCallback = Option<
|
||||
extern "C" fn(
|
||||
DisInfo: *mut ::libc::c_void,
|
||||
ReferenceValue: u64,
|
||||
ReferenceType: *mut u64,
|
||||
ReferencePC: u64,
|
||||
ReferenceName: *mut *const ::libc::c_char,
|
||||
) -> *const ::libc::c_char,
|
||||
>;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMCreateDisasm(
|
||||
TripleName: *const ::libc::c_char,
|
||||
DisInfo: *mut ::libc::c_void,
|
||||
TagType: ::libc::c_int,
|
||||
GetOpInfo: LLVMOpInfoCallback,
|
||||
SymbolLookUp: LLVMSymbolLookupCallback,
|
||||
) -> LLVMDisasmContextRef;
|
||||
pub fn LLVMCreateDisasmCPU(
|
||||
Triple: *const ::libc::c_char,
|
||||
CPU: *const ::libc::c_char,
|
||||
DisInfo: *mut ::libc::c_void,
|
||||
TagType: ::libc::c_int,
|
||||
GetOpInfo: LLVMOpInfoCallback,
|
||||
SymbolLookUp: LLVMSymbolLookupCallback,
|
||||
) -> LLVMDisasmContextRef;
|
||||
pub fn LLVMCreateDisasmCPUFeatures(
|
||||
Triple: *const ::libc::c_char,
|
||||
CPU: *const ::libc::c_char,
|
||||
Features: *const ::libc::c_char,
|
||||
DisInfo: *mut ::libc::c_void,
|
||||
TagType: ::libc::c_int,
|
||||
GetOpInfo: LLVMOpInfoCallback,
|
||||
SymbolLookUp: LLVMSymbolLookupCallback,
|
||||
) -> LLVMDisasmContextRef;
|
||||
pub fn LLVMSetDisasmOptions(DC: LLVMDisasmContextRef, Options: u64) -> ::libc::c_int;
|
||||
pub fn LLVMDisasmDispose(DC: LLVMDisasmContextRef);
|
||||
pub fn LLVMDisasmInstruction(
|
||||
DC: LLVMDisasmContextRef,
|
||||
Bytes: *mut u8,
|
||||
BytesSize: u64,
|
||||
PC: u64,
|
||||
OutString: *mut ::libc::c_char,
|
||||
OutStringSize: ::libc::size_t,
|
||||
) -> ::libc::size_t;
|
||||
}
|
18
ext/llvm-sys.rs/src/error.rs
vendored
18
ext/llvm-sys.rs/src/error.rs
vendored
@ -1,18 +0,0 @@
|
||||
pub const LLVMErrorSuccess: ::libc::c_int = 0;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueError {}
|
||||
|
||||
pub type LLVMErrorRef = *mut LLVMOpaqueError;
|
||||
|
||||
pub type LLVMErrorTypeId = *const ::libc::c_void;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMGetErrorTypeId(Err: LLVMErrorRef) -> LLVMErrorTypeId;
|
||||
pub fn LLVMConsumeError(Err: LLVMErrorRef);
|
||||
pub fn LLVMGetErrorMessage(Err: LLVMErrorRef) -> *mut ::libc::c_char;
|
||||
pub fn LLVMDisposeErrorMessage(ErrMsg: *mut ::libc::c_char);
|
||||
pub fn LLVMGetStringErrorTypeId() -> LLVMErrorTypeId;
|
||||
/// Create a StringError.
|
||||
pub fn LLVMCreateStringError(ErrMst: *const ::libc::c_char) -> LLVMErrorRef;
|
||||
}
|
17
ext/llvm-sys.rs/src/error_handling.rs
vendored
17
ext/llvm-sys.rs/src/error_handling.rs
vendored
@ -1,17 +0,0 @@
|
||||
pub type LLVMFatalErrorHandler = Option<extern "C" fn(Reason: *const ::libc::c_char)>;
|
||||
|
||||
extern "C" {
|
||||
/// Install a fatal error handler.
|
||||
///
|
||||
/// LLVM will call `exit(1)` if it detects a fatal error. A callback
|
||||
/// registered with this function will be invoked before the program is
|
||||
/// exited.
|
||||
pub fn LLVMInstallFatalErrorHandler(Handler: LLVMFatalErrorHandler);
|
||||
/// Reset fatal error handling to the default.
|
||||
pub fn LLVMResetFatalErrorHandler();
|
||||
/// Enable LLVM's build-in stack trace code.
|
||||
///
|
||||
/// This intercepts the OS's crash signals and prints which component
|
||||
/// of LLVM you were in at the time of the crash.
|
||||
pub fn LLVMEnablePrettyStackTrace();
|
||||
}
|
212
ext/llvm-sys.rs/src/execution_engine.rs
vendored
212
ext/llvm-sys.rs/src/execution_engine.rs
vendored
@ -1,212 +0,0 @@
|
||||
//! Runtime code generation and execution.
|
||||
|
||||
use super::prelude::*;
|
||||
use super::target::LLVMTargetDataRef;
|
||||
use super::target_machine::{LLVMCodeModel, LLVMTargetMachineRef};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueGenericValue {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueExecutionEngine {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueMCJITMemoryManager {}
|
||||
|
||||
pub type LLVMGenericValueRef = *mut LLVMOpaqueGenericValue;
|
||||
pub type LLVMExecutionEngineRef = *mut LLVMOpaqueExecutionEngine;
|
||||
pub type LLVMMCJITMemoryManagerRef = *mut LLVMOpaqueMCJITMemoryManager;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct LLVMMCJITCompilerOptions {
|
||||
pub OptLevel: ::libc::c_uint,
|
||||
pub CodeModel: LLVMCodeModel,
|
||||
pub NoFramePointerElim: LLVMBool,
|
||||
pub EnableFastISel: LLVMBool,
|
||||
pub MCJMM: LLVMMCJITMemoryManagerRef,
|
||||
}
|
||||
|
||||
pub type LLVMMemoryManagerAllocateCodeSectionCallback = extern "C" fn(
|
||||
Opaque: *mut ::libc::c_void,
|
||||
Size: ::libc::uintptr_t,
|
||||
Alignment: ::libc::c_uint,
|
||||
SectionID: ::libc::c_uint,
|
||||
SectionName: *const ::libc::c_char,
|
||||
) -> *mut u8;
|
||||
pub type LLVMMemoryManagerAllocateDataSectionCallback = extern "C" fn(
|
||||
Opaque: *mut ::libc::c_void,
|
||||
Size: ::libc::uintptr_t,
|
||||
Alignment: ::libc::c_uint,
|
||||
SectionID: ::libc::c_uint,
|
||||
SectionName: *const ::libc::c_char,
|
||||
IsReadOnly: LLVMBool,
|
||||
) -> *mut u8;
|
||||
pub type LLVMMemoryManagerFinalizeMemoryCallback =
|
||||
extern "C" fn(Opaque: *mut ::libc::c_void, ErrMsg: *mut *mut ::libc::c_char) -> LLVMBool;
|
||||
pub type LLVMMemoryManagerDestroyCallback = Option<extern "C" fn(Opaque: *mut ::libc::c_void)>;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMLinkInMCJIT();
|
||||
pub fn LLVMLinkInInterpreter();
|
||||
|
||||
// Operations on generic values
|
||||
pub fn LLVMCreateGenericValueOfInt(
|
||||
Ty: LLVMTypeRef,
|
||||
N: ::libc::c_ulonglong,
|
||||
IsSigned: LLVMBool,
|
||||
) -> LLVMGenericValueRef;
|
||||
pub fn LLVMCreateGenericValueOfPointer(P: *mut ::libc::c_void) -> LLVMGenericValueRef;
|
||||
pub fn LLVMCreateGenericValueOfFloat(
|
||||
Ty: LLVMTypeRef,
|
||||
N: ::libc::c_double,
|
||||
) -> LLVMGenericValueRef;
|
||||
pub fn LLVMGenericValueIntWidth(GenValRef: LLVMGenericValueRef) -> ::libc::c_uint;
|
||||
pub fn LLVMGenericValueToInt(
|
||||
GenVal: LLVMGenericValueRef,
|
||||
IsSigned: LLVMBool,
|
||||
) -> ::libc::c_ulonglong;
|
||||
pub fn LLVMGenericValueToPointer(GenVal: LLVMGenericValueRef) -> *mut ::libc::c_void;
|
||||
pub fn LLVMGenericValueToFloat(
|
||||
TyRef: LLVMTypeRef,
|
||||
GenVal: LLVMGenericValueRef,
|
||||
) -> ::libc::c_double;
|
||||
pub fn LLVMDisposeGenericValue(GenVal: LLVMGenericValueRef);
|
||||
|
||||
// Operations on execution engines
|
||||
pub fn LLVMCreateExecutionEngineForModule(
|
||||
OutEE: *mut LLVMExecutionEngineRef,
|
||||
M: LLVMModuleRef,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMCreateInterpreterForModule(
|
||||
OutInterp: *mut LLVMExecutionEngineRef,
|
||||
M: LLVMModuleRef,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMCreateJITCompilerForModule(
|
||||
OutJIT: *mut LLVMExecutionEngineRef,
|
||||
M: LLVMModuleRef,
|
||||
OptLevel: ::libc::c_uint,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMInitializeMCJITCompilerOptions(
|
||||
Options: *mut LLVMMCJITCompilerOptions,
|
||||
SizeOfOptions: ::libc::size_t,
|
||||
);
|
||||
|
||||
/// Create an MCJIT execution engine for a module, with the given options.
|
||||
///
|
||||
/// It is
|
||||
/// the responsibility of the caller to ensure that all fields in Options up to
|
||||
/// the given SizeOfOptions are initialized. It is correct to pass a smaller
|
||||
/// value of SizeOfOptions that omits some fields. The canonical way of using
|
||||
/// this is:
|
||||
///
|
||||
/// ```c++
|
||||
/// LLVMMCJITCompilerOptions options;
|
||||
/// LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
|
||||
/// // ... fill in those options you care about
|
||||
/// LLVMCreateMCJITCompilerForModule(&jit, mod, &options, sizeof(options),
|
||||
/// &error);
|
||||
/// ```
|
||||
///
|
||||
/// Note that this is also correct, though possibly suboptimal:
|
||||
///
|
||||
/// ```c++
|
||||
/// LLVMCreateMCJITCompilerForModule(&jit, mod, 0, 0, &error);
|
||||
/// ```
|
||||
///
|
||||
/// 0 is returned on success, or 1 on failure.
|
||||
pub fn LLVMCreateMCJITCompilerForModule(
|
||||
OutJIT: *mut LLVMExecutionEngineRef,
|
||||
M: LLVMModuleRef,
|
||||
Options: *mut LLVMMCJITCompilerOptions,
|
||||
SizeOfOptions: ::libc::size_t,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
|
||||
pub fn LLVMDisposeExecutionEngine(EE: LLVMExecutionEngineRef);
|
||||
pub fn LLVMRunStaticConstructors(EE: LLVMExecutionEngineRef);
|
||||
pub fn LLVMRunStaticDestructors(EE: LLVMExecutionEngineRef);
|
||||
pub fn LLVMRunFunctionAsMain(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
F: LLVMValueRef,
|
||||
ArgC: ::libc::c_uint,
|
||||
ArgV: *const *const ::libc::c_char,
|
||||
EnvP: *const *const ::libc::c_char,
|
||||
) -> ::libc::c_int;
|
||||
pub fn LLVMRunFunction(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
F: LLVMValueRef,
|
||||
NumArgs: ::libc::c_uint,
|
||||
Args: *mut LLVMGenericValueRef,
|
||||
) -> LLVMGenericValueRef;
|
||||
pub fn LLVMFreeMachineCodeForFunction(EE: LLVMExecutionEngineRef, F: LLVMValueRef);
|
||||
pub fn LLVMAddModule(EE: LLVMExecutionEngineRef, M: LLVMModuleRef);
|
||||
pub fn LLVMRemoveModule(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
M: LLVMModuleRef,
|
||||
OutMod: *mut LLVMModuleRef,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMFindFunction(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
Name: *const ::libc::c_char,
|
||||
OutFn: *mut LLVMValueRef,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMRecompileAndRelinkFunction(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
Fn: LLVMValueRef,
|
||||
) -> *mut ::libc::c_void;
|
||||
pub fn LLVMGetExecutionEngineTargetData(EE: LLVMExecutionEngineRef) -> LLVMTargetDataRef;
|
||||
pub fn LLVMGetExecutionEngineTargetMachine(EE: LLVMExecutionEngineRef) -> LLVMTargetMachineRef;
|
||||
pub fn LLVMAddGlobalMapping(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
Global: LLVMValueRef,
|
||||
Addr: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMGetPointerToGlobal(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
Global: LLVMValueRef,
|
||||
) -> *mut ::libc::c_void;
|
||||
pub fn LLVMGetGlobalValueAddress(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> u64;
|
||||
pub fn LLVMGetFunctionAddress(EE: LLVMExecutionEngineRef, Name: *const ::libc::c_char) -> u64;
|
||||
|
||||
pub fn LLVMExecutionEngineGetErrMsg(
|
||||
EE: LLVMExecutionEngineRef,
|
||||
OutError: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
|
||||
// Operations on memory managers
|
||||
// Create a simple custom MCJIT memory manager.
|
||||
//
|
||||
// This memory manager can intercept allocations in a module-oblivious way. It will
|
||||
// return NULL if any of the passed functions are NULL.
|
||||
//
|
||||
// `AllocateCodeSection` and `AllocateDataSection` are called to allocate blocks
|
||||
// of memory for executable code and data, respectively. `FinalizeMemory` is called
|
||||
// to set page permissions and flush caches, returning 0 on success and 1 on error.
|
||||
//
|
||||
// `Opaque` will be passed to the callbacks.
|
||||
pub fn LLVMCreateSimpleMCJITMemoryManager(
|
||||
Opaque: *mut ::libc::c_void,
|
||||
AllocateCodeSection: LLVMMemoryManagerAllocateCodeSectionCallback,
|
||||
AllocateDataSection: LLVMMemoryManagerAllocateDataSectionCallback,
|
||||
FinalizeMemory: LLVMMemoryManagerFinalizeMemoryCallback,
|
||||
Destroy: LLVMMemoryManagerDestroyCallback,
|
||||
) -> LLVMMCJITMemoryManagerRef;
|
||||
|
||||
pub fn LLVMDisposeMCJITMemoryManager(MM: LLVMMCJITMemoryManagerRef);
|
||||
|
||||
// JIT event listener functions
|
||||
pub fn LLVMCreateGDBRegistrationListener() -> LLVMJITEventListenerRef;
|
||||
pub fn LLVMCreateIntelJITEventListener() -> LLVMJITEventListenerRef;
|
||||
pub fn LLVMCreateOProfileJITEventListener() -> LLVMJITEventListenerRef;
|
||||
pub fn LLVMCreatePerfJITEventListener() -> LLVMJITEventListenerRef;
|
||||
|
||||
}
|
19
ext/llvm-sys.rs/src/initialization.rs
vendored
19
ext/llvm-sys.rs/src/initialization.rs
vendored
@ -1,19 +0,0 @@
|
||||
//! Initialization routines which must be called before using library features.
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMInitializeCore(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeTransformUtils(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeScalarOpts(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeObjCARCOpts(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeVectorization(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeInstCombine(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeAggressiveInstCombiner(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeIPO(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeInstrumentation(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeAnalysis(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeIPA(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeCodeGen(R: LLVMPassRegistryRef);
|
||||
pub fn LLVMInitializeTarget(R: LLVMPassRegistryRef);
|
||||
}
|
16
ext/llvm-sys.rs/src/ir_reader.rs
vendored
16
ext/llvm-sys.rs/src/ir_reader.rs
vendored
@ -1,16 +0,0 @@
|
||||
//! The IR reader
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
extern "C" {
|
||||
/// Read LLVM IR from a memory buffer and convert it to an in-memory Module.
|
||||
///
|
||||
/// Returns 0 on success, and an optional human-readable description of any
|
||||
/// errors that occurred.
|
||||
pub fn LLVMParseIRInContext(
|
||||
ContextRef: LLVMContextRef,
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
OutM: *mut LLVMModuleRef,
|
||||
OutMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
}
|
500
ext/llvm-sys.rs/src/lib.rs
vendored
500
ext/llvm-sys.rs/src/lib.rs
vendored
@ -1,500 +0,0 @@
|
||||
//! Bindings to LLVM's C API.
|
||||
//!
|
||||
//! Refer to the [LLVM documentation](http://llvm.org/docs/) for more
|
||||
//! information.
|
||||
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
use self::prelude::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMMemoryBuffer {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMContext {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMModule {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMType {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMValue {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMBasicBlock {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueMetadata {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueNamedMDNode {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueValueMetadataEntry {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMBuilder {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueDIBuilder {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMModuleProvider {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMPassManager {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMPassRegistry {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMUse {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMDiagnosticInfo {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMComdat {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueModuleFlagEntry {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueJITEventListener {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueAttributeRef {}
|
||||
|
||||
/// Core types used throughout LLVM.
|
||||
///
|
||||
/// In most cases you will want to `use llvm::prelude::*`.
|
||||
pub mod prelude {
|
||||
pub type LLVMBool = ::libc::c_int;
|
||||
pub type LLVMMemoryBufferRef = *mut super::LLVMMemoryBuffer;
|
||||
pub type LLVMContextRef = *mut super::LLVMContext;
|
||||
pub type LLVMModuleRef = *mut super::LLVMModule;
|
||||
pub type LLVMTypeRef = *mut super::LLVMType;
|
||||
pub type LLVMValueRef = *mut super::LLVMValue;
|
||||
pub type LLVMBasicBlockRef = *mut super::LLVMBasicBlock;
|
||||
pub type LLVMMetadataRef = *mut super::LLVMOpaqueMetadata;
|
||||
pub type LLVMNamedMDNodeRef = *mut super::LLVMOpaqueNamedMDNode;
|
||||
pub type LLVMValueMetadataEntry = *mut super::LLVMOpaqueValueMetadataEntry;
|
||||
pub type LLVMBuilderRef = *mut super::LLVMBuilder;
|
||||
pub type LLVMDIBuilderRef = *mut super::LLVMOpaqueDIBuilder;
|
||||
pub type LLVMModuleProviderRef = *mut super::LLVMModuleProvider;
|
||||
pub type LLVMPassManagerRef = *mut super::LLVMPassManager;
|
||||
pub type LLVMPassRegistryRef = *mut super::LLVMPassRegistry;
|
||||
pub type LLVMUseRef = *mut super::LLVMUse;
|
||||
pub type LLVMDiagnosticInfoRef = *mut super::LLVMDiagnosticInfo;
|
||||
pub type LLVMComdatRef = *mut super::LLVMComdat;
|
||||
pub type LLVMModuleFlagEntry = *mut super::LLVMOpaqueModuleFlagEntry;
|
||||
pub type LLVMJITEventListenerRef = *mut super::LLVMOpaqueJITEventListener;
|
||||
pub type LLVMAttributeRef = *mut super::LLVMOpaqueAttributeRef;
|
||||
}
|
||||
|
||||
pub mod analysis;
|
||||
pub mod bit_reader;
|
||||
pub mod bit_writer;
|
||||
pub mod blake3;
|
||||
pub mod comdat;
|
||||
pub mod core;
|
||||
pub mod debuginfo;
|
||||
pub mod disassembler;
|
||||
pub mod error;
|
||||
pub mod error_handling;
|
||||
pub mod execution_engine;
|
||||
pub mod initialization;
|
||||
pub mod ir_reader;
|
||||
pub mod linker;
|
||||
pub mod lto;
|
||||
pub mod object;
|
||||
pub mod orc2;
|
||||
pub mod remarks;
|
||||
pub mod support;
|
||||
pub mod target;
|
||||
pub mod target_machine;
|
||||
|
||||
pub mod transforms {
|
||||
pub mod aggressive_instcombine;
|
||||
pub mod instcombine;
|
||||
pub mod ipo;
|
||||
pub mod pass_builder;
|
||||
pub mod pass_manager_builder;
|
||||
pub mod scalar;
|
||||
pub mod util;
|
||||
pub mod vectorize;
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMOpcode {
|
||||
LLVMRet = 1,
|
||||
LLVMBr = 2,
|
||||
LLVMSwitch = 3,
|
||||
LLVMIndirectBr = 4,
|
||||
LLVMInvoke = 5,
|
||||
LLVMUnreachable = 7,
|
||||
LLVMCallBr = 67,
|
||||
LLVMFNeg = 66,
|
||||
LLVMAdd = 8,
|
||||
LLVMFAdd = 9,
|
||||
LLVMSub = 10,
|
||||
LLVMFSub = 11,
|
||||
LLVMMul = 12,
|
||||
LLVMFMul = 13,
|
||||
LLVMUDiv = 14,
|
||||
LLVMSDiv = 15,
|
||||
LLVMFDiv = 16,
|
||||
LLVMURem = 17,
|
||||
LLVMSRem = 18,
|
||||
LLVMFRem = 19,
|
||||
LLVMShl = 20,
|
||||
LLVMLShr = 21,
|
||||
LLVMAShr = 22,
|
||||
LLVMAnd = 23,
|
||||
LLVMOr = 24,
|
||||
LLVMXor = 25,
|
||||
LLVMAlloca = 26,
|
||||
LLVMLoad = 27,
|
||||
LLVMStore = 28,
|
||||
LLVMGetElementPtr = 29,
|
||||
LLVMTrunc = 30,
|
||||
LLVMZExt = 31,
|
||||
LLVMSExt = 32,
|
||||
LLVMFPToUI = 33,
|
||||
LLVMFPToSI = 34,
|
||||
LLVMUIToFP = 35,
|
||||
LLVMSIToFP = 36,
|
||||
LLVMFPTrunc = 37,
|
||||
LLVMFPExt = 38,
|
||||
LLVMPtrToInt = 39,
|
||||
LLVMIntToPtr = 40,
|
||||
LLVMBitCast = 41,
|
||||
LLVMAddrSpaceCast = 60,
|
||||
LLVMICmp = 42,
|
||||
LLVMFCmp = 43,
|
||||
LLVMPHI = 44,
|
||||
LLVMCall = 45,
|
||||
LLVMSelect = 46,
|
||||
LLVMUserOp1 = 47,
|
||||
LLVMUserOp2 = 48,
|
||||
LLVMVAArg = 49,
|
||||
LLVMExtractElement = 50,
|
||||
LLVMInsertElement = 51,
|
||||
LLVMShuffleVector = 52,
|
||||
LLVMExtractValue = 53,
|
||||
LLVMInsertValue = 54,
|
||||
LLVMFreeze = 68,
|
||||
LLVMFence = 55,
|
||||
LLVMAtomicCmpXchg = 56,
|
||||
LLVMAtomicRMW = 57,
|
||||
LLVMResume = 58,
|
||||
LLVMLandingPad = 59,
|
||||
LLVMCleanupRet = 61,
|
||||
LLVMCatchRet = 62,
|
||||
LLVMCatchPad = 63,
|
||||
LLVMCleanupPad = 64,
|
||||
LLVMCatchSwitch = 65,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMTypeKind {
|
||||
LLVMVoidTypeKind = 0,
|
||||
LLVMHalfTypeKind = 1,
|
||||
LLVMFloatTypeKind = 2,
|
||||
LLVMDoubleTypeKind = 3,
|
||||
LLVMX86_FP80TypeKind = 4,
|
||||
LLVMFP128TypeKind = 5,
|
||||
LLVMPPC_FP128TypeKind = 6,
|
||||
LLVMLabelTypeKind = 7,
|
||||
LLVMIntegerTypeKind = 8,
|
||||
LLVMFunctionTypeKind = 9,
|
||||
LLVMStructTypeKind = 10,
|
||||
LLVMArrayTypeKind = 11,
|
||||
LLVMPointerTypeKind = 12,
|
||||
LLVMVectorTypeKind = 13,
|
||||
LLVMMetadataTypeKind = 14,
|
||||
LLVMX86_MMXTypeKind = 15,
|
||||
LLVMTokenTypeKind = 16,
|
||||
LLVMScalableVectorTypeKind = 17,
|
||||
LLVMBFloatTypeKind = 18,
|
||||
LLVMX86_AMXTypeKind = 19,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMLinkage {
|
||||
LLVMExternalLinkage = 0,
|
||||
LLVMAvailableExternallyLinkage = 1,
|
||||
LLVMLinkOnceAnyLinkage = 2,
|
||||
LLVMLinkOnceODRLinkage = 3,
|
||||
LLVMLinkOnceODRAutoHideLinkage = 4,
|
||||
LLVMWeakAnyLinkage = 5,
|
||||
LLVMWeakODRLinkage = 6,
|
||||
LLVMAppendingLinkage = 7,
|
||||
LLVMInternalLinkage = 8,
|
||||
LLVMPrivateLinkage = 9,
|
||||
LLVMDLLImportLinkage = 10,
|
||||
LLVMDLLExportLinkage = 11,
|
||||
LLVMExternalWeakLinkage = 12,
|
||||
LLVMGhostLinkage = 13,
|
||||
LLVMCommonLinkage = 14,
|
||||
LLVMLinkerPrivateLinkage = 15,
|
||||
LLVMLinkerPrivateWeakLinkage = 16,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMVisibility {
|
||||
LLVMDefaultVisibility = 0,
|
||||
LLVMHiddenVisibility = 1,
|
||||
LLVMProtectedVisibility = 2,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMUnnamedAddr {
|
||||
/// Address of the GV is significant.
|
||||
LLVMNoUnnamedAddr,
|
||||
/// Address of the GV is locally insignificant.
|
||||
LLVMLocalUnnamedAddr,
|
||||
/// Address of the GV is globally insignificant.
|
||||
LLVMGlobalUnnamedAddr,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMDLLStorageClass {
|
||||
LLVMDefaultStorageClass = 0,
|
||||
LLVMDLLImportStorageClass = 1,
|
||||
LLVMDLLExportStorageClass = 2,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMCallConv {
|
||||
LLVMCCallConv = 0,
|
||||
LLVMFastCallConv = 8,
|
||||
LLVMColdCallConv = 9,
|
||||
LLVMGHCCallConv = 10,
|
||||
LLVMHiPECallConv = 11,
|
||||
LLVMWebKitJSCallConv = 12,
|
||||
LLVMAnyRegCallConv = 13,
|
||||
LLVMPreserveMostCallConv = 14,
|
||||
LLVMPreserveAllCallConv = 15,
|
||||
LLVMSwiftCallConv = 16,
|
||||
LLVMCXXFASTTLSCallConv = 17,
|
||||
LLVMX86StdcallCallConv = 64,
|
||||
LLVMX86FastcallCallConv = 65,
|
||||
LLVMARMAPCSCallConv = 66,
|
||||
LLVMARMAAPCSCallConv = 67,
|
||||
LLVMARMAAPCSVFPCallConv = 68,
|
||||
LLVMMSP430INTRCallConv = 69,
|
||||
LLVMX86ThisCallCallConv = 70,
|
||||
LLVMPTXKernelCallConv = 71,
|
||||
LLVMPTXDeviceCallConv = 72,
|
||||
LLVMSPIRFUNCCallConv = 75,
|
||||
LLVMSPIRKERNELCallConv = 76,
|
||||
LLVMIntelOCLBICallConv = 77,
|
||||
LLVMX8664SysVCallConv = 78,
|
||||
LLVMWin64CallConv = 79,
|
||||
LLVMX86VectorCallCallConv = 80,
|
||||
LLVMHHVMCallConv = 81,
|
||||
LLVMHHVMCCallConv = 82,
|
||||
LLVMX86INTRCallConv = 83,
|
||||
LLVMAVRINTRCallConv = 84,
|
||||
LLVMAVRSIGNALCallConv = 85,
|
||||
LLVMAVRBUILTINCallConv = 86,
|
||||
LLVMAMDGPUVSCallConv = 87,
|
||||
LLVMAMDGPUGSCallConv = 88,
|
||||
LLVMAMDGPUPSCallConv = 89,
|
||||
LLVMAMDGPUCSCallConv = 90,
|
||||
LLVMAMDGPUKERNELCallConv = 91,
|
||||
LLVMX86RegCallCallConv = 92,
|
||||
LLVMAMDGPUHSCallConv = 93,
|
||||
LLVMMSP430BUILTINCallConv = 94,
|
||||
LLVMAMDGPULSCallConv = 95,
|
||||
LLVMAMDGPUESCallConv = 96,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMValueKind {
|
||||
LLVMArgumentValueKind,
|
||||
LLVMBasicBlockValueKind,
|
||||
LLVMMemoryUseValueKind,
|
||||
LLVMMemoryDefValueKind,
|
||||
LLVMMemoryPhiValueKind,
|
||||
|
||||
LLVMFunctionValueKind,
|
||||
LLVMGlobalAliasValueKind,
|
||||
LLVMGlobalIFuncValueKind,
|
||||
LLVMGlobalVariableValueKind,
|
||||
LLVMBlockAddressValueKind,
|
||||
LLVMConstantExprValueKind,
|
||||
LLVMConstantArrayValueKind,
|
||||
LLVMConstantStructValueKind,
|
||||
LLVMConstantVectorValueKind,
|
||||
LLVMUndefValueValueKind,
|
||||
LLVMConstantAggregateZeroValueKind,
|
||||
LLVMConstantDataArrayValueKind,
|
||||
LLVMConstantDataVectorValueKind,
|
||||
LLVMConstantIntValueKind,
|
||||
LLVMConstantFPValueKind,
|
||||
LLVMConstantPointerNullValueKind,
|
||||
LLVMConstantTokenNoneValueKind,
|
||||
|
||||
LLVMMetadataAsValueValueKind,
|
||||
LLVMInlineAsmValueKind,
|
||||
|
||||
LLVMInstructionValueKind,
|
||||
LLVMPoisonValueKind,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMIntPredicate {
|
||||
LLVMIntEQ = 32,
|
||||
LLVMIntNE = 33,
|
||||
LLVMIntUGT = 34,
|
||||
LLVMIntUGE = 35,
|
||||
LLVMIntULT = 36,
|
||||
LLVMIntULE = 37,
|
||||
LLVMIntSGT = 38,
|
||||
LLVMIntSGE = 39,
|
||||
LLVMIntSLT = 40,
|
||||
LLVMIntSLE = 41,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMRealPredicate {
|
||||
LLVMRealPredicateFalse = 0,
|
||||
LLVMRealOEQ = 1,
|
||||
LLVMRealOGT = 2,
|
||||
LLVMRealOGE = 3,
|
||||
LLVMRealOLT = 4,
|
||||
LLVMRealOLE = 5,
|
||||
LLVMRealONE = 6,
|
||||
LLVMRealORD = 7,
|
||||
LLVMRealUNO = 8,
|
||||
LLVMRealUEQ = 9,
|
||||
LLVMRealUGT = 10,
|
||||
LLVMRealUGE = 11,
|
||||
LLVMRealULT = 12,
|
||||
LLVMRealULE = 13,
|
||||
LLVMRealUNE = 14,
|
||||
LLVMRealPredicateTrue = 15,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMLandingPadClauseTy {
|
||||
LLVMLandingPadCatch = 0,
|
||||
LLVMLandingPadFilter = 1,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMThreadLocalMode {
|
||||
LLVMNotThreadLocal = 0,
|
||||
LLVMGeneralDynamicTLSModel = 1,
|
||||
LLVMLocalDynamicTLSModel = 2,
|
||||
LLVMInitialExecTLSModel = 3,
|
||||
LLVMLocalExecTLSModel = 4,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMAtomicOrdering {
|
||||
LLVMAtomicOrderingNotAtomic = 0,
|
||||
LLVMAtomicOrderingUnordered = 1,
|
||||
LLVMAtomicOrderingMonotonic = 2,
|
||||
LLVMAtomicOrderingAcquire = 4,
|
||||
LLVMAtomicOrderingRelease = 5,
|
||||
LLVMAtomicOrderingAcquireRelease = 6,
|
||||
LLVMAtomicOrderingSequentiallyConsistent = 7,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMAtomicRMWBinOp {
|
||||
LLVMAtomicRMWBinOpXchg = 0,
|
||||
LLVMAtomicRMWBinOpAdd = 1,
|
||||
LLVMAtomicRMWBinOpSub = 2,
|
||||
LLVMAtomicRMWBinOpAnd = 3,
|
||||
LLVMAtomicRMWBinOpNand = 4,
|
||||
LLVMAtomicRMWBinOpOr = 5,
|
||||
LLVMAtomicRMWBinOpXor = 6,
|
||||
LLVMAtomicRMWBinOpMax = 7,
|
||||
LLVMAtomicRMWBinOpMin = 8,
|
||||
LLVMAtomicRMWBinOpUMax = 9,
|
||||
LLVMAtomicRMWBinOpUMin = 10,
|
||||
LLVMAtomicRMWBinOpFAdd = 11,
|
||||
LLVMAtomicRMWBinOpFSub = 12,
|
||||
LLVMAtomicRMWBinOpFMax = 13,
|
||||
LLVMAtomicRMWBinOpFMin = 14,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMDiagnosticSeverity {
|
||||
LLVMDSError = 0,
|
||||
LLVMDSWarning = 1,
|
||||
LLVMDSRemark = 2,
|
||||
LLVMDSNote = 3,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMInlineAsmDialect {
|
||||
LLVMInlineAsmDialectATT,
|
||||
LLVMInlineAsmDialectIntel,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMModuleFlagBehavior {
|
||||
/// Emits an error if two values disagree, otherwise the resulting value is that of the operands.
|
||||
LLVMModuleFlagBehaviorError,
|
||||
/// Emits a warning if two values disagree. The result value will be the operand for the flag from the first module being linked.
|
||||
LLVMModuleFlagBehaviorWarning,
|
||||
/// Adds a requirement that another module flag be present and have a specified value after linking is performed. The value must be a metadata pair, where the first element of the pair is the ID of the module flag to be restricted, and the second element of the pair is the value the module flag should be restricted to. This behavior can be used to restrict the allowable results (via triggering of an error) of linking IDs with the **Override** behavior.
|
||||
LLVMModuleFlagBehaviorRequire,
|
||||
/// Uses the specified value, regardless of the behavior or value of the other module. If both modules specify **Override**, but the values differ, an error will be emitted.
|
||||
LLVMModuleFlagBehaviorOverride,
|
||||
/// Appends the two values, which are required to be metadata nodes.
|
||||
LLVMModuleFlagBehaviorAppend,
|
||||
/// Appends the two values, which are required to be metadata nodes. However, duplicate entries in the second list are dropped during the append operation.
|
||||
LLVMModuleFlagBehaviorAppendUnique,
|
||||
}
|
||||
|
||||
pub const LLVMAttributeReturnIndex: ::libc::c_uint = 0;
|
||||
pub const LLVMAttributeFunctionIndex: ::libc::c_uint = !0; // -1
|
||||
/// Either LLVMAttributeReturnIndex, LLVMAttributeFunctionIndex, or a parameter
|
||||
/// number from 1 to N.
|
||||
pub type LLVMAttributeIndex = ::libc::c_uint;
|
||||
|
||||
pub type LLVMDiagnosticHandler =
|
||||
Option<extern "C" fn(arg1: LLVMDiagnosticInfoRef, arg2: *mut ::libc::c_void)>;
|
||||
pub type LLVMYieldCallback = Option<extern "C" fn(arg1: LLVMContextRef, arg2: *mut ::libc::c_void)>;
|
||||
|
||||
#[cfg(all(not(doc), not(feature = "no-llvm-linking"), LLVM_SYS_NOT_FOUND))]
|
||||
std::compile_error!(concat!(
|
||||
"No suitable version of LLVM was found system-wide or pointed
|
||||
to by LLVM_SYS_",
|
||||
env!("CARGO_PKG_VERSION_MAJOR"),
|
||||
"_PREFIX.
|
||||
|
||||
Consider using `llvmenv` to compile an appropriate copy of LLVM, and
|
||||
refer to the llvm-sys documentation for more information.
|
||||
|
||||
llvm-sys: https://crates.io/crates/llvm-sys
|
||||
llvmenv: https://crates.io/crates/llvmenv"
|
||||
));
|
19
ext/llvm-sys.rs/src/linker.rs
vendored
19
ext/llvm-sys.rs/src/linker.rs
vendored
@ -1,19 +0,0 @@
|
||||
//! The module/file/archive linker
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMLinkerMode {
|
||||
LLVMLinkerDestroySource = 0,
|
||||
#[deprecated(since = "3.7.0", note = "LLVMLinkerPreserveSource has no effect")]
|
||||
LLVMLinkerPreserveSource_Removed = 1,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// Link the source module into the destination module.
|
||||
///
|
||||
/// Destroys the source module, returns true on error. Use the diagnostic
|
||||
/// handler to get any diagnostic message.
|
||||
pub fn LLVMLinkModules2(Dest: LLVMModuleRef, Src: LLVMModuleRef) -> LLVMBool;
|
||||
}
|
442
ext/llvm-sys.rs/src/lto.rs
vendored
442
ext/llvm-sys.rs/src/lto.rs
vendored
@ -1,442 +0,0 @@
|
||||
//! Abstract link time optimization.
|
||||
//!
|
||||
//! ## ThinLTO
|
||||
//!
|
||||
//! ThinLTO is designed to do LTO while requiring fewer resources than regular
|
||||
//! LTO. It can run much faster and in less memory (comparable to linking
|
||||
//! without LTO) than regular LTO, with essentially no loss in optimization.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
pub type lto_bool_t = u8;
|
||||
|
||||
// This looks kind of like bitflags but I'm not sure.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum lto_symbol_attributes {
|
||||
LTO_SYMBOL_ALIGNMENT_MASK = 31,
|
||||
LTO_SYMBOL_PERMISSIONS_MASK = 224,
|
||||
LTO_SYMBOL_PERMISSIONS_CODE = 160,
|
||||
LTO_SYMBOL_PERMISSIONS_DATA = 192,
|
||||
LTO_SYMBOL_PERMISSIONS_RODATA = 128,
|
||||
LTO_SYMBOL_DEFINITION_MASK = 1792,
|
||||
LTO_SYMBOL_DEFINITION_REGULAR = 256,
|
||||
LTO_SYMBOL_DEFINITION_TENTATIVE = 512,
|
||||
LTO_SYMBOL_DEFINITION_WEAK = 768,
|
||||
LTO_SYMBOL_DEFINITION_UNDEFINED = 1024,
|
||||
LTO_SYMBOL_DEFINITION_WEAKUNDEF = 1280,
|
||||
LTO_SYMBOL_SCOPE_MASK = 14336,
|
||||
LTO_SYMBOL_SCOPE_INTERNAL = 2048,
|
||||
LTO_SYMBOL_SCOPE_HIDDEN = 0x1000,
|
||||
LTO_SYMBOL_SCOPE_PROTECTED = 0x2000,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT = 0x1800,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN = 0x2800,
|
||||
/// Added in LLVM 3.7.
|
||||
LTO_SYMBOL_COMDAT = 0x4000,
|
||||
/// Added in LLVM 3.7.
|
||||
LTO_SYMBOL_ALIAS = 0x8000,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum lto_debug_model {
|
||||
LTO_DEBUG_MODEL_NONE = 0,
|
||||
LTO_DEBUG_MODEL_DWARF = 1,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum lto_codegen_model {
|
||||
LTO_CODEGEN_PIC_MODEL_STATIC = 0,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC = 1,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC = 2,
|
||||
LTO_CODEGEN_PIC_MODEL_DEFAULT = 3,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueLTOModule {}
|
||||
|
||||
pub type lto_module_t = *mut LLVMOpaqueLTOModule;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueLTOCodeGenerator {}
|
||||
|
||||
pub type lto_code_gen_t = *mut LLVMOpaqueLTOCodeGenerator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueThinLTOCodeGenerator {}
|
||||
|
||||
pub type thinlto_code_gen_t = *mut LLVMOpaqueThinLTOCodeGenerator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueLTOInput {}
|
||||
|
||||
pub type lto_input_t = *mut LLVMOpaqueLTOInput;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum lto_codegen_diagnostic_severity_t {
|
||||
LTO_DS_ERROR = 0,
|
||||
LTO_DS_WARNING = 1,
|
||||
LTO_DS_REMARK = 3,
|
||||
LTO_DS_NOTE = 2,
|
||||
}
|
||||
|
||||
pub type lto_diagnostic_handler_t = Option<
|
||||
extern "C" fn(
|
||||
severity: lto_codegen_diagnostic_severity_t,
|
||||
diag: *const ::libc::c_char,
|
||||
ctxt: *mut ::libc::c_void,
|
||||
),
|
||||
>;
|
||||
|
||||
extern "C" {
|
||||
pub fn lto_get_version() -> *const ::libc::c_char;
|
||||
pub fn lto_get_error_message() -> *const ::libc::c_char;
|
||||
pub fn lto_module_is_object_file(path: *const ::libc::c_char) -> lto_bool_t;
|
||||
pub fn lto_module_is_object_file_for_target(
|
||||
path: *const ::libc::c_char,
|
||||
target_triple_prefix: *const ::libc::c_char,
|
||||
) -> lto_bool_t;
|
||||
/// Return true if `Buffer` contains a bitcode file with ObjC code
|
||||
/// (category or class) in it.
|
||||
pub fn lto_module_has_objc_category(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
) -> lto_bool_t;
|
||||
/// Checks if a buffer is a loadable object file.
|
||||
pub fn lto_module_is_object_file_in_memory(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
) -> lto_bool_t;
|
||||
pub fn lto_module_is_object_file_in_memory_for_target(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
target_triple_prefix: *const ::libc::c_char,
|
||||
) -> lto_bool_t;
|
||||
pub fn lto_module_create(path: *const ::libc::c_char) -> lto_module_t;
|
||||
pub fn lto_module_create_from_memory(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_create_from_memory_with_path(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
path: *const ::libc::c_char,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_create_in_local_context(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
path: *const ::libc::c_char,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_create_in_codegen_context(
|
||||
mem: *const ::libc::c_void,
|
||||
length: ::libc::size_t,
|
||||
path: *const ::libc::c_char,
|
||||
cg: lto_code_gen_t,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_create_from_fd(
|
||||
fd: ::libc::c_int,
|
||||
path: *const ::libc::c_char,
|
||||
file_size: ::libc::size_t,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_create_from_fd_at_offset(
|
||||
fd: ::libc::c_int,
|
||||
path: *const ::libc::c_char,
|
||||
file_size: ::libc::size_t,
|
||||
map_size: ::libc::size_t,
|
||||
offset: ::libc::off_t,
|
||||
) -> lto_module_t;
|
||||
pub fn lto_module_dispose(_mod: lto_module_t);
|
||||
pub fn lto_module_get_target_triple(_mod: lto_module_t) -> *const ::libc::c_char;
|
||||
pub fn lto_module_set_target_triple(_mod: lto_module_t, triple: *const ::libc::c_char);
|
||||
pub fn lto_module_get_num_symbols(_mod: lto_module_t) -> ::libc::c_uint;
|
||||
pub fn lto_module_get_symbol_name(
|
||||
_mod: lto_module_t,
|
||||
index: ::libc::c_uint,
|
||||
) -> *const ::libc::c_char;
|
||||
pub fn lto_module_get_symbol_attribute(
|
||||
_mod: lto_module_t,
|
||||
index: ::libc::c_uint,
|
||||
) -> lto_symbol_attributes;
|
||||
/// Returns the module's linker options.
|
||||
///
|
||||
/// The linker options may consist of multiple flags. It is the linker's
|
||||
/// responsibility to split the flags using a platform-specific mechanism.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_module_get_linkeropts(_mod: lto_module_t) -> *const ::libc::c_char;
|
||||
pub fn lto_module_get_macho_cputype(
|
||||
_mod: lto_module_t,
|
||||
out_cputype: *mut ::libc::c_uint,
|
||||
out_cpusubtype: *mut ::libc::c_uint,
|
||||
) -> lto_bool_t;
|
||||
/// Return true if the module has either the `@llvm.global_ctors` or the `@llvm.global_dtors`
|
||||
/// symbol.
|
||||
///
|
||||
/// Added in API version 29 (LLVM 14).
|
||||
pub fn lto_module_has_ctor_dtor(mod_: lto_module_t) -> lto_bool_t;
|
||||
pub fn lto_codegen_set_diagnostic_handler(
|
||||
arg1: lto_code_gen_t,
|
||||
arg2: lto_diagnostic_handler_t,
|
||||
arg3: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn lto_codegen_create() -> lto_code_gen_t;
|
||||
pub fn lto_codegen_create_in_local_context() -> lto_code_gen_t;
|
||||
pub fn lto_codegen_dispose(arg1: lto_code_gen_t);
|
||||
pub fn lto_codegen_add_module(cg: lto_code_gen_t, _mod: lto_module_t) -> lto_bool_t;
|
||||
/// Sets the object module for code gneeration. This will transfer ownership
|
||||
/// of the module to the code generator.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_codegen_set_module(cg: lto_code_gen_t, _mod: lto_module_t);
|
||||
pub fn lto_codegen_set_debug_model(cg: lto_code_gen_t, arg1: lto_debug_model) -> lto_bool_t;
|
||||
pub fn lto_codegen_set_pic_model(cg: lto_code_gen_t, arg1: lto_codegen_model) -> lto_bool_t;
|
||||
pub fn lto_codegen_set_cpu(cg: lto_code_gen_t, cpu: *const ::libc::c_char);
|
||||
pub fn lto_codegen_set_assembler_path(cg: lto_code_gen_t, path: *const ::libc::c_char);
|
||||
pub fn lto_codegen_set_assembler_args(
|
||||
cg: lto_code_gen_t,
|
||||
args: *mut *const ::libc::c_char,
|
||||
nargs: ::libc::c_int,
|
||||
);
|
||||
pub fn lto_codegen_add_must_preserve_symbol(cg: lto_code_gen_t, symbol: *const ::libc::c_char);
|
||||
pub fn lto_codegen_write_merged_modules(
|
||||
cg: lto_code_gen_t,
|
||||
path: *const ::libc::c_char,
|
||||
) -> lto_bool_t;
|
||||
pub fn lto_codegen_compile(
|
||||
cg: lto_code_gen_t,
|
||||
length: *mut ::libc::size_t,
|
||||
) -> *const ::libc::c_void;
|
||||
pub fn lto_codegen_compile_to_file(
|
||||
cg: lto_code_gen_t,
|
||||
name: *mut *const ::libc::c_char,
|
||||
) -> lto_bool_t;
|
||||
/// Runs optimization for the merged module.
|
||||
///
|
||||
/// Returns true on error.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_codegen_optimize(cg: lto_code_gen_t) -> lto_bool_t;
|
||||
/// Generates code for the optimized merged module into one native object file.
|
||||
///
|
||||
/// Does not run IR optimizations on the merged module.
|
||||
///
|
||||
/// Returns a pointer to the generated mach-o/ELF buffer with length
|
||||
/// set to the buffer size. This buffer is owned by `cg` and will be
|
||||
/// freed when `lto_codegen_dispose` is called or `lto_codegen_compile_optimized`
|
||||
/// is called again. Returns null on failure.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_codegen_compile_optimized(
|
||||
cg: lto_code_gen_t,
|
||||
length: *mut ::libc::size_t,
|
||||
) -> *mut ::libc::c_void;
|
||||
/// Returns the runtime API version.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_api_version() -> ::libc::c_uint;
|
||||
pub fn lto_set_debug_options(options: *mut *const ::libc::c_char, number: ::libc::c_int);
|
||||
pub fn lto_codegen_debug_options(cg: lto_code_gen_t, arg1: *const ::libc::c_char);
|
||||
pub fn lto_codegen_debug_options_array(
|
||||
cg: lto_code_gen_t,
|
||||
arg2: *const *const ::libc::c_char,
|
||||
number: ::libc::c_int,
|
||||
);
|
||||
pub fn lto_initialize_disassembler();
|
||||
/// Sets if we should run the internalize pass during optimization and code generation.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_codegen_set_should_internalize(cg: lto_code_gen_t, ShouldInternalize: lto_bool_t);
|
||||
/// Set whether to embed uselists in bitcode.
|
||||
///
|
||||
/// Sets whether `lto_codegen_write_merged_modules` should embed uselists in
|
||||
/// output bitcode. This should be turned on for all -save-temps output.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn lto_codegen_set_should_embed_uselists(
|
||||
cg: lto_code_gen_t,
|
||||
ShouldEmbedUselists: lto_bool_t,
|
||||
);
|
||||
}
|
||||
|
||||
/// Type to wrap a single object returned by ThinLTO.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct LTOObjectBuffer {
|
||||
Buffer: *const ::libc::c_char,
|
||||
Size: ::libc::size_t,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// Instantiates a ThinLTO code generator.
|
||||
///
|
||||
/// Returns null on error (check `lto_get_error_message` for details).
|
||||
///
|
||||
/// The code generator should not be reused.
|
||||
pub fn thinlto_create_codegen() -> thinlto_code_gen_t;
|
||||
/// Frees a code generator.
|
||||
pub fn thinlto_codegen_dispose(cg: thinlto_code_gen_t);
|
||||
/// Add a module to a code generator.
|
||||
///
|
||||
/// Identifier must be unique among all the modules in the code generator.
|
||||
/// The data buffer remains owned by the client, and must live at least
|
||||
/// as long as the code generator.
|
||||
///
|
||||
/// Returns null on failure.
|
||||
pub fn thinlto_codegen_add_module(
|
||||
cg: thinlto_code_gen_t,
|
||||
identifier: *const ::libc::c_char,
|
||||
data: *const ::libc::c_char,
|
||||
length: ::libc::c_int,
|
||||
);
|
||||
/// Optimize and codegen all modules attached to the code generator.
|
||||
///
|
||||
/// Resulting objects are accessible with `thinlto_module_get_object`.
|
||||
pub fn thinlto_codegen_process(cg: thinlto_code_gen_t);
|
||||
/// Return the number of object files produced by the code generator.
|
||||
///
|
||||
/// This usually matches the number of input files, but is not guaranteed
|
||||
/// to.
|
||||
pub fn thinlto_module_get_num_objects(cg: thinlto_code_gen_t) -> ::libc::c_int;
|
||||
/// Return a reference to the `index`th object file produced by the
|
||||
/// code generator.
|
||||
pub fn thinlto_module_get_object(
|
||||
cg: thinlto_code_gen_t,
|
||||
index: ::libc::c_uint,
|
||||
) -> LTOObjectBuffer;
|
||||
/// Return the number of object files produced by the code generator.
|
||||
///
|
||||
/// Usually the same as the number of input files, but not guaranteed.
|
||||
pub fn thinlto_module_get_num_object_files(cg: thinlto_code_gen_t) -> ::libc::c_uint;
|
||||
/// Return the path to the ith output object file.
|
||||
///
|
||||
/// Use `thinlto_module_get_num_object_files` to get the number of available objects.
|
||||
pub fn thinlto_module_get_object_file(
|
||||
cg: thinlto_code_gen_t,
|
||||
index: ::libc::c_uint,
|
||||
) -> *const ::libc::c_char;
|
||||
/// Set which PIC code model to generate.
|
||||
///
|
||||
/// Returns true on error.
|
||||
pub fn thinlto_codegen_set_pic_model(
|
||||
cg: thinlto_code_gen_t,
|
||||
model: lto_codegen_model,
|
||||
) -> lto_bool_t;
|
||||
|
||||
// ThinLTO cache control.
|
||||
// Set the path to a directory to use as cache for increment build.
|
||||
//
|
||||
// Setting this activates caching.
|
||||
pub fn thinlto_codegen_set_cache_dir(cg: thinlto_code_gen_t, cache_dir: *const ::libc::c_char);
|
||||
/// Set the cache pruning interval, in seconds.
|
||||
///
|
||||
/// A negative value disables pruning, and 0 will force pruning to occur.
|
||||
pub fn thinlto_codegen_set_cache_pruning_interval(
|
||||
cg: thinlto_code_gen_t,
|
||||
interval: ::libc::c_int,
|
||||
);
|
||||
/// Set the maximum cache size to persist across builds.
|
||||
///
|
||||
/// This is expressed as a percentage of available disk space. 100 means no limit,
|
||||
/// and 50 means no more than half of the available disk space. 0 is ignored, and
|
||||
/// values over 100 will be reduced to 100.
|
||||
pub fn thinlto_codegen_set_final_cache_size_relative_to_available_space(
|
||||
cg: thinlto_code_gen_t,
|
||||
percentage: ::libc::c_uint,
|
||||
);
|
||||
/// Set the expiration (in seconds) for cache entries.
|
||||
pub fn thinlto_codegen_set_cache_entry_expiration(
|
||||
cg: thinlto_code_gen_t,
|
||||
expiration: ::libc::c_uint,
|
||||
);
|
||||
/// Set the maximum size of the cache directory (in bytes). A value over the
|
||||
/// amount of available space on the disk will be reduced to the amount of
|
||||
/// available space. An unspecified default value will be applied. A value of 0
|
||||
/// will be ignored.
|
||||
pub fn thinlto_codegen_set_cache_size_bytes(
|
||||
cg: thinlto_code_gen_t,
|
||||
max_size_bytes: ::libc::c_uint,
|
||||
);
|
||||
/// Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in
|
||||
/// megabytes (2^20 bytes).
|
||||
pub fn thinlto_codegen_set_cache_size_megabytes(
|
||||
cg: thinlto_code_gen_t,
|
||||
max_size_megabytes: ::libc::c_uint,
|
||||
);
|
||||
/// Sets the maximum number of files in the cache directory. An unspecified default value will be applied. A value of 0 will be ignored.
|
||||
pub fn thinlto_codegen_set_cache_size_files(
|
||||
cg: thinlto_code_gen_t,
|
||||
max_size_files: ::libc::c_uint,
|
||||
);
|
||||
|
||||
/// Create an LTO input file from a buffer.
|
||||
pub fn lto_input_create(
|
||||
buffer: *const ::libc::c_void,
|
||||
buffer_size: ::libc::size_t,
|
||||
path: *const ::libc::c_char,
|
||||
) -> lto_input_t;
|
||||
/// Free all memory allocated by the input file.
|
||||
pub fn lto_input_dispose(input: lto_input_t);
|
||||
/// Get the number of dependent library specifiers for the given input.
|
||||
pub fn lto_input_get_num_dependent_libraries(input: lto_input_t) -> ::libc::c_uint;
|
||||
/// Get the `i`th dependent library specifier for the given input file.
|
||||
///
|
||||
/// The returned string is not null-terminated.
|
||||
pub fn lto_input_get_dependent_library(
|
||||
input: lto_input_t,
|
||||
index: ::libc::size_t,
|
||||
size: *mut ::libc::size_t,
|
||||
) -> *const ::libc::c_char;
|
||||
/// Return the list of libcall symbols that can be generated by LTO
|
||||
/// that might not be visible from the symbol table of bitcode files.
|
||||
pub fn lto_runtime_lib_symbols_list(size: *mut usize) -> *const *const ::libc::c_char;
|
||||
|
||||
/// Set the path to a directory to use as temporary bitcode storage.
|
||||
///
|
||||
/// This is meant to make the bitcode files available for debugging.
|
||||
pub fn thinlto_codegen_set_savetemps_dir(
|
||||
cg: thinlto_code_gen_t,
|
||||
save_temps_dir: *const ::libc::c_char,
|
||||
);
|
||||
/// Set the path to a directory to save generated object files.
|
||||
///
|
||||
/// Set this to request on-disk rather than in-memory buffers. When set, use
|
||||
/// `thinlto_module_get_object_file` instead of `thinlto_module_get_object`.
|
||||
pub fn thinlto_set_generated_objects_dir(
|
||||
cg: thinlto_code_gen_t,
|
||||
save_temps_dir: *const ::libc::c_char,
|
||||
);
|
||||
/// Set the CPU to generate code for.
|
||||
pub fn thinlto_codegen_set_cpu(cg: thinlto_code_gen_t, cpu: *const ::libc::c_char);
|
||||
/// Disable code generation (running all stages until codegen).
|
||||
///
|
||||
/// The output with codegen disabled is bitcode.
|
||||
pub fn thinlto_codegen_disable_codegen(cg: thinlto_code_gen_t, disable: lto_bool_t);
|
||||
/// Perform codegen only; disable all other stages.
|
||||
pub fn thinlto_codegen_set_codegen_only(cg: thinlto_code_gen_t, codegen_only: lto_bool_t);
|
||||
/// Parse -mllvm style debug options.
|
||||
pub fn thinlto_debug_options(options: *const *const ::libc::c_char, number: ::libc::c_int);
|
||||
/// Test if a module has ThinLTO linking support.
|
||||
pub fn lto_module_is_thinlto(module: lto_module_t) -> lto_bool_t;
|
||||
/// Add a symbol to the list of global symbols that must exist in the
|
||||
/// final generated code.
|
||||
///
|
||||
/// Functions not listed may be inlined in every usage and optimized away.
|
||||
pub fn thinlto_codegen_add_must_preserve_symbol(
|
||||
cg: thinlto_code_gen_t,
|
||||
name: *const ::libc::c_char,
|
||||
length: ::libc::c_int,
|
||||
);
|
||||
/// Add a symbol to the list of global symbols that are cross-referenced
|
||||
/// between ThinLTO files.
|
||||
///
|
||||
/// Symbols listed can be discarded if every reference from a ThinLTO module
|
||||
/// to a symbol is optimized away, then the symbol can be discarded.
|
||||
pub fn thinlto_codegen_add_cross_referenced_symbol(
|
||||
cg: thinlto_code_gen_t,
|
||||
name: *const ::libc::c_char,
|
||||
length: ::libc::c_int,
|
||||
);
|
||||
}
|
164
ext/llvm-sys.rs/src/object.rs
vendored
164
ext/llvm-sys.rs/src/object.rs
vendored
@ -1,164 +0,0 @@
|
||||
//! Object file reading and writing
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueSectionIterator {}
|
||||
|
||||
pub type LLVMSectionIteratorRef = *mut LLVMOpaqueSectionIterator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueSymbolIterator {}
|
||||
|
||||
pub type LLVMSymbolIteratorRef = *mut LLVMOpaqueSymbolIterator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueRelocationIterator {}
|
||||
|
||||
pub type LLVMRelocationIteratorRef = *mut LLVMOpaqueRelocationIterator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueBinary {}
|
||||
|
||||
pub type LLVMBinaryRef = *mut LLVMOpaqueBinary;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMBinaryType {
|
||||
/// Archive file
|
||||
LLVMBinaryTypeArchive,
|
||||
/// Mach-O Universal Binary file
|
||||
LLVMBinaryTypeMachOUniversalBinary,
|
||||
/// COFF Import file
|
||||
LLVMBinaryTypeCOFFImportFile,
|
||||
/// LLVM IR
|
||||
LLVMBinaryTypeIR,
|
||||
/// Windows resource (.res) file
|
||||
LLVMBinaryTypeWinRes,
|
||||
/// COFF Object file
|
||||
LLVMBinaryTypeCOFF,
|
||||
/// ELF 32-bit, little endian
|
||||
LLVMBinaryTypeELF32L,
|
||||
/// ELF 32-bit, big endian
|
||||
LLVMBinaryTypeELF32B,
|
||||
/// ELF 64-bit, little endian
|
||||
LLVMBinaryTypeELF64L,
|
||||
/// ELF 64-bit, big endian
|
||||
LLVMBinaryTypeELF64B,
|
||||
/// MachO 32-bit, little endian
|
||||
LLVMBinaryTypeMachO32L,
|
||||
/// MachO 32-bit, big endian
|
||||
LLVMBinaryTypeMachO32B,
|
||||
/// MachO 64-bit, little endian
|
||||
LLVMBinaryTypeMachO64L,
|
||||
/// MachO 64-bit, big endian
|
||||
LLVMBinaryTypeMachO64B,
|
||||
/// Web assembly
|
||||
LLVMBinaryTypeWasm,
|
||||
/// Offloading fatbinary
|
||||
LLVMBinaryTypeOffload,
|
||||
}
|
||||
|
||||
#[deprecated(since = "LLVM 9.0")]
|
||||
pub enum LLVMOpaqueObjectFile {}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(since = "LLVM 9.0")]
|
||||
pub type LLVMObjectFileRef = *mut LLVMOpaqueObjectFile;
|
||||
|
||||
extern "C" {
|
||||
/// Create a binary file from the given memory buffer.
|
||||
pub fn LLVMCreateBinary(
|
||||
MemBuf: LLVMMemoryBufferRef,
|
||||
Context: LLVMContextRef,
|
||||
ErrorMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBinaryRef;
|
||||
/// Dispose of a binary file
|
||||
pub fn LLVMDisposeBinary(BR: LLVMBinaryRef);
|
||||
|
||||
pub fn LLVMBinaryCopyMemoryBuffer(BR: LLVMBinaryRef) -> LLVMMemoryBufferRef;
|
||||
pub fn LLVMBinaryGetType(BR: LLVMBinaryRef) -> LLVMBinaryType;
|
||||
pub fn LLVMMachOUniversalBinaryCopyObjectForArch(
|
||||
BR: LLVMBinaryRef,
|
||||
Arch: *const ::libc::c_char,
|
||||
ArchLen: ::libc::size_t,
|
||||
ErrorMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBinaryRef;
|
||||
|
||||
pub fn LLVMObjectFileCopySectionIterator(BR: LLVMBinaryRef) -> LLVMSectionIteratorRef;
|
||||
pub fn LLVMObjectFileIsSectionIteratorAtEnd(
|
||||
BR: LLVMBinaryRef,
|
||||
SI: LLVMSectionIteratorRef,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMObjectFileCopySymbolIterator(BR: LLVMBinaryRef) -> LLVMSymbolIteratorRef;
|
||||
pub fn LLVMObjectFileIsSymbolIteratorAtEnd(
|
||||
BR: LLVMBinaryRef,
|
||||
SI: LLVMSymbolIteratorRef,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMDisposeSectionIterator(SI: LLVMSectionIteratorRef);
|
||||
|
||||
pub fn LLVMMoveToNextSection(SI: LLVMSectionIteratorRef);
|
||||
pub fn LLVMMoveToContainingSection(Sect: LLVMSectionIteratorRef, Sym: LLVMSymbolIteratorRef);
|
||||
pub fn LLVMDisposeSymbolIterator(SI: LLVMSymbolIteratorRef);
|
||||
pub fn LLVMMoveToNextSymbol(SI: LLVMSymbolIteratorRef);
|
||||
pub fn LLVMGetSectionName(SI: LLVMSectionIteratorRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMGetSectionSize(SI: LLVMSectionIteratorRef) -> u64;
|
||||
pub fn LLVMGetSectionContents(SI: LLVMSectionIteratorRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMGetSectionAddress(SI: LLVMSectionIteratorRef) -> u64;
|
||||
pub fn LLVMGetSectionContainsSymbol(
|
||||
SI: LLVMSectionIteratorRef,
|
||||
Sym: LLVMSymbolIteratorRef,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMGetRelocations(Section: LLVMSectionIteratorRef) -> LLVMRelocationIteratorRef;
|
||||
pub fn LLVMDisposeRelocationIterator(RI: LLVMRelocationIteratorRef);
|
||||
pub fn LLVMIsRelocationIteratorAtEnd(
|
||||
Section: LLVMSectionIteratorRef,
|
||||
RI: LLVMRelocationIteratorRef,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMMoveToNextRelocation(RI: LLVMRelocationIteratorRef);
|
||||
pub fn LLVMGetSymbolName(SI: LLVMSymbolIteratorRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMGetSymbolAddress(SI: LLVMSymbolIteratorRef) -> u64;
|
||||
pub fn LLVMGetSymbolSize(SI: LLVMSymbolIteratorRef) -> u64;
|
||||
pub fn LLVMGetRelocationOffset(RI: LLVMRelocationIteratorRef) -> u64;
|
||||
pub fn LLVMGetRelocationSymbol(RI: LLVMRelocationIteratorRef) -> LLVMSymbolIteratorRef;
|
||||
pub fn LLVMGetRelocationType(RI: LLVMRelocationIteratorRef) -> u64;
|
||||
pub fn LLVMGetRelocationTypeName(RI: LLVMRelocationIteratorRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMGetRelocationValueString(RI: LLVMRelocationIteratorRef) -> *const ::libc::c_char;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(since = "LLVM 9.0", note = "Use LLVMCreateBinary instead")]
|
||||
pub fn LLVMCreateObjectFile(MemBuf: LLVMMemoryBufferRef) -> LLVMObjectFileRef;
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(since = "LLVM 9.0", note = "Use LLVMDisposeBinary instead")]
|
||||
pub fn LLVMDisposeObjectFile(ObjectFile: LLVMObjectFileRef);
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(
|
||||
since = "LLVM 9.0",
|
||||
note = "Use LLVMObjectFileCopySectionIterator instead"
|
||||
)]
|
||||
pub fn LLVMGetSections(ObjectFile: LLVMObjectFileRef) -> LLVMSectionIteratorRef;
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(
|
||||
since = "LLVM 9.0",
|
||||
note = "Use LLVMObjectFileIsSectionIteratorAtEnd instead"
|
||||
)]
|
||||
pub fn LLVMIsSectionIteratorAtEnd(
|
||||
ObjectFile: LLVMObjectFileRef,
|
||||
SI: LLVMSectionIteratorRef,
|
||||
) -> LLVMBool;
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(
|
||||
since = "LLVM 9.0",
|
||||
note = "Use LLVMObjectFileCopySymbolIterator instead"
|
||||
)]
|
||||
pub fn LLVMGetSymbols(ObjectFile: LLVMObjectFileRef) -> LLVMSymbolIteratorRef;
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(
|
||||
since = "LLVM 9.0",
|
||||
note = "Use LLVMObjectFileIsSymbolIteratorAtEnd instead"
|
||||
)]
|
||||
pub fn LLVMIsSymbolIteratorAtEnd(
|
||||
ObjectFile: LLVMObjectFileRef,
|
||||
SI: LLVMSymbolIteratorRef,
|
||||
) -> LLVMBool;
|
||||
}
|
11
ext/llvm-sys.rs/src/orc2/ee.rs
vendored
11
ext/llvm-sys.rs/src/orc2/ee.rs
vendored
@ -1,11 +0,0 @@
|
||||
use super::*;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
) -> LLVMOrcObjectLayerRef;
|
||||
pub fn LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(
|
||||
RTDyldObjLinkingLayer: LLVMOrcObjectLayerRef,
|
||||
Listener: LLVMJITEventListenerRef,
|
||||
);
|
||||
}
|
74
ext/llvm-sys.rs/src/orc2/lljit.rs
vendored
74
ext/llvm-sys.rs/src/orc2/lljit.rs
vendored
@ -1,74 +0,0 @@
|
||||
use super::*;
|
||||
use error::LLVMErrorRef;
|
||||
use prelude::*;
|
||||
|
||||
pub type LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction =
|
||||
extern "C" fn(
|
||||
Ctx: *mut ::libc::c_void,
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
Triple: *const ::libc::c_char,
|
||||
) -> LLVMOrcObjectLayerRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueLLJITBuilder {}
|
||||
pub type LLVMOrcLLJITBuilderRef = *mut LLVMOrcOpaqueLLJITBuilder;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueLLJIT {}
|
||||
pub type LLVMOrcLLJITRef = *mut LLVMOrcOpaqueLLJIT;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMOrcCreateLLJITBuilder() -> LLVMOrcLLJITBuilderRef;
|
||||
pub fn LLVMOrcDisposeLLJITBuilder(Builder: LLVMOrcLLJITBuilderRef);
|
||||
pub fn LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(
|
||||
Builder: LLVMOrcLLJITBuilderRef,
|
||||
JTMB: LLVMOrcJITTargetMachineBuilderRef,
|
||||
);
|
||||
pub fn LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(
|
||||
Builder: LLVMOrcLLJITBuilderRef,
|
||||
F: LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMOrcCreateLLJIT(
|
||||
Result: *mut LLVMOrcLLJITRef,
|
||||
Builder: LLVMOrcLLJITBuilderRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcDisposeLLJIT(J: LLVMOrcLLJITRef) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITGetExecutionSession(J: LLVMOrcLLJITRef) -> LLVMOrcExecutionSessionRef;
|
||||
pub fn LLVMOrcLLJITGetMainJITDylib(J: LLVMOrcLLJITRef) -> LLVMOrcJITDylibRef;
|
||||
pub fn LLVMOrcLLJITGetTripleString(J: LLVMOrcLLJITRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMOrcLLJITGetGlobalPrefix(J: LLVMOrcLLJITRef) -> ::libc::c_char;
|
||||
pub fn LLVMOrcLLJITMangleAndIntern(
|
||||
J: LLVMOrcLLJITRef,
|
||||
UnmangledName: *const ::libc::c_char,
|
||||
) -> LLVMOrcSymbolStringPoolEntryRef;
|
||||
pub fn LLVMOrcLLJITAddObjectFile(
|
||||
J: LLVMOrcLLJITRef,
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
ObjBuffer: LLVMMemoryBufferRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITAddObjectFileWithRT(
|
||||
J: LLVMOrcLLJITRef,
|
||||
RT: LLVMOrcResourceTrackerRef,
|
||||
ObjBuffer: LLVMMemoryBufferRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITAddLLVMIRModule(
|
||||
J: LLVMOrcLLJITRef,
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
TSM: LLVMOrcThreadSafeModuleRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITAddLLVMIRModuleWithRT(
|
||||
J: LLVMOrcLLJITRef,
|
||||
JD: LLVMOrcResourceTrackerRef,
|
||||
TSM: LLVMOrcThreadSafeModuleRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITLookup(
|
||||
J: LLVMOrcLLJITRef,
|
||||
Result: *mut LLVMOrcExecutorAddress,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcLLJITGetObjLinkingLayer(J: LLVMOrcLLJITRef) -> LLVMOrcObjectLayerRef;
|
||||
pub fn LLVMOrcLLJITGetObjTransformLayer(J: LLVMOrcLLJITRef) -> LLVMOrcObjectTransformLayerRef;
|
||||
pub fn LLVMOrcLLJITGetIRTransformLayer(J: LLVMOrcLLJITRef) -> LLVMOrcIRTransformLayerRef;
|
||||
pub fn LLVMOrcLLJITGetDataLayoutStr(J: LLVMOrcLLJITRef) -> *const ::libc::c_char;
|
||||
}
|
539
ext/llvm-sys.rs/src/orc2/mod.rs
vendored
539
ext/llvm-sys.rs/src/orc2/mod.rs
vendored
@ -1,539 +0,0 @@
|
||||
#![allow(non_snake_case)]
|
||||
//! OrcV2
|
||||
|
||||
pub mod ee;
|
||||
pub mod lljit;
|
||||
|
||||
use error::LLVMErrorRef;
|
||||
use prelude::*;
|
||||
use target_machine::LLVMTargetMachineRef;
|
||||
|
||||
/// Represents an address in the executor process.
|
||||
pub type LLVMOrcJITTargetAddress = u64;
|
||||
|
||||
/// Represents an address in the executor process
|
||||
pub type LLVMOrcExecutorAddress = u64;
|
||||
|
||||
/// Generic linkage flags for a symbol definition.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMJITSymbolGenericFlags {
|
||||
LLVMJITSymbolGenericFlagsNone = 0,
|
||||
LLVMJITSymbolGenericFlagsExported = 1,
|
||||
LLVMJITSymbolGenericFlagsWeak = 2,
|
||||
LLVMJITSymbolGenericFlagsCallable = 4,
|
||||
LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly = 8,
|
||||
}
|
||||
|
||||
/// Target specific flags for a symbol definition.
|
||||
pub type LLVMJITSymbolTargetFlags = u8;
|
||||
|
||||
/// Linkage flags for a symbol definition.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMJITSymbolFlags {
|
||||
pub GenericFlags: u8,
|
||||
pub TargetFlags: u8,
|
||||
}
|
||||
|
||||
/// An evaluated symbol address and flags.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMJITEvaluatedSymbol {
|
||||
pub Address: LLVMOrcExecutorAddress,
|
||||
pub Flags: LLVMJITSymbolFlags,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueExecutionSession {}
|
||||
pub type LLVMOrcExecutionSessionRef = *mut LLVMOrcOpaqueExecutionSession;
|
||||
|
||||
/// Error reporter function.
|
||||
pub type LLVMOrcErrorReporterFunction = extern "C" fn(Ctx: *mut ::libc::c_void, Err: LLVMErrorRef);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueSymbolStringPool {}
|
||||
/// A reference to an orc::SymbolStringPool.
|
||||
pub type LLVMOrcSymbolStringPoolRef = *mut LLVMOrcOpaqueSymbolStringPool;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueSymbolStringPoolEntry {}
|
||||
pub type LLVMOrcSymbolStringPoolEntryRef = *mut LLVMOrcOpaqueSymbolStringPoolEntry;
|
||||
|
||||
/// A pair of a symbol name and LLVMJITSymbolFlags.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCSymbolFlagsMapPair {
|
||||
pub Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub Flags: LLVMJITSymbolFlags,
|
||||
}
|
||||
|
||||
pub type LLVMOrcCSymbolFlagsMapPairs = *mut LLVMOrcCSymbolFlagsMapPair;
|
||||
|
||||
/// A pair of a symbol name and an evaluated symbol.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCSymbolMapPair {
|
||||
pub Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub Sym: LLVMJITEvaluatedSymbol,
|
||||
}
|
||||
|
||||
/// A list of (SymbolStringPtr, JITEvaluatedSymbol) pairs that can be
|
||||
/// used to construct a SymbolMap.
|
||||
pub type LLVMOrcCSymbolMapPairs = *mut LLVMOrcCSymbolMapPair;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCSymbolAliasMapEntry {
|
||||
pub Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub Flags: LLVMJITSymbolFlags,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCSymbolAliasMapPair {
|
||||
pub Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub Entry: LLVMOrcCSymbolAliasMapEntry,
|
||||
}
|
||||
|
||||
pub type LLVMOrcCSymbolAliasMapPairs = *mut LLVMOrcCSymbolAliasMapPair;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueJITDylib {}
|
||||
pub type LLVMOrcJITDylibRef = *mut LLVMOrcOpaqueJITDylib;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCSymbolsList {
|
||||
pub Symbols: *mut LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub Length: ::libc::size_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCDependenceMapPair {
|
||||
pub JD: LLVMOrcJITDylibRef,
|
||||
pub Names: LLVMOrcCSymbolsList,
|
||||
}
|
||||
|
||||
pub type LLVMOrcCDependenceMapPairs = *mut LLVMOrcCDependenceMapPair;
|
||||
|
||||
/// Lookup kind. This can be used by definition generators when deciding whether
|
||||
/// to produce a definition for a requested symbol.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMOrcLookupKind {
|
||||
LLVMOrcLookupKindStatic,
|
||||
LLVMOrcLookupKindDLSym,
|
||||
}
|
||||
|
||||
/// JITDylib lookup flags. This can be used by definition generators when
|
||||
/// deciding whether to produce a definition for a requested symbol.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMOrcJITDylibLookupFlags {
|
||||
LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly,
|
||||
LLVMOrcJITDylibLookupFlagsMatchAllSymbols,
|
||||
}
|
||||
|
||||
/// An element type for a JITDylib search order.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct LLVMOrcCJITDylibSearchOrderElement {
|
||||
pub JD: LLVMOrcJITDylibRef,
|
||||
pub JDLookupFlags: LLVMOrcJITDylibLookupFlags,
|
||||
}
|
||||
|
||||
/// A JITDylib search order.
|
||||
///
|
||||
/// The list is terminated with an element containing a null pointer for the JD
|
||||
/// field.
|
||||
pub type LLVMOrcCJITDylibSearchOrder = *mut LLVMOrcCJITDylibSearchOrderElement;
|
||||
|
||||
/// Symbol lookup flags for lookup sets.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMOrcSymbolLookupFlags {
|
||||
LLVMOrcSymbolLookupFlagsRequiredSymbol,
|
||||
LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol,
|
||||
}
|
||||
|
||||
/// An element type for a symbol lookup set.
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct LLVMOrcCLookupSetElement {
|
||||
pub Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
pub LookupFlags: LLVMOrcSymbolLookupFlags,
|
||||
}
|
||||
|
||||
/// A set of symbols to look up / generate.
|
||||
///
|
||||
/// The list is terminated with an element containing a null pointer for the
|
||||
/// Name field.
|
||||
///
|
||||
/// The creator is responsible for freeing the set and ensuring all strings
|
||||
/// are retained for the set's lifetime.
|
||||
pub type LLVMOrcCLookupSet = *mut LLVMOrcCLookupSetElement;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueMaterializationUnit {}
|
||||
pub type LLVMOrcMaterializationUnitRef = *mut LLVMOrcOpaqueMaterializationUnit;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueMaterializationResponsibility {}
|
||||
pub type LLVMOrcMaterializationResponsibilityRef = *mut LLVMOrcOpaqueMaterializationResponsibility;
|
||||
|
||||
pub type LLVMOrcMaterializationUnitMaterializeFunction =
|
||||
extern "C" fn(Ctx: *mut ::libc::c_void, MR: LLVMOrcMaterializationResponsibilityRef);
|
||||
|
||||
pub type LLVMOrcMaterializationUnitDiscardFunction = extern "C" fn(
|
||||
Ctx: *mut ::libc::c_void,
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
Symbol: LLVMOrcSymbolStringPoolEntryRef,
|
||||
);
|
||||
|
||||
pub type LLVMOrcMaterializationUnitDestroyFunction = extern "C" fn(Ctx: *mut ::libc::c_void);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueResourceTracker {}
|
||||
pub type LLVMOrcResourceTrackerRef = *mut LLVMOrcOpaqueResourceTracker;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueDefinitionGenerator {}
|
||||
pub type LLVMOrcDefinitionGeneratorRef = *mut LLVMOrcOpaqueDefinitionGenerator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueLookupState {}
|
||||
pub type LLVMOrcLookupStateRef = *mut LLVMOrcOpaqueLookupState;
|
||||
|
||||
pub type LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction = extern "C" fn(
|
||||
GeneratorObj: LLVMOrcDefinitionGeneratorRef,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
LookupState: *mut LLVMOrcLookupStateRef,
|
||||
Kind: LLVMOrcLookupKind,
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
JDLookupFlags: LLVMOrcJITDylibLookupFlags,
|
||||
LookupSet: LLVMOrcCLookupSet,
|
||||
LookupSetSize: usize,
|
||||
) -> LLVMErrorRef;
|
||||
|
||||
/// Disposer for a custom generator.
|
||||
///
|
||||
/// Will be called by ORC when the JITDylib that the generator is attached to
|
||||
/// is destroyed.
|
||||
pub type LLVMOrcDisposeCAPIDefinitionGeneratorFunction = extern "C" fn(Ctx: *mut ::libc::c_void);
|
||||
|
||||
pub type LLVMOrcSymbolPredicate = Option<
|
||||
extern "C" fn(Ctx: *mut ::libc::c_void, Sym: LLVMOrcSymbolStringPoolEntryRef) -> ::libc::c_int,
|
||||
>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueThreadSafeContext {}
|
||||
pub type LLVMOrcThreadSafeContextRef = *mut LLVMOrcOpaqueThreadSafeContext;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueThreadSafeModule {}
|
||||
pub type LLVMOrcThreadSafeModuleRef = *mut LLVMOrcOpaqueThreadSafeModule;
|
||||
|
||||
pub type LLVMOrcGenericIRModuleOperationFunction =
|
||||
extern "C" fn(Ctx: *mut ::libc::c_void, M: LLVMModuleRef) -> LLVMErrorRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueJITTargetMachineBuilder {}
|
||||
pub type LLVMOrcJITTargetMachineBuilderRef = *mut LLVMOrcOpaqueJITTargetMachineBuilder;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueObjectLayer {}
|
||||
pub type LLVMOrcObjectLayerRef = *mut LLVMOrcOpaqueObjectLayer;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueObjectLinkingLayer {}
|
||||
pub type LLVMOrcObjectLinkingLayerRef = *mut LLVMOrcOpaqueObjectLayer;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueIRTransformLayer {}
|
||||
pub type LLVMOrcIRTransformLayerRef = *mut LLVMOrcOpaqueIRTransformLayer;
|
||||
|
||||
pub type LLVMOrcIRTransformLayerTransformFunction = extern "C" fn(
|
||||
Ctx: *mut ::libc::c_void,
|
||||
ModInOut: *mut LLVMOrcThreadSafeModuleRef,
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMErrorRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueObjectTransformLayer {}
|
||||
pub type LLVMOrcObjectTransformLayerRef = *mut LLVMOrcOpaqueObjectTransformLayer;
|
||||
|
||||
pub type LLVMOrcObjectTransformLayerTransformFunction =
|
||||
extern "C" fn(Ctx: *mut ::libc::c_void, ObjInOut: *mut LLVMMemoryBufferRef) -> LLVMErrorRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueIndirectStubsManager {}
|
||||
pub type LLVMOrcIndirectStubsManagerRef = *mut LLVMOrcOpaqueIndirectStubsManager;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueLazyCallThroughManager {}
|
||||
pub type LLVMOrcLazyCallThroughManagerRef = *mut LLVMOrcOpaqueLazyCallThroughManager;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOrcOpaqueDumpObjects {}
|
||||
pub type LLVMOrcDumpObjectsRef = *mut LLVMOrcOpaqueDumpObjects;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMOrcExecutionSessionSetErrorReporter(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
ReportError: LLVMOrcErrorReporterFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMOrcExecutionSessionGetSymbolStringPool(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
) -> LLVMOrcSymbolStringPoolRef;
|
||||
pub fn LLVMOrcSymbolStringPoolClearDeadEntries(SSP: LLVMOrcSymbolStringPoolRef);
|
||||
pub fn LLVMOrcExecutionSessionIntern(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> LLVMOrcSymbolStringPoolEntryRef;
|
||||
}
|
||||
|
||||
pub type LLVMOrcExecutionSessionLookupHandleResultFunction = extern "C" fn(
|
||||
Err: LLVMErrorRef,
|
||||
Result: LLVMOrcCSymbolMapPairs,
|
||||
NumPairs: usize,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMOrcExecutionSessionLookup(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
K: LLVMOrcLookupKind,
|
||||
SearchOrder: LLVMOrcCJITDylibSearchOrder,
|
||||
SearchOrderSize: usize,
|
||||
Symbols: LLVMOrcCLookupSet,
|
||||
SymbolsSize: usize,
|
||||
HandleResult: LLVMOrcExecutionSessionLookupHandleResultFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMOrcRetainSymbolStringPoolEntry(S: LLVMOrcSymbolStringPoolEntryRef);
|
||||
pub fn LLVMOrcReleaseSymbolStringPoolEntry(S: LLVMOrcSymbolStringPoolEntryRef);
|
||||
pub fn LLVMOrcSymbolStringPoolEntryStr(
|
||||
S: LLVMOrcSymbolStringPoolEntryRef,
|
||||
) -> *const ::libc::c_char;
|
||||
pub fn LLVMOrcReleaseResourceTracker(RT: LLVMOrcResourceTrackerRef);
|
||||
pub fn LLVMOrcResourceTrackerTransferTo(
|
||||
SrcRT: LLVMOrcResourceTrackerRef,
|
||||
DstRT: LLVMOrcResourceTrackerRef,
|
||||
);
|
||||
pub fn LLVMOrcResourceTrackerRemove(RT: LLVMOrcResourceTrackerRef) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcDisposeDefinitionGenerator(DG: LLVMOrcDefinitionGeneratorRef);
|
||||
pub fn LLVMOrcDisposeMaterializationUnit(MU: LLVMOrcMaterializationUnitRef);
|
||||
pub fn LLVMOrcCreateCustomMaterializationUnit(
|
||||
Name: *const ::libc::c_char,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
Syms: LLVMOrcCSymbolFlagsMapPairs,
|
||||
NumSyms: ::libc::size_t,
|
||||
InitSym: LLVMOrcSymbolStringPoolEntryRef,
|
||||
Materialize: LLVMOrcMaterializationUnitMaterializeFunction,
|
||||
Discard: LLVMOrcMaterializationUnitDiscardFunction,
|
||||
Destroy: LLVMOrcMaterializationUnitDestroyFunction,
|
||||
) -> LLVMOrcMaterializationUnitRef;
|
||||
pub fn LLVMOrcAbsoluteSymbols(
|
||||
Syms: LLVMOrcCSymbolMapPairs,
|
||||
NumPairs: usize,
|
||||
) -> LLVMOrcMaterializationUnitRef;
|
||||
pub fn LLVMOrcLazyReexports(
|
||||
LCTM: LLVMOrcLazyCallThroughManagerRef,
|
||||
ISM: LLVMOrcIndirectStubsManagerRef,
|
||||
SourceRef: LLVMOrcJITDylibRef,
|
||||
CallableAliases: LLVMOrcCSymbolAliasMapPairs,
|
||||
NumPairs: ::libc::size_t,
|
||||
) -> LLVMOrcMaterializationUnitRef;
|
||||
pub fn LLVMOrcDisposeMaterializationResponsibility(MR: LLVMOrcMaterializationResponsibilityRef);
|
||||
pub fn LLVMOrcMaterializationResponsibilityGetTargetDylib(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMOrcJITDylibRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityGetExecutionSession(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMOrcExecutionSessionRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityGetSymbols(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
NumPairs: *mut ::libc::size_t,
|
||||
) -> LLVMOrcCSymbolFlagsMapPairs;
|
||||
pub fn LLVMOrcDisposeCSymbolFlagsMap(Pairs: LLVMOrcCSymbolFlagsMapPairs);
|
||||
pub fn LLVMOrcMaterializationResponsibilityGetInitializerSymbol(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMOrcSymbolStringPoolEntryRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityGetRequestedSymbols(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
NumSymbols: *mut ::libc::size_t,
|
||||
) -> *mut LLVMOrcSymbolStringPoolEntryRef;
|
||||
pub fn LLVMOrcDisposeSymbols(Symbols: *mut LLVMOrcSymbolStringPoolEntryRef);
|
||||
pub fn LLVMOrcMaterializationResponsibilityNotifyResolved(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
Symbols: LLVMOrcCSymbolMapPairs,
|
||||
NumPairs: ::libc::size_t,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityNotifyEmitted(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityDefineMaterializing(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
Pairs: LLVMOrcCSymbolFlagsMapPairs,
|
||||
NumPairs: ::libc::size_t,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityFailMaterialization(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
);
|
||||
pub fn LLVMOrcMaterializationResponsibilityReplace(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
MU: LLVMOrcMaterializationUnitRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityDelegate(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
Symbols: *mut LLVMOrcSymbolStringPoolEntryRef,
|
||||
NumSymbols: ::libc::size_t,
|
||||
Result: *mut LLVMOrcMaterializationResponsibilityRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcMaterializationResponsibilityAddDependencies(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
Name: LLVMOrcSymbolStringPoolEntryRef,
|
||||
Dependencies: LLVMOrcCDependenceMapPairs,
|
||||
NumPairs: ::libc::size_t,
|
||||
);
|
||||
pub fn LLVMOrcMaterializationResponsibilityAddDependenciesForAll(
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
Dependencies: LLVMOrcCDependenceMapPairs,
|
||||
NumPairs: ::libc::size_t,
|
||||
);
|
||||
pub fn LLVMOrcExecutionSessionCreateBareJITDylib(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> LLVMOrcJITDylibRef;
|
||||
pub fn LLVMOrcExecutionSessionCreateJITDylib(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
Result_: *mut LLVMOrcJITDylibRef,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcExecutionSessionGetJITDylibByName(
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
Name: *const ::libc::c_char,
|
||||
) -> LLVMOrcJITDylibRef;
|
||||
pub fn LLVMOrcJITDylibCreateResourceTracker(
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
) -> LLVMOrcResourceTrackerRef;
|
||||
pub fn LLVMOrcJITDylibGetDefaultResourceTracker(
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
) -> LLVMOrcResourceTrackerRef;
|
||||
pub fn LLVMOrcJITDylibDefine(
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
MU: LLVMOrcMaterializationUnitRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcJITDylibClear(JD: LLVMOrcJITDylibRef) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcJITDylibAddGenerator(JD: LLVMOrcJITDylibRef, DG: LLVMOrcDefinitionGeneratorRef);
|
||||
pub fn LLVMOrcCreateCustomCAPIDefinitionGenerator(
|
||||
F: LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
Dispose: LLVMOrcDisposeCAPIDefinitionGeneratorFunction,
|
||||
) -> LLVMOrcDefinitionGeneratorRef;
|
||||
pub fn LLVMOrcLookupStateContinueLookup(
|
||||
S: LLVMOrcLookupStateRef,
|
||||
Err: LLVMErrorRef,
|
||||
);
|
||||
pub fn LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
|
||||
Result: *mut LLVMOrcDefinitionGeneratorRef,
|
||||
GlobalPrefix: ::libc::c_char,
|
||||
Filter: LLVMOrcSymbolPredicate,
|
||||
FilterCtx: *mut ::libc::c_void,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(
|
||||
Result: *mut LLVMOrcDefinitionGeneratorRef,
|
||||
FileName: *const ::libc::c_char,
|
||||
GlobalPrefix: ::libc::c_char,
|
||||
Filter: LLVMOrcSymbolPredicate,
|
||||
FilterCtx: *mut ::libc::c_void,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcCreateStaticLibrarySearchGeneratorForPath(
|
||||
Result: *mut LLVMOrcDefinitionGeneratorRef,
|
||||
ObjLayer: LLVMOrcObjectLayerRef,
|
||||
FileName: *const ::libc::c_char,
|
||||
TargetTriple: *const ::libc::c_char,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcCreateNewThreadSafeContext() -> LLVMOrcThreadSafeContextRef;
|
||||
pub fn LLVMOrcThreadSafeContextGetContext(TSCtx: LLVMOrcThreadSafeContextRef)
|
||||
-> LLVMContextRef;
|
||||
pub fn LLVMOrcDisposeThreadSafeContext(TSCtx: LLVMOrcThreadSafeContextRef);
|
||||
pub fn LLVMOrcCreateNewThreadSafeModule(
|
||||
M: LLVMModuleRef,
|
||||
TSCtx: LLVMOrcThreadSafeContextRef,
|
||||
) -> LLVMOrcThreadSafeModuleRef;
|
||||
pub fn LLVMOrcDisposeThreadSafeModule(TSM: LLVMOrcThreadSafeModuleRef);
|
||||
pub fn LLVMOrcThreadSafeModuleWithModuleDo(
|
||||
TSM: LLVMOrcThreadSafeModuleRef,
|
||||
F: LLVMOrcGenericIRModuleOperationFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcJITTargetMachineBuilderDetectHost(
|
||||
Result: *mut LLVMOrcJITTargetMachineBuilderRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(
|
||||
TM: LLVMTargetMachineRef,
|
||||
) -> LLVMOrcJITTargetMachineBuilderRef;
|
||||
pub fn LLVMOrcDisposeJITTargetMachineBuilder(JTMB: LLVMOrcJITTargetMachineBuilderRef);
|
||||
pub fn LLVMOrcJITTargetMachineBuilderGetTargetTriple(
|
||||
JTMB: LLVMOrcJITTargetMachineBuilderRef,
|
||||
) -> *mut ::libc::c_char;
|
||||
pub fn LLVMOrcJITTargetMachineBuilderSetTargetTriple(
|
||||
JTMB: LLVMOrcJITTargetMachineBuilderRef,
|
||||
TargetTriple: *const ::libc::c_char,
|
||||
);
|
||||
pub fn LLVMOrcObjectLayerAddObjectFile(
|
||||
ObjLayer: LLVMOrcObjectLayerRef,
|
||||
JD: LLVMOrcJITDylibRef,
|
||||
ObjBuffer: LLVMMemoryBufferRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcObjectLayerAddObjectFileWithRT(
|
||||
ObjLayer: LLVMOrcObjectLayerRef,
|
||||
RT: LLVMOrcResourceTrackerRef,
|
||||
ObjBuffer: LLVMMemoryBufferRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcObjectLayerEmit(
|
||||
ObjLayer: LLVMOrcObjectLayerRef,
|
||||
R: LLVMOrcMaterializationResponsibilityRef,
|
||||
ObjBuffer: LLVMMemoryBufferRef,
|
||||
);
|
||||
pub fn LLVMOrcDisposeObjectLayer(ObjLayer: LLVMOrcObjectLayerRef);
|
||||
pub fn LLVMOrcIRTransformLayerEmit(
|
||||
IRTransformLayer: LLVMOrcIRTransformLayerRef,
|
||||
MR: LLVMOrcMaterializationResponsibilityRef,
|
||||
TSM: LLVMOrcThreadSafeModuleRef,
|
||||
);
|
||||
pub fn LLVMOrcIRTransformLayerSetTransform(
|
||||
IRTransformLayer: LLVMOrcIRTransformLayerRef,
|
||||
TransformFunction: LLVMOrcIRTransformLayerTransformFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMOrcObjectTransformLayerSetTransform(
|
||||
ObjTransformLayer: LLVMOrcObjectTransformLayerRef,
|
||||
TransformFunction: LLVMOrcObjectTransformLayerTransformFunction,
|
||||
Ctx: *mut ::libc::c_void,
|
||||
);
|
||||
pub fn LLVMOrcCreateLocalIndirectStubsManager(
|
||||
TargetTriple: *const ::libc::c_char,
|
||||
) -> LLVMOrcIndirectStubsManagerRef;
|
||||
pub fn LLVMOrcDisposeIndirectStubsManager(ISM: LLVMOrcIndirectStubsManagerRef);
|
||||
pub fn LLVMOrcCreateLocalLazyCallThroughManager(
|
||||
TargetTriple: *const ::libc::c_char,
|
||||
ES: LLVMOrcExecutionSessionRef,
|
||||
ErrorHandlerAddr: LLVMOrcJITTargetAddress,
|
||||
LCTM: *mut LLVMOrcLazyCallThroughManagerRef,
|
||||
) -> LLVMErrorRef;
|
||||
pub fn LLVMOrcDisposeLazyCallThroughManager(LCTM: LLVMOrcLazyCallThroughManagerRef);
|
||||
pub fn LLVMOrcCreateDumpObjects(
|
||||
DumpDir: *const ::libc::c_char,
|
||||
IdentifierOverride: *const ::libc::c_char,
|
||||
) -> LLVMOrcDumpObjectsRef;
|
||||
pub fn LLVMOrcDisposeDumpObjects(DumpObjects: LLVMOrcDumpObjectsRef);
|
||||
pub fn LLVMOrcDumpObjects_CallOperator(
|
||||
DumpObjects: LLVMOrcDumpObjectsRef,
|
||||
ObjBuffer: *mut LLVMMemoryBufferRef,
|
||||
) -> LLVMErrorRef;
|
||||
}
|
134
ext/llvm-sys.rs/src/remarks.rs
vendored
134
ext/llvm-sys.rs/src/remarks.rs
vendored
@ -1,134 +0,0 @@
|
||||
//! Remark diagnostics library.
|
||||
use prelude::LLVMBool;
|
||||
|
||||
#[repr(C)]
|
||||
pub enum LLVMRemarkType {
|
||||
LLVMRemarkTypeUnknown,
|
||||
LLVMRemarkTypePassed,
|
||||
LLVMRemarkTypeMissed,
|
||||
LLVMRemarkTypeAnalysis,
|
||||
LLVMRemarkTypeAnalysisFPCommute,
|
||||
LLVMRemarkTypeAnalysisAliasing,
|
||||
LLVMRemarkTypeFailure,
|
||||
}
|
||||
|
||||
pub enum LLVMRemarkOpaqueString {}
|
||||
|
||||
/// String containing a buffer and a length. The buffer is not guaranteed to be zero-terminated.
|
||||
pub type LLVMRemarkStringRef = *mut LLVMRemarkOpaqueString;
|
||||
|
||||
extern "C" {
|
||||
/// Returns the buffer holding the string.
|
||||
pub fn LLVMRemarkStringGetData(String: LLVMRemarkStringRef) -> *const ::libc::c_char;
|
||||
|
||||
/// Returns the size of the string.
|
||||
pub fn LLVMRemarkStringGetLen(String: LLVMRemarkStringRef) -> u32;
|
||||
}
|
||||
|
||||
pub enum LLVMRemarkOpaqueDebugLoc {}
|
||||
|
||||
/// DebugLoc containing File, Line and Column.
|
||||
pub type LLVMRemarkDebugLocRef = *mut LLVMRemarkOpaqueDebugLoc;
|
||||
|
||||
extern "C" {
|
||||
/// Return the path to the source file for a debug location.
|
||||
pub fn LLVMRemarkDebugLocGetSourceFilePath(DL: LLVMRemarkDebugLocRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Return the line in the source file for a debug location.
|
||||
pub fn LLVMRemarkDebugLocGetSourceLine(DL: LLVMRemarkDebugLocRef) -> u32;
|
||||
|
||||
/// Return the column in the source file for a debug location.
|
||||
pub fn LLVMRemarkDebugLocGetSourceColumn(DL: LLVMRemarkDebugLocRef) -> u32;
|
||||
}
|
||||
|
||||
pub enum LLVMRemarkOpaqueArg {}
|
||||
|
||||
/// Element of the "Args" list. The key might give more information about what
|
||||
/// the semantics of the value are, e.g. "Callee" will tell you that the value
|
||||
/// is a symbol that names a function.
|
||||
pub type LLVMRemarkArgRef = *mut LLVMRemarkOpaqueArg;
|
||||
|
||||
extern "C" {
|
||||
/// Returns the key of an argument. The key defines what the value is, and the
|
||||
/// same key can appear multiple times in the list of arguments.
|
||||
pub fn LLVMRemarkArgGetKey(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Returns the value of an argument. This is a string that can contain newlines.
|
||||
pub fn LLVMRemarkArgGetValue(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Returns the debug location that is attached to the value of this argument.
|
||||
pub fn LLVMRemarkArgGetDebugLoc(Arg: LLVMRemarkArgRef) -> LLVMRemarkDebugLocRef;
|
||||
}
|
||||
|
||||
pub enum LLVMRemarkOpaqueEntry {}
|
||||
/// A remark emitted by the compiler.
|
||||
pub type LLVMRemarkEntryRef = *mut LLVMRemarkOpaqueEntry;
|
||||
|
||||
extern "C" {
|
||||
/// Free the resources used by the remark entry.
|
||||
pub fn LLVMRemarkEntryDispose(Remark: LLVMRemarkEntryRef);
|
||||
|
||||
/// The type of the remark. For example, it can allow users to only keep the
|
||||
/// missed optimizations from the compiler.
|
||||
pub fn LLVMRemarkEntryGetType(Remark: LLVMRemarkEntryRef) -> LLVMRemarkType;
|
||||
|
||||
/// Get the name of the pass that emitted this remark.
|
||||
pub fn LLVMRemarkEntryGetPassName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Get an identifier of the remark.
|
||||
pub fn LLVMRemarkEntryGetRemarkName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Get the name of the function being processed when the remark was emitted.
|
||||
pub fn LLVMRemarkEntryGetFunctionName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
|
||||
|
||||
/// Returns the debug location that is attached to this remark.
|
||||
pub fn LLVMRemarkEntryGetDebugLoc(Remark: LLVMRemarkEntryRef) -> LLVMRemarkDebugLocRef;
|
||||
|
||||
/// Return the hotness of the remark.
|
||||
pub fn LLVMRemarkEntryGetHotness(Remark: LLVMRemarkEntryRef) -> u64;
|
||||
|
||||
/// The number of arguments the remark holds.
|
||||
pub fn LLVMRemarkEntryGetNumArgs(Remark: LLVMRemarkEntryRef) -> u32;
|
||||
|
||||
/// Get a new iterator to iterate over a remark's argument.
|
||||
pub fn LLVMRemarkEntryGetFirstArg(Remark: LLVMRemarkEntryRef) -> LLVMRemarkArgRef;
|
||||
|
||||
/// Get the next argument in Remark from the position of It.
|
||||
pub fn LLVMRemarkEntryGetNextArg(
|
||||
It: LLVMRemarkArgRef,
|
||||
Remark: LLVMRemarkEntryRef,
|
||||
) -> LLVMRemarkArgRef;
|
||||
}
|
||||
|
||||
pub enum LLVMRemarkOpaqueParser {}
|
||||
pub type LLVMRemarkParserRef = *mut LLVMRemarkOpaqueParser;
|
||||
|
||||
extern "C" {
|
||||
/// Creates a remark parser that can be used to parse the buffer located in
|
||||
/// Buf of size Size bytes.
|
||||
pub fn LLVMRemarkParserCreateYAML(Buf: *const ::libc::c_void, Size: u64)
|
||||
-> LLVMRemarkParserRef;
|
||||
|
||||
pub fn LLVMRemarkParserCreateBitstream(
|
||||
Buf: *const ::libc::c_void,
|
||||
Size: u64,
|
||||
) -> LLVMRemarkParserRef;
|
||||
|
||||
/// Returns the next remark in the file.
|
||||
pub fn LLVMRemarkParserGetNext(Parser: LLVMRemarkParserRef) -> LLVMRemarkEntryRef;
|
||||
|
||||
/// Returns `1` if the parser encountered an error while parsing the buffer.
|
||||
pub fn LLVMRemarkParserHasError(Parser: LLVMRemarkParserRef) -> LLVMBool;
|
||||
|
||||
/// Returns a null-terminated string containing an error message.
|
||||
pub fn LLVMRemarkParserGetErrorMessage(Parser: LLVMRemarkParserRef) -> *const ::libc::c_char;
|
||||
|
||||
pub fn LLVMRemarkParserDispose(Parser: LLVMRemarkParserRef);
|
||||
}
|
||||
|
||||
pub const REMARKS_API_VERSION: u32 = 1;
|
||||
|
||||
extern "C" {
|
||||
/// Returns the version of the remarks library.
|
||||
pub fn LLVMRemarkVersion() -> u32;
|
||||
}
|
22
ext/llvm-sys.rs/src/support.rs
vendored
22
ext/llvm-sys.rs/src/support.rs
vendored
@ -1,22 +0,0 @@
|
||||
use super::prelude::*;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMLoadLibraryPermanently(Filename: *const ::libc::c_char) -> LLVMBool;
|
||||
pub fn LLVMParseCommandLineOptions(
|
||||
argc: ::libc::c_int,
|
||||
argv: *const *const ::libc::c_char,
|
||||
Overview: *const ::libc::c_char,
|
||||
);
|
||||
/// Search all previously loaded dynamic libraries for the named symbol.
|
||||
///
|
||||
/// Returns its address if found, otherwise null.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn LLVMSearchForAddressOfSymbol(symbolName: *const ::libc::c_char) -> *mut ::libc::c_void;
|
||||
/// Permanently add the named symbol with the provided value.
|
||||
///
|
||||
/// Symbols added this way are searched before any libraries.
|
||||
///
|
||||
/// Added in LLVM 3.7.
|
||||
pub fn LLVMAddSymbol(symbolName: *const ::libc::c_char, symbolValue: *mut ::libc::c_void);
|
||||
}
|
195
ext/llvm-sys.rs/src/target.rs
vendored
195
ext/llvm-sys.rs/src/target.rs
vendored
@ -1,195 +0,0 @@
|
||||
//! Target information
|
||||
|
||||
use super::prelude::*;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMByteOrdering {
|
||||
LLVMBigEndian = 0,
|
||||
LLVMLittleEndian = 1,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueTargetData {}
|
||||
|
||||
pub type LLVMTargetDataRef = *mut LLVMOpaqueTargetData;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueTargetLibraryInfotData {}
|
||||
|
||||
pub type LLVMTargetLibraryInfoRef = *mut LLVMOpaqueTargetLibraryInfotData;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMInitializeAMDGPUTargetInfo();
|
||||
pub fn LLVMInitializeAMDGPUTarget();
|
||||
pub fn LLVMInitializeAMDGPUTargetMC();
|
||||
pub fn LLVMInitializeAMDGPUAsmPrinter();
|
||||
pub fn LLVMInitializeAMDGPUAsmParser();
|
||||
// Disassembler?
|
||||
|
||||
pub fn LLVMInitializeSystemZTargetInfo();
|
||||
pub fn LLVMInitializeSystemZTarget();
|
||||
pub fn LLVMInitializeSystemZTargetMC();
|
||||
pub fn LLVMInitializeSystemZAsmPrinter();
|
||||
pub fn LLVMInitializeSystemZAsmParser();
|
||||
pub fn LLVMInitializeSystemZDisassembler();
|
||||
|
||||
pub fn LLVMInitializeHexagonTargetInfo();
|
||||
pub fn LLVMInitializeHexagonTarget();
|
||||
pub fn LLVMInitializeHexagonTargetMC();
|
||||
pub fn LLVMInitializeHexagonAsmPrinter();
|
||||
// AsmParser?
|
||||
pub fn LLVMInitializeHexagonDisassembler();
|
||||
|
||||
pub fn LLVMInitializeNVPTXTargetInfo();
|
||||
pub fn LLVMInitializeNVPTXTarget();
|
||||
pub fn LLVMInitializeNVPTXTargetMC();
|
||||
pub fn LLVMInitializeNVPTXAsmPrinter();
|
||||
// AsmParser?
|
||||
|
||||
pub fn LLVMInitializeMSP430TargetInfo();
|
||||
pub fn LLVMInitializeMSP430Target();
|
||||
pub fn LLVMInitializeMSP430TargetMC();
|
||||
pub fn LLVMInitializeMSP430AsmPrinter();
|
||||
// AsmParser?
|
||||
|
||||
pub fn LLVMInitializeXCoreTargetInfo();
|
||||
pub fn LLVMInitializeXCoreTarget();
|
||||
pub fn LLVMInitializeXCoreTargetMC();
|
||||
pub fn LLVMInitializeXCoreAsmPrinter();
|
||||
// AsmParser?
|
||||
pub fn LLVMInitializeXCoreDisassembler();
|
||||
|
||||
pub fn LLVMInitializeMipsTargetInfo();
|
||||
pub fn LLVMInitializeMipsTarget();
|
||||
pub fn LLVMInitializeMipsTargetMC();
|
||||
pub fn LLVMInitializeMipsAsmPrinter();
|
||||
pub fn LLVMInitializeMipsAsmParser();
|
||||
pub fn LLVMInitializeMipsDisassembler();
|
||||
|
||||
pub fn LLVMInitializeAArch64TargetInfo();
|
||||
pub fn LLVMInitializeAArch64Target();
|
||||
pub fn LLVMInitializeAArch64TargetMC();
|
||||
pub fn LLVMInitializeAArch64AsmPrinter();
|
||||
pub fn LLVMInitializeAArch64AsmParser();
|
||||
pub fn LLVMInitializeAArch64Disassembler();
|
||||
|
||||
pub fn LLVMInitializeARMTargetInfo();
|
||||
pub fn LLVMInitializeARMTarget();
|
||||
pub fn LLVMInitializeARMTargetMC();
|
||||
pub fn LLVMInitializeARMAsmPrinter();
|
||||
pub fn LLVMInitializeARMAsmParser();
|
||||
pub fn LLVMInitializeARMDisassembler();
|
||||
|
||||
pub fn LLVMInitializePowerPCTargetInfo();
|
||||
pub fn LLVMInitializePowerPCTarget();
|
||||
pub fn LLVMInitializePowerPCTargetMC();
|
||||
pub fn LLVMInitializePowerPCAsmPrinter();
|
||||
pub fn LLVMInitializePowerPCAsmParser();
|
||||
pub fn LLVMInitializePowerPCDisassembler();
|
||||
|
||||
pub fn LLVMInitializeSparcTargetInfo();
|
||||
pub fn LLVMInitializeSparcTarget();
|
||||
pub fn LLVMInitializeSparcTargetMC();
|
||||
pub fn LLVMInitializeSparcAsmPrinter();
|
||||
pub fn LLVMInitializeSparcAsmParser();
|
||||
pub fn LLVMInitializeSparcDisassembler();
|
||||
|
||||
pub fn LLVMInitializeX86TargetInfo();
|
||||
pub fn LLVMInitializeX86Target();
|
||||
pub fn LLVMInitializeX86TargetMC();
|
||||
pub fn LLVMInitializeX86AsmPrinter();
|
||||
pub fn LLVMInitializeX86AsmParser();
|
||||
pub fn LLVMInitializeX86Disassembler();
|
||||
|
||||
pub fn LLVMInitializeBPFTargetInfo();
|
||||
pub fn LLVMInitializeBPFTarget();
|
||||
pub fn LLVMInitializeBPFTargetMC();
|
||||
pub fn LLVMInitializeBPFAsmPrinter();
|
||||
// No AsmParser
|
||||
pub fn LLVMInitializeBPFDisassembler();
|
||||
|
||||
pub fn LLVMInitializeLanaiTargetInfo();
|
||||
pub fn LLVMInitializeLanaiTarget();
|
||||
pub fn LLVMInitializeLanaiTargetMC();
|
||||
pub fn LLVMInitializeLanaiAsmPrinter();
|
||||
pub fn LLVMInitializeLanaiAsmParser();
|
||||
pub fn LLVMInitializeLanaiDisassembler();
|
||||
|
||||
pub fn LLVMInitializeRISCVTargetInfo();
|
||||
pub fn LLVMInitializeRISCVTarget();
|
||||
pub fn LLVMInitializeRISCVTargetMC();
|
||||
pub fn LLVMInitializeRISCVAsmPrinter();
|
||||
pub fn LLVMInitializeRISCVAsmParser();
|
||||
pub fn LLVMInitializeRISCVDisassembler();
|
||||
|
||||
pub fn LLVMInitializeWebAssemblyTargetInfo();
|
||||
pub fn LLVMInitializeWebAssemblyTarget();
|
||||
pub fn LLVMInitializeWebAssemblyTargetMC();
|
||||
pub fn LLVMInitializeWebAssemblyAsmPrinter();
|
||||
pub fn LLVMInitializeWebAssemblyAsmParser();
|
||||
pub fn LLVMInitializeWebAssemblyDisassembler();
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/// Get the data layout for a module.
|
||||
pub fn LLVMGetModuleDataLayout(M: LLVMModuleRef) -> LLVMTargetDataRef;
|
||||
/// Set the data layout for a module.
|
||||
pub fn LLVMSetModuleDataLayout(M: LLVMModuleRef, R: LLVMTargetDataRef);
|
||||
/// Create target data from a target layout string.
|
||||
pub fn LLVMCreateTargetData(StringRep: *const ::libc::c_char) -> LLVMTargetDataRef;
|
||||
pub fn LLVMAddTargetLibraryInfo(TLI: LLVMTargetLibraryInfoRef, PM: LLVMPassManagerRef);
|
||||
pub fn LLVMCopyStringRepOfTargetData(TD: LLVMTargetDataRef) -> *mut ::libc::c_char;
|
||||
pub fn LLVMByteOrder(TD: LLVMTargetDataRef) -> LLVMByteOrdering;
|
||||
pub fn LLVMPointerSize(TD: LLVMTargetDataRef) -> ::libc::c_uint;
|
||||
pub fn LLVMPointerSizeForAS(TD: LLVMTargetDataRef, AS: ::libc::c_uint) -> ::libc::c_uint;
|
||||
//pub fn LLVMIntPtrType(TD: LLVMTargetDataRef) -> LLVMTypeRef;
|
||||
//pub fn LLVMIntPtrTypeForAS(TD: LLVMTargetDataRef, AS: ::libc::c_uint) -> LLVMTypeRef;
|
||||
pub fn LLVMIntPtrTypeInContext(C: LLVMContextRef, TD: LLVMTargetDataRef) -> LLVMTypeRef;
|
||||
pub fn LLVMIntPtrTypeForASInContext(
|
||||
C: LLVMContextRef,
|
||||
TD: LLVMTargetDataRef,
|
||||
AS: ::libc::c_uint,
|
||||
) -> LLVMTypeRef;
|
||||
pub fn LLVMSizeOfTypeInBits(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_ulonglong;
|
||||
pub fn LLVMStoreSizeOfType(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_ulonglong;
|
||||
pub fn LLVMABISizeOfType(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_ulonglong;
|
||||
pub fn LLVMABIAlignmentOfType(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_uint;
|
||||
pub fn LLVMCallFrameAlignmentOfType(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_uint;
|
||||
pub fn LLVMPreferredAlignmentOfType(TD: LLVMTargetDataRef, Ty: LLVMTypeRef) -> ::libc::c_uint;
|
||||
pub fn LLVMPreferredAlignmentOfGlobal(
|
||||
TD: LLVMTargetDataRef,
|
||||
GlobalVar: LLVMValueRef,
|
||||
) -> ::libc::c_uint;
|
||||
pub fn LLVMElementAtOffset(
|
||||
TD: LLVMTargetDataRef,
|
||||
StructTy: LLVMTypeRef,
|
||||
Offset: ::libc::c_ulonglong,
|
||||
) -> ::libc::c_uint;
|
||||
pub fn LLVMOffsetOfElement(
|
||||
TD: LLVMTargetDataRef,
|
||||
StructTy: LLVMTypeRef,
|
||||
Element: ::libc::c_uint,
|
||||
) -> ::libc::c_ulonglong;
|
||||
pub fn LLVMDisposeTargetData(TD: LLVMTargetDataRef);
|
||||
}
|
||||
|
||||
// Functions from our target wrappers, since the C interface defines them with
|
||||
// macros (wrappers/target.c).
|
||||
extern "C" {
|
||||
pub fn LLVM_InitializeAllTargetInfos();
|
||||
pub fn LLVM_InitializeAllTargets();
|
||||
pub fn LLVM_InitializeAllTargetMCs();
|
||||
pub fn LLVM_InitializeAllAsmPrinters();
|
||||
pub fn LLVM_InitializeAllAsmParsers();
|
||||
pub fn LLVM_InitializeAllDisassemblers();
|
||||
|
||||
/// Returns 1 on failure.
|
||||
pub fn LLVM_InitializeNativeTarget() -> LLVMBool;
|
||||
/// Returns 1 on failure.
|
||||
pub fn LLVM_InitializeNativeAsmParser() -> LLVMBool;
|
||||
/// Returns 1 on failure.
|
||||
pub fn LLVM_InitializeNativeAsmPrinter() -> LLVMBool;
|
||||
/// Returns 1 on failure.
|
||||
pub fn LLVM_InitializeNativeDisassembler() -> LLVMBool;
|
||||
}
|
111
ext/llvm-sys.rs/src/target_machine.rs
vendored
111
ext/llvm-sys.rs/src/target_machine.rs
vendored
@ -1,111 +0,0 @@
|
||||
//! Target machine information, to generate assembly or object files.
|
||||
|
||||
use super::prelude::*;
|
||||
use super::target::LLVMTargetDataRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMOpaqueTargetMachine {}
|
||||
|
||||
pub type LLVMTargetMachineRef = *mut LLVMOpaqueTargetMachine;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LLVMTarget {}
|
||||
|
||||
pub type LLVMTargetRef = *mut LLVMTarget;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMCodeGenOptLevel {
|
||||
LLVMCodeGenLevelNone = 0,
|
||||
LLVMCodeGenLevelLess = 1,
|
||||
LLVMCodeGenLevelDefault = 2,
|
||||
LLVMCodeGenLevelAggressive = 3,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMRelocMode {
|
||||
LLVMRelocDefault = 0,
|
||||
LLVMRelocStatic = 1,
|
||||
LLVMRelocPIC = 2,
|
||||
LLVMRelocDynamicNoPic = 3,
|
||||
LLVMRelocROPI = 4,
|
||||
LLVMRelocRWPI = 5,
|
||||
LLVMRelocROPI_RWPI = 6,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMCodeModel {
|
||||
LLVMCodeModelDefault = 0,
|
||||
LLVMCodeModelJITDefault = 1,
|
||||
LLVMCodeModelTiny = 2,
|
||||
LLVMCodeModelSmall = 3,
|
||||
LLVMCodeModelKernel = 4,
|
||||
LLVMCodeModelMedium = 5,
|
||||
LLVMCodeModelLarge = 6,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum LLVMCodeGenFileType {
|
||||
LLVMAssemblyFile = 0,
|
||||
LLVMObjectFile = 1,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMGetFirstTarget() -> LLVMTargetRef;
|
||||
pub fn LLVMGetNextTarget(T: LLVMTargetRef) -> LLVMTargetRef;
|
||||
pub fn LLVMGetTargetFromName(Name: *const ::libc::c_char) -> LLVMTargetRef;
|
||||
pub fn LLVMGetTargetFromTriple(
|
||||
Triple: *const ::libc::c_char,
|
||||
T: *mut LLVMTargetRef,
|
||||
ErrorMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMGetTargetName(T: LLVMTargetRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMGetTargetDescription(T: LLVMTargetRef) -> *const ::libc::c_char;
|
||||
pub fn LLVMTargetHasJIT(T: LLVMTargetRef) -> LLVMBool;
|
||||
pub fn LLVMTargetHasTargetMachine(T: LLVMTargetRef) -> LLVMBool;
|
||||
pub fn LLVMTargetHasAsmBackend(T: LLVMTargetRef) -> LLVMBool;
|
||||
pub fn LLVMCreateTargetMachine(
|
||||
T: LLVMTargetRef,
|
||||
Triple: *const ::libc::c_char,
|
||||
CPU: *const ::libc::c_char,
|
||||
Features: *const ::libc::c_char,
|
||||
Level: LLVMCodeGenOptLevel,
|
||||
Reloc: LLVMRelocMode,
|
||||
CodeModel: LLVMCodeModel,
|
||||
) -> LLVMTargetMachineRef;
|
||||
pub fn LLVMDisposeTargetMachine(T: LLVMTargetMachineRef);
|
||||
pub fn LLVMGetTargetMachineTarget(T: LLVMTargetMachineRef) -> LLVMTargetRef;
|
||||
pub fn LLVMGetTargetMachineTriple(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
|
||||
pub fn LLVMGetTargetMachineCPU(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
|
||||
pub fn LLVMGetTargetMachineFeatureString(T: LLVMTargetMachineRef) -> *mut ::libc::c_char;
|
||||
/// Create a DataLayout based on the target machine.
|
||||
pub fn LLVMCreateTargetDataLayout(T: LLVMTargetMachineRef) -> LLVMTargetDataRef;
|
||||
pub fn LLVMSetTargetMachineAsmVerbosity(T: LLVMTargetMachineRef, VerboseAsm: LLVMBool);
|
||||
pub fn LLVMTargetMachineEmitToFile(
|
||||
T: LLVMTargetMachineRef,
|
||||
M: LLVMModuleRef,
|
||||
Filename: *mut ::libc::c_char,
|
||||
codegen: LLVMCodeGenFileType,
|
||||
ErrorMessage: *mut *mut ::libc::c_char,
|
||||
) -> LLVMBool;
|
||||
pub fn LLVMTargetMachineEmitToMemoryBuffer(
|
||||
T: LLVMTargetMachineRef,
|
||||
M: LLVMModuleRef,
|
||||
codegen: LLVMCodeGenFileType,
|
||||
ErrorMessage: *mut *mut ::libc::c_char,
|
||||
OutMemBuf: *mut LLVMMemoryBufferRef,
|
||||
) -> LLVMBool;
|
||||
|
||||
pub fn LLVMGetDefaultTargetTriple() -> *mut ::libc::c_char;
|
||||
/// Normalize a target triple. The result needs to be disposed with LLVMDisposeMessage.
|
||||
pub fn LLVMNormalizeTargetTriple(triple: *const ::libc::c_char) -> *mut ::libc::c_char;
|
||||
/// Get the host CPU as a string. The result needs to be disposed with LLVMDisposeMessage.
|
||||
pub fn LLVMGetHostCPUName() -> *mut ::libc::c_char;
|
||||
/// Get the host CPU's features as a string. The result needs to be disposed with LLVMDisposeMessage.
|
||||
pub fn LLVMGetHostCPUFeatures() -> *mut ::libc::c_char;
|
||||
|
||||
pub fn LLVMAddAnalysisPasses(T: LLVMTargetMachineRef, PM: LLVMPassManagerRef);
|
||||
}
|
8
ext/llvm-sys.rs/src/transforms.rs
vendored
8
ext/llvm-sys.rs/src/transforms.rs
vendored
@ -1,8 +0,0 @@
|
||||
use super::*;
|
||||
|
||||
// Util
|
||||
extern "C" {
|
||||
pub fn LLVMAddLowerSwitchPass(PM: LLVMPassManagerRef );
|
||||
|
||||
pub fn LLVMAddPromoteMemoryToRegisterPass(PM: LLVMPassManagerRef );
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
use prelude::*;
|
||||
|
||||
extern "C" {
|
||||
pub fn LLVMAddAggressiveInstCombinerPass(PM: LLVMPassManagerRef);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user