Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ releases may include breaking changes.

## [Unreleased]

### Added

- ⚡ Select native assertion-free SDKs with `assertions: false`, Bash `-a OFF`,
or PowerShell `-no_assertions`, while preserving assertion-enabled defaults
and the manifest format used by older actions ([#255]) ([**@burgholzer**])

### Removed

- 🍎 Drop support for x86 macOS ([#257]) ([**@denialhaag**])
Expand Down Expand Up @@ -153,6 +159,7 @@ _This is the initial release of the `setup-mlir` project._
[#256]: https://github.com/munich-quantum-software/setup-mlir/pull/256
[#230]: https://github.com/munich-quantum-software/setup-mlir/pull/230
[#229]: https://github.com/munich-quantum-software/setup-mlir/pull/229
[#255]: https://github.com/munich-quantum-software/setup-mlir/pull/255
[#196]: https://github.com/munich-quantum-software/setup-mlir/pull/196
[#191]: https://github.com/munich-quantum-software/setup-mlir/pull/191
[#190]: https://github.com/munich-quantum-software/setup-mlir/pull/190
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ On Windows, use the following PowerShell command:
```powershell
powershell -ExecutionPolicy ByPass -c "& ([scriptblock]::Create((irm https://github.com/munich-quantum-software/setup-mlir/releases/latest/download/setup-mlir.ps1))) -llvm_version 22.1.0 -install_prefix /path/to/installation"
```

## Assertion-free release SDKs

Set `assertions: false` to select the native assertion-free SDK:

```yaml
- uses: munich-quantum-software/setup-mlir@v1
with:
llvm-version: 23.1.1
assertions: false
```

The standalone installers accept `-a OFF` in Bash and `-no_assertions` in
PowerShell. Defaults retain assertions. The `_noassert.tar.zst` companion
archive must exist in the same release; installation fails if it is unavailable.
Tool-cache directories separate the two variants. Use headers and libraries from
the same variant because LLVM's assertion mode affects its ABI checks.

These SDKs contain native object code with portable CPU targets. They do not
require the producer's exact compiler version. Consumers must still satisfy
LLVM's compiler requirements and the SDK's deployment and C++ ABI constraints.
The version manifest retains one default archive per platform so older pinned
actions continue to work.
14 changes: 14 additions & 0 deletions __tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const mockSetFailed = jest.fn<(message: string) => void>();

const mockCore = {
getInput: mockGetInput,
getBooleanInput: jest.fn(() => true),
debug: mockDebug,
isDebug: mockIsDebug,
addPath: mockAddPath,
Expand Down Expand Up @@ -181,6 +182,19 @@ describe("setup-mlir Integration Tests", () => {
}
});

it("should select the assertion-free companion without changing the default", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");
const ordinary = await getMLIRUrl(testVersion, "linux", "X86");
const optimized = await getMLIRUrl(testVersion, "linux", "X86", false);
expect(ordinary.name).not.toContain("_noassert");
expect(optimized.name).toBe(
ordinary.name.replace(/\.tar\.zst$/, "_noassert.tar.zst"),
);
expect(optimized.url).toBe(
ordinary.url.replace(/\.tar\.zst$/, "_noassert.tar.zst"),
);
});

it("should fall back to remote manifest when local file is missing", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");
const readFileSpy = jest
Expand Down
3 changes: 3 additions & 0 deletions __tests__/update-known-versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ describe("Update Known Versions", () => {
"zstd-1.5.7_x86_64-pc-windows-msvc.tar.gz",
"zstd-1.5.7_aarch64-pc-windows-msvc.tar.gz",
...names,
...names.map((name) =>
name.replace(/\.tar\.zst$/, "_noassert.tar.zst"),
),
].map((name) => ({
name,
browser_download_url: `https://example.com/${name}`,
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ inputs:
description: "The architecture to install the MLIR toolchain for (either X86, AArch64, or host). macOS requires AArch64. Defaults to host."
required: false
default: "host"
assertions:
description: "Whether to retain LLVM assertions. Set false for an assertion-free Release SDK."
required: false
default: "true"

runs:
using: node24
Expand Down
15 changes: 9 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35095,7 +35095,7 @@ async function getManifestEntry(version, platform, architecture, forceRemote = f
entry.platform === platform &&
entry.architecture === architecture &&
entry.asset_name.endsWith(".tar.zst") &&
!entry.asset_name.includes("_debug"));
!/_(?:debug|noassert)/.test(entry.asset_name));
if (entries.length === 0 && !forceRemote) {
core_debug(`No local manifest entries found for LLVM ${version}. Retrying with remote manifest.`);
return await getManifestEntry(version, platform, architecture, true);
Expand Down Expand Up @@ -35172,13 +35172,15 @@ async function getZstdUrl(version, platform, architecture) {
* @param version The requested LLVM version
* @param platform The platform
* @param architecture The architecture
* @param assertions Whether to retain LLVM assertions
* @returns The download URL and the asset name
*/
async function getMLIRUrl(version, platform, architecture) {
async function getMLIRUrl(version, platform, architecture, assertions = true) {
const entry = await getManifestEntry(version, platform, architecture);
const suffix = assertions ? ".tar.zst" : "_noassert.tar.zst";
return {
url: entry.download_url,
name: entry.asset_name,
url: entry.download_url.replace(/\.tar\.zst$/, suffix),
name: entry.asset_name.replace(/\.tar\.zst$/, suffix),
};
}

Expand Down Expand Up @@ -35225,6 +35227,7 @@ async function run() {
const llvm_version = getInput("llvm-version", { required: true });
const platform = getInput("platform", { required: true });
const architecture = getInput("architecture", { required: true });
const assertions = getBooleanInput("assertions");
// Validate LLVM version (either X.Y.Z format or commit hash)
const isVersionTag = RegExp("^\\d+\\.\\d+\\.\\d+$").test(llvm_version);
const isCommitHash = RegExp("^[0-9a-f]{7,40}$", "i").test(llvm_version);
Expand All @@ -35248,7 +35251,7 @@ async function run() {
await exec_exec("chmod", ["+x", zstdPath]);
}
core_debug("==> Determining download URL for LLVM distribution");
const asset = await getMLIRUrl(llvm_version, platform, architecture);
const asset = await getMLIRUrl(llvm_version, platform, architecture, assertions);
core_debug(`==> Downloading LLVM distribution: ${asset.url}`);
const file = await downloadTool(asset.url);
core_debug("==> Decompressing and extracting LLVM distribution");
Expand Down Expand Up @@ -35296,7 +35299,7 @@ async function run() {
? external_node_path_default().join(extractedDir, entries[0])
: extractedDir;
core_debug("==> Adding MLIR toolchain to tool cache");
cachedPath = await cacheDir(dir, "mlir-toolchain", llvm_version);
cachedPath = await cacheDir(dir, assertions ? "mlir-toolchain" : "mlir-toolchain-noassert", llvm_version);
}
finally {
// Clean up temp directories
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/update-known-versions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36364,7 +36364,8 @@ async function updateManifest() {
const manifest = [];
const zstdInfo = {};
for (const release of releases) {
const assets = release.assets.filter((asset) => !/(?:x86_64-apple-darwin|macos_.*_x86)\.|_debug/i.test(asset.name));
/// Keep one default archive per platform for older pinned actions.
const assets = release.assets.filter((asset) => !/(?:x86_64-apple-darwin|macos_.*_x86)\.|_(?:debug|noassert)/i.test(asset.name));
let version = undefined;
for (const asset of assets) {
if (asset.name.startsWith("zstd-")) {
Expand Down
2 changes: 1 addition & 1 deletion dist/update-known-versions/index.js.map

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions dist/version-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,61 @@
"architecture": "aarch64",
"asset_name": "llvm-mlir_llvmorg-23.1.1_aarch64-unknown-linux-gnu.tar.zst",
"debug": false,
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/llvm-mlir_llvmorg-23.1.1_aarch64-unknown-linux-gnu.tar.zst",
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/llvm-mlir_llvmorg-23.1.1_aarch64-unknown-linux-gnu.tar.zst",
"platform": "linux",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.11",
"tag": "2026.09.11",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.15",
"tag": "2026.09.15",
"version": "23.1.1",
"zstd_asset_name": "zstd-1.5.7_aarch64-unknown-linux-gnu.tar.gz",
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/zstd-1.5.7_aarch64-unknown-linux-gnu.tar.gz"
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/zstd-1.5.7_aarch64-unknown-linux-gnu.tar.gz"
},
{
"architecture": "x86",
"asset_name": "llvm-mlir_llvmorg-23.1.1_x86_64-unknown-linux-gnu.tar.zst",
"debug": false,
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/llvm-mlir_llvmorg-23.1.1_x86_64-unknown-linux-gnu.tar.zst",
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/llvm-mlir_llvmorg-23.1.1_x86_64-unknown-linux-gnu.tar.zst",
"platform": "linux",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.11",
"tag": "2026.09.11",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.15",
"tag": "2026.09.15",
"version": "23.1.1",
"zstd_asset_name": "zstd-1.5.7_x86_64-unknown-linux-gnu.tar.gz",
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/zstd-1.5.7_x86_64-unknown-linux-gnu.tar.gz"
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/zstd-1.5.7_x86_64-unknown-linux-gnu.tar.gz"
},
{
"architecture": "aarch64",
"asset_name": "llvm-mlir_llvmorg-23.1.1_arm64-apple-darwin.tar.zst",
"debug": false,
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/llvm-mlir_llvmorg-23.1.1_arm64-apple-darwin.tar.zst",
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/llvm-mlir_llvmorg-23.1.1_arm64-apple-darwin.tar.zst",
"platform": "macos",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.11",
"tag": "2026.09.11",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.15",
"tag": "2026.09.15",
"version": "23.1.1",
"zstd_asset_name": "zstd-1.5.7_arm64-apple-darwin.tar.gz",
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/zstd-1.5.7_arm64-apple-darwin.tar.gz"
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/zstd-1.5.7_arm64-apple-darwin.tar.gz"
},
{
"architecture": "aarch64",
"asset_name": "llvm-mlir_llvmorg-23.1.1_aarch64-pc-windows-msvc.tar.zst",
"debug": false,
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/llvm-mlir_llvmorg-23.1.1_aarch64-pc-windows-msvc.tar.zst",
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/llvm-mlir_llvmorg-23.1.1_aarch64-pc-windows-msvc.tar.zst",
"platform": "windows",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.11",
"tag": "2026.09.11",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.15",
"tag": "2026.09.15",
"version": "23.1.1",
"zstd_asset_name": "zstd-1.5.7_aarch64-pc-windows-msvc.tar.gz",
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/zstd-1.5.7_aarch64-pc-windows-msvc.tar.gz"
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/zstd-1.5.7_aarch64-pc-windows-msvc.tar.gz"
},
{
"architecture": "x86",
"asset_name": "llvm-mlir_llvmorg-23.1.1_x86_64-pc-windows-msvc.tar.zst",
"debug": false,
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/llvm-mlir_llvmorg-23.1.1_x86_64-pc-windows-msvc.tar.zst",
"download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/llvm-mlir_llvmorg-23.1.1_x86_64-pc-windows-msvc.tar.zst",
"platform": "windows",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.11",
"tag": "2026.09.11",
"release_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/tag/2026.09.15",
"tag": "2026.09.15",
"version": "23.1.1",
"zstd_asset_name": "zstd-1.5.7_x86_64-pc-windows-msvc.tar.gz",
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.11/zstd-1.5.7_x86_64-pc-windows-msvc.tar.gz"
"zstd_download_url": "https://github.com/munich-quantum-software/portable-mlir-toolchain/releases/download/2026.09.15/zstd-1.5.7_x86_64-pc-windows-msvc.tar.gz"
},
{
"architecture": "aarch64",
Expand Down
10 changes: 8 additions & 2 deletions installation/setup-mlir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ param(
[Parameter(Mandatory=$true)]
[string]$llvm_version,
[Parameter(Mandatory=$true)]
[string]$install_prefix
[string]$install_prefix,
[switch]$no_assertions
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -95,6 +96,7 @@ $matching_entries = @($manifest_json | Where-Object {
$_.architecture -eq $architecture -and
$_.asset_name -like "*.tar.zst" -and
$_.asset_name -notlike "*_debug*" -and
$_.asset_name -notlike "*_noassert*" -and
$_.version -like "${llvm_version}*"
})

Expand Down Expand Up @@ -137,7 +139,11 @@ if (-not (Test-Path $zstdBinPath)) {

# Download LLVM distribution
Write-Host "Downloading LLVM distribution..."
if (-not (Download-Asset -Url $matching_entries[0].download_url -OutputFile "llvm.tar.zst")) {
$llvm_url = $matching_entries[0].download_url
if ($no_assertions) {
$llvm_url = $llvm_url -replace '\.tar\.zst$', '_noassert.tar.zst'
}
if (-not (Download-Asset -Url $llvm_url -OutputFile "llvm.tar.zst")) {
Write-Error "Download of LLVM distribution failed."
exit 1
}
Expand Down
16 changes: 13 additions & 3 deletions installation/setup-mlir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@
set -euo pipefail

# Parse arguments
while getopts ":v:p:" opt; do
ASSERTIONS=ON
while getopts ":v:p:a:" opt; do
case $opt in
v) LLVM_VERSION="$OPTARG" ;;
p) INSTALL_PREFIX="$OPTARG" ;;
a) ASSERTIONS="$OPTARG" ;;
\?) echo "Error: Invalid option -$OPTARG" >&2; exit 1 ;;
esac
done

if [[ "$ASSERTIONS" != ON && "$ASSERTIONS" != OFF ]]; then
echo "Error: Assertions (-a) must be ON or OFF." >&2
exit 1
fi

# Check arguments
if [ -z "${LLVM_VERSION:-}" ]; then
echo "Error: LLVM version (-v) is required" >&2
echo "Usage: $0 -v <LLVM version> -p <installation directory>" >&2
echo "Usage: $0 -v <LLVM version> -p <installation directory> [-a ON|OFF]" >&2
exit 1
fi
if [ -z "${INSTALL_PREFIX:-}" ]; then
echo "Error: Installation directory (-p) is required" >&2
echo "Usage: $0 -v <LLVM version> -p <installation directory>" >&2
echo "Usage: $0 -v <LLVM version> -p <installation directory> [-a ON|OFF]" >&2
exit 1
fi

Expand Down Expand Up @@ -188,6 +195,9 @@ if [ -z "$LLVM_URL" ]; then
exit 1
fi

if [[ "$ASSERTIONS" == OFF ]]; then
LLVM_URL="${LLVM_URL%.tar.zst}_noassert.tar.zst"
fi
download_file "$LLVM_URL" "llvm.tar.zst"

# Decompress and extract LLVM distribution
Expand Down
14 changes: 12 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function run(): Promise<void> {
const llvm_version = core.getInput("llvm-version", { required: true });
const platform = core.getInput("platform", { required: true });
const architecture = core.getInput("architecture", { required: true });
const assertions = core.getBooleanInput("assertions");

// Validate LLVM version (either X.Y.Z format or commit hash)
const isVersionTag = RegExp("^\\d+\\.\\d+\\.\\d+$").test(llvm_version);
Expand Down Expand Up @@ -66,7 +67,12 @@ export async function run(): Promise<void> {
}

core.debug("==> Determining download URL for LLVM distribution");
const asset = await getMLIRUrl(llvm_version, platform, architecture);
const asset = await getMLIRUrl(
llvm_version,
platform,
architecture,
assertions,
);
core.debug(`==> Downloading LLVM distribution: ${asset.url}`);
const file = await tc.downloadTool(asset.url);

Expand Down Expand Up @@ -130,7 +136,11 @@ export async function run(): Promise<void> {
: extractedDir;

core.debug("==> Adding MLIR toolchain to tool cache");
cachedPath = await tc.cacheDir(dir, "mlir-toolchain", llvm_version);
cachedPath = await tc.cacheDir(
dir,
assertions ? "mlir-toolchain" : "mlir-toolchain-noassert",
llvm_version,
);
} finally {
// Clean up temp directories
await io.rmRF(extractDir);
Expand Down
9 changes: 6 additions & 3 deletions src/utils/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function getManifestEntry(
entry.platform === platform &&
entry.architecture === architecture &&
entry.asset_name.endsWith(".tar.zst") &&
!entry.asset_name.includes("_debug"),
!/_(?:debug|noassert)/.test(entry.asset_name),
);

if (entries.length === 0 && !forceRemote) {
Expand Down Expand Up @@ -160,16 +160,19 @@ export async function getZstdUrl(
* @param version The requested LLVM version
* @param platform The platform
* @param architecture The architecture
* @param assertions Whether to retain LLVM assertions
* @returns The download URL and the asset name
*/
export async function getMLIRUrl(
version: string,
platform: string,
architecture: string,
assertions: boolean = true,
): Promise<{ url: string; name: string }> {
const entry = await getManifestEntry(version, platform, architecture);
const suffix = assertions ? ".tar.zst" : "_noassert.tar.zst";
return {
url: entry.download_url,
name: entry.asset_name,
url: entry.download_url.replace(/\.tar\.zst$/, suffix),
name: entry.asset_name.replace(/\.tar\.zst$/, suffix),
};
}
5 changes: 4 additions & 1 deletion src/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,12 @@ export async function updateManifest(): Promise<void> {
const manifest: ManifestEntry[] = [];
const zstdInfo: ZstdInfo = {};
for (const release of releases) {
/// Keep one default archive per platform for older pinned actions.
const assets = release.assets.filter(
(asset) =>
!/(?:x86_64-apple-darwin|macos_.*_x86)\.|_debug/i.test(asset.name),
!/(?:x86_64-apple-darwin|macos_.*_x86)\.|_(?:debug|noassert)/i.test(
asset.name,
),
);
let version: string | undefined = undefined;
for (const asset of assets) {
Expand Down
Loading
Loading