Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Squircel #3465

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
92 changes: 0 additions & 92 deletions .devcontainer/Dockerfile

This file was deleted.

94 changes: 94 additions & 0 deletions .devcontainer/default/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG TARGETARCH
ARG UBUNTU_VERSION_NAME=jammy

ENV LC_ALL C

# Update apt and install common tools
RUN DEBIAN_FRONTEND="noninteractive" \
apt-get update && \
apt-get install -y \
ccache \
curl \
git \
jq \
ninja-build \
rsync

# Install the correct version of CMake (the version from apt-get installs GCC, the presence of which sometimes confuses LLVM's build). Release URLS can be found at https://github.com/Kitware/CMake/releases
ARG CMAKE_VERSION=3.26.4
ADD https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-aarch64.sh /root/install-cmake-arm64.sh
ADD https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh /root/install-cmake-amd64.sh
RUN chmod +x /root/install-cmake-$TARGETARCH.sh && \
/root/install-cmake-$TARGETARCH.sh --prefix=/usr/ --exclude-subdir --skip-license && \
rm /root/install-cmake-*.sh

# Install clang
ARG CLANG_VERSION=16
ADD https://apt.llvm.org/llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key
RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y software-properties-common gnupg && \
apt-key add /root/llvm-snapshot.gpg.key && \
apt-add-repository "deb http://apt.llvm.org/$UBUNTU_VERSION_NAME/ llvm-toolchain-$UBUNTU_VERSION_NAME-$CLANG_VERSION main" && \
apt update && \
apt install -y \
clang-$CLANG_VERSION \
clangd-$CLANG_VERSION \
lldb-$CLANG_VERSION \
clang-tools-$CLANG_VERSION

# Use installed clang with CMake
COPY cmake-tools-kits.json /root/.local/share/CMakeTools/cmake-tools-kits.json

# Install Java (GraalVM)
# This downloads all relevant GraalVM architectures at once, mostly because $TARGETARCH values don't map exactly to the release URLs. Since we're optimizing for developer experience here and not image size, this is OK
# GraalVM release links can be found here: https://github.com/graalvm/graalvm-ce-builds/releases
ARG JAVA_VERSION=java11
ADD https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-$JAVA_VERSION-linux-aarch64-22.3.1.tar.gz /graalvm/tarballs/arm64.tar.gz
ADD https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-$JAVA_VERSION-linux-amd64-22.3.1.tar.gz /graalvm/tarballs/amd64.tar.gz
RUN tar -xzf /graalvm/tarballs/$TARGETARCH.tar.gz -C /graalvm --strip-components=1 && \
rm -rf /graalvm/tarballs
ENV JAVA_HOME=/graalvm \
PATH=/graalvm/bin/:$PATH

# Install SBT
# Effectively `curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup` from https://www.scala-lang.org/download/
ADD https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-pc-linux.gz /scala/coursier-install-arm64.gz
ADD https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz /scala/coursier-install-amd64.gz
RUN cd /scala && \
cat coursier-install-$TARGETARCH.gz | gzip -d > cs && \
chmod +x cs && \
yes | ./cs setup && \
rm /scala/coursier-install-*.gz

# Install Swift Nightly Toolchain
ARG SWIFT_SNAPSHOT=DEVELOPMENT-SNAPSHOT-2023-07-23-a
ADD https://swift.org/keys/all-keys.asc /swift/all-keys.asc
ADD https://download.swift.org/development/ubuntu2204-aarch64/swift-$SWIFT_SNAPSHOT/swift-$SWIFT_SNAPSHOT-ubuntu22.04-aarch64.tar.gz /swift/toolchain-arm64.tar.gz
ADD https://download.swift.org/development/ubuntu2204/swift-$SWIFT_SNAPSHOT/swift-$SWIFT_SNAPSHOT-ubuntu22.04.tar.gz /swift/toolchain-amd64.tar.gz
RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y \
binutils \
git \
gnupg2 \
libc6-dev \
libcurl4-openssl-dev \
libedit2 \
libgcc-9-dev \
libpython3.8 \
libsqlite3-0 \
libstdc++-9-dev \
libxml2-dev \
libz3-dev \
pkg-config \
tzdata \
unzip \
zlib1g-dev && \
cd /swift && \
tar xzf toolchain-$TARGETARCH.tar.gz --strip-components=1 && \
rm toolchain-*.tar.gz
ENV PATH="$PATH:/swift/usr/bin"

ENV EDITOR="code --wait" \
GIT_EDITOR="code --wait"
69 changes: 69 additions & 0 deletions .devcontainer/default/VSCode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Note: There are some additional constraints on workspace settings because of how we test the configuration is valid. See `.devcontainer/extract-cmake-arguments.sh` for details
{
// CMake Settings
"cmake.useProjectStatusView": true,
"cmake.sourceDirectory": "${workspaceFolder}/mlir/llvm/llvm",
"cmake.buildDirectory": "${workspaceFolder}/build/circel",
"cmake.installPrefix": "/usr/local",
"cmake.configureOnOpen": false,
"cmake.configureOnEdit": false,
"cmake.generator": "Ninja",
"cmake.configureArgs": [
// -- CMAKE
"-DCMAKE_WARN_DEPRECATED=OFF",
"-DCMAKE_C_COMPILER_LAUNCHER=ccache",
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
// -- LLVM
"-DLLVM_ENABLE_ASSERTIONS=ON",
"-DLLVM_ENABLE_PROJECTS=mlir",
"-DLLVM_TARGETS_TO_BUILD=",
"-DLLVM_BUILD_EXAMPLES=OFF",
"-DLLVM_ENABLE_OCAMLDOC=OFF",
"-DLLVM_ENABLE_BINDINGS=OFF",
"-DLLVM_ENABLE_MODULES=OFF",
// -- LLVM (performance)
// LLVM_OPTIMIZED_TABLEGEN is not compatible with disabling LLHD
"-DLLVM_OPTIMIZED_TABLEGEN=OFF",
"-DLLVM_USE_SPLIT_DWARF=ON",
"-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF",
"-DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF",
// -- CIRCT
"-DLLVM_EXTERNAL_PROJECTS=circt;circel",
"-DLLVM_EXTERNAL_CIRCT_SOURCE_DIR=${workspaceFolder}/mlir/circt",
"-DLLVM_EXTERNAL_CIRCEL_SOURCE_DIR=${workspaceFolder}/mlir/circel",
// LLHD requires a LLVM_TARGET be built
"-DCIRCT_LLHD_SIM_ENABLED=OFF"
],
// Clangd Settings
"clangd.path": "clangd-16",
"clangd.checkUpdates": false,
"clangd.onConfigChanged": "restart",
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/build/circel"
],
// MLIR
"mlir.server_path": "/usr/local/bin/circt-lsp-server",
"mlir.onSettingsChanged": "restart",
// Java
"files.watcherExclude": {
"**/target": true
},
"remote.autoForwardPorts": false, // Metals opens some ports in the remote container that we don't need to forward to the host
// Workspace Settings
"files.exclude": {
// Other Editors
".vim": true,
// Scala
".metals": true,
// Exclude all llvm projects except for llvm and mlir (this is a bit convoluted because VSCode doesn't support negated glob patterns)
"circt/llvm/[^lm]*": true,
"circt/llvm/l[^l]*": true,
"circt/llvm/ll[^v]*": true,
"circt/llvm/llvm-*": true,
// Exclude some CIRCT noise
"circt/.*": true
},
"search.exclude": {
"build": true
}
}
20 changes: 20 additions & 0 deletions .devcontainer/default/VSCode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "Build Circel",
"command": "build",
"targets": [
"CircelJNINative",
"check-circel"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "Default Circel Build Task"
}
]
}
9 changes: 9 additions & 0 deletions .devcontainer/default/cmake-tools-kits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "Clang 16",
"compilers": {
"C": "/usr/bin/clang-16",
"CXX": "/usr/bin/clang++-16"
}
}
]
31 changes: 31 additions & 0 deletions .devcontainer/default/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Circel",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"mounts": [
/// VSCode settings in Docker need to be different from the host machine
"source=${localWorkspaceFolder}/.devcontainer/default/VSCode,target=${containerWorkspaceFolder}/.vscode,type=bind",
/// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance?WT.mc_id=javascript-14373-yolasors#_use-a-targeted-named-volume)
"source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/build,type=volume",
/// Use a named volume to share the ccache database. We use a simple name so that different devcontainers which build llvm could all share the same ccache database. Also share the configuration folder so configuration settings persist.
"source=shared-llvm-ccache-database,target=/root/.cache/ccache,type=volume",
"source=shared-llvm-ccache-config,target=/root/.config/ccache,type=volume"
],
"containerEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"llvm-vs-code-extensions.vscode-clangd",
"llvm-vs-code-extensions.vscode-mlir",
"ms-vscode.cmake-tools",
"scalameta.metals"
]
}
}
}
15 changes: 0 additions & 15 deletions .devcontainer/devcontainer.json

This file was deleted.

19 changes: 19 additions & 0 deletions .devcontainer/make-devcontainer-singular
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

PROJECT_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )

DEVCONTAINER_NAME=$1
if [ -z "$DEVCONTAINER_NAME" ]; then
echo <<- EOF
Usage: $0 <devcontainer-name>

The devcontainer/ci GitHub action does not support named devcontainers (i.e. ones located in subfolders of .devcontainer), so this script makes the selected devcontainer the singular devcontainer in the repo.
EOF
exit 1
fi

mv .devcontainer .actual-devcontainer
cp -R .actual-devcontainer/$DEVCONTAINER_NAME .devcontainer

# Copy the devcontainer back to its original location so bind mounts (like .vscode) resolve properly
cp -R .actual-devcontainer/$DEVCONTAINER_NAME .devcontainer/$DEVCONTAINER_NAME
23 changes: 23 additions & 0 deletions .github/workflows/check-circel-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Formatting

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
formatting-cpp:
name: Check Formatting (C++)
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Format C++ code
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: 16
check-path: mlir/circel
fallback-style: llvm

Loading