Commit Graph
987 Commits
Author SHA1 Message Date
Partouf 74a7611f3e fix #2986 2025-08-26 12:39:37 +02:00
kevinjeon-g fc37e42d13 Fix errors in dex2oat compilation (#8050)
This fixes missing inlines (noticed on ArrayList iterators) and
incorrectly-emitted read barriers on local dex2oat.
2025-08-25 21:17:55 -05:00
Ofek 96103f044f Fix #8000: stop forcing dwarf 4 (#8036) 2025-08-16 17:39:09 +03:00
Matt GodboltandPartouf 2ae38a0c3f Make argument parsers instances instead of static classes (#8017)
- Made parsers stateful instances instead of shared static state (for
mllvm options). Fixes #8011 as this is caused by multiple clang-based
compilers being run concurrently and stomping over each others' state.
- passes `Compiler` to the constructor, which removes some param passing
- Added some missing awaits
- Tried to get things less dependent on `examples`, only `go` needs it
- Spotted that `zig` c++ might have issues in discovery
- Fly-by fixed a broken go path in ppc64le_gl122
- removed a redundant override in coccinelle
- made the mojo parser actually use the parser it defined
- canonified tablegen's special method
- 

I changed the zig parser too but as best I can tell it was broken before
(the `1` return value from the command it runs:)

```
ubuntu@ip-172-30-0-164:/infra/.deploy$ /opt/compiler-explorer/zig-0.14.1/zig c++ -mllvm --help-list-hidden /infra/.deploy/examples/c++/default.cpp -S -o /tmp/output.s
...
  --x86-use-vzeroupper                                                       - Minimize AVX to SSE transition penalty
  --xcore-max-threads=<number>                                               - Maximum number of threads (for emulation thread-local storage)
/infra/.deploy/examples/c++/default.cpp:1:1: error: FileNotFound
```
return code 1 (means it's not cached)

---------

Co-authored-by: Partouf <partouf@gmail.com>
2025-08-11 12:14:13 -05:00
A. R. Shajii bea6e67715 Add Codon Python compiler (#8008) 2025-08-11 11:14:26 -05:00
Shawn ZhongandMatt Godbolt 8befc91a79 Add Triton language and compiler (#7919)
Close #5530. Infra:
https://github.com/compiler-explorer/infra/pull/1711. Previous work by
@siboehm at #5531


## Summary

This pull request introduces support for the
[Triton](https://github.com/triton-lang/triton) language, a Python-based
DSL for writing highly efficient GPU kernels.


- [x] **New Language Support**: I've added comprehensive support for the
Triton programming language, allowing users to compile and inspect
Triton kernels within Compiler Explorer. (c.f.,
`lib/compilers/triton.ts`)
- [x] **Python Wrapper for Compilation**: A new Python wrapper script
(`triton_wrapper.py`) has been introduced to manage Triton compilation,
patching its behavior to dump compiled kernels and intermediate
representations without requiring actual execution, and consolidating
the output for Compiler Explorer.
- [x] **Device Assembly View**: Enables viewing of generated device
assembly code (e.g., PTX, AMDGCN) and various intermediate
representations (MLIR, LLVM IR) produced by the Triton compiler.
- [x] **MLIR Parsing**: New parsers (`asm-parser-mlir.ts` and
`mlir-pass-dump-parser.ts`) have been added to correctly interpret and
display MLIR assembly and optimization pass dumps, including source
location information.
- [x] **Multi-Version & Multi-Backend Support**: Painstakingly includes
all 8 versions (from 2.2.0 to 3.3.1) of Triton that supports Python
3.12. Supports both CUDA and HIP backend for Triton 3.

## Screenshots

Source and assembly:
<img width="1354" height="789" alt="image"
src="https://github.com/user-attachments/assets/c29650ff-2073-40e0-a9e6-ff8377094b5e"
/>



Device view for MLIR and LLVM IR: 
<img width="1402" height="670" alt="image"
src="https://github.com/user-attachments/assets/43dd5c68-ca78-41b1-9865-e97ffe3ef73c"
/>

Opt pipeline viewer:
<img width="1408" height="668" alt="image"
src="https://github.com/user-attachments/assets/429eef8c-aaac-4781-aafa-39ef0ffc7241"
/>

Diff of TTIR in Triton 3.3.1 vs 2.3.0:
<img width="1580" height="726" alt="image"
src="https://github.com/user-attachments/assets/a928c893-dd9a-4c3a-a048-14046e56a14c"
/>

CUDA & HIP:
<img width="1596" height="800" alt="image"
src="https://github.com/user-attachments/assets/c18800c3-cfad-4e5e-96de-ba92c9f236ea"
/>

## Implementation Details (and Notes for Reviewers)

- For Device Assembly View, I Implemented `MlirAsmParser` for parsing
MLIR assembly. Technically MLIR is not an assembly language, but there
is no better choice to make the source line map work w/ device view.
- I Implemented `MlirPassDumpParser` for processing MLIR optimization
pass dumps. I tried to subclass `LlvmPassDumpParser`, but they turn out
to be too different to worth doing it.
- `LlvmPassDumpParser` made some assumptions that do not hold true for
MLIR passed. Some effort is put to make sure that the passes are
properly diff-ed, since some passes can run multiple times and also
sometimes pass can be nested (i.e., some number of `before`s followed by
some number of `after`s)
- A lot of effort is put into `patch_triton` to make sure that the we
only compile the kernel without actually running it, and that needs to
work across all the versions we support.

## Steps to Run Locally

1. Clone https://github.com/ShawnZhong/compiler-explorer-infra.git
2. Install Triton to `/opt/compiler-explorer/triton`:
```sh
$ cd compiler-explorer-infra
$ ./bin/ce_install install triton
$ ls /opt/compiler-explorer/triton
# v2.2.0  v2.3.0  v2.3.1  v3.0.0  v3.1.0  v3.2.0  v3.3.0  v3.3.1
```
3. Clone https://github.com/ShawnZhong/compiler-explorer.git and
checkout branch `triton`
4. Run Compiler Explorer
```sh
make EXTRA_ARGS='--language triton' dev
```
5. Enjoy

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-07-30 10:15:28 -05:00
Jacob Panov 1a388a580f Fix NIM compiler ENOENT error when -c passed as options (#7952)
This PR addresses an issue that causes an `ENOENT` in the presence of the `-c` parameter being passed as an option in binary mode.
2025-07-30 09:55:17 -05:00
Matt Godbolt 8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Quinton Miller 33f433cb1f Crystal: support Intel assembly output syntax (#7940) 2025-07-27 14:44:02 +02:00
Apurva Modak 20ef5784cf Add RGA compiler support for HLSL (#7941) 2025-07-27 14:40:41 +02:00
Ofek Shilon 8a2a77fe21 Restrict zig -fllvm to supported versions 2025-07-19 16:17:43 +03:00
OfekandOfek Shilon a0570b37f3 Fix #7908: Restrict zig -fno-strip switch to versions that support it (#7931)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-07-19 14:17:51 +03:00
OfekandOfek Shilon a08da10ddb Fix #7907: Add fllvm to zig compilations (#7930)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-07-19 14:01:59 +03:00
OfekandOfek Shilon 6a0188a5ed Fix #7852: return processRawOptRemarks back to BaseCompiler (#7860)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-24 07:33:53 +03:00
OfekandOfek Shilon 37ae297d95 Fix #7849: Enable llvm opt-remarks for flang (#7851)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-21 20:56:15 +03:00
Patrick Quist b5e7219baa Add dedicated PTX assembly parser to fix directive filtering (#7839) 2025-06-20 14:46:24 +02:00
Patrick Quist 4069bf3b3e Fix/msvc lib debug release naming (#7840) 2025-06-19 23:15:55 +02:00
Patrick Quist 02b4aa9f02 Fix MSVC library naming for debug/release modes (#7838) 2025-06-19 10:40:07 +02:00
Peter Hill 12fcac5e05 Add more recent LFortran linker flag (#7800)
More recent versions of LFortran use `LFORTRAN_LINKER` env var for
linking, rather than `LFORTRAN_CC`.

Tested locally with 0.42 and 0.51
2025-06-17 16:19:40 -05:00
OfekandOfek Shilon d59702383b Fix regression in rustc-nightly opt remarks (#7818)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->

Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-16 21:24:52 +03:00
Ofek daf15af5ab Fix #7809 plus some refactoring (#7812)
Fix #7809 and then some:

Stop processing opt-remarks if none were requested,
Make gcc dump remarks to file,
separate opt-file handling to ClangCompiler and GccCompiler,
make DefaultCompiler inherit GccCompiler,
move some tests around.
2025-06-16 10:13:32 -05:00
narpfel 299d7a251c Fix argument parser for Rust >= 1.88 (#7806)
Resolves #7780.

Basically a follow-up to #7652; the output format of `rustc --help` was
changed to include angle brackets `<` and `>`. This PR updates the
regexes used to parse the help output and adds some tests.
2025-06-16 09:55:02 -05:00
Mats Jun Larsen a3be869e3a Replace PascalUtils class with top-level functions (NFC) (#7610) 2025-06-11 07:11:57 +00:00
Christoffer Lerno 112d000ad2 Fix C3 0.6.8 (#7786) 2025-06-09 18:09:01 -05:00
timo bd80d171de Add raku language and rakudo compiler (#7784)
This relies on https://github.com/compiler-explorer/infra/pull/1658 to
put rakudo release versions in the right spot.


![image](https://github.com/user-attachments/assets/30ba7c2b-389a-4d3f-895b-c13da5b5f072)

There are more things that can be added, such as opcode tooltips,
suggested options for `--target=parse`, `--target=ast`,
`--target=optimize`, and probably other things I haven't thought of yet.
But this pull request should be a good starting point, and fine to merge
without waiting for further features.
2025-06-09 12:39:53 -05:00
Rob Parolin 157662eb31 [mojo-lang] Fixing LLVM IR panel due to calling the mojo compiler with incorrect args. (#7716)
This PR fixes the LLVM IR output for the Mojo compiler integration,
ensuring the LLVM IR panel works correctly and no longer shows "Internal
error; unable to open output path" errors.
2025-05-30 07:48:28 -05:00
Partouf 2e0549b3fb more fixes 2025-05-28 15:21:02 +02:00
Partouf d16d717220 hotfix windows 2025-05-28 14:49:51 +02:00
Partouf de3e34bda8 windows hotfix 2025-05-28 14:00:09 +02:00
Patrick Quist 2e76639163 Windows library support (#7554)
Huray
2025-05-28 10:50:26 +02:00
Patrick Quist 6fb3ab38e7 Add Game Boy emulator support using WasmBoy (#7717) 2025-05-24 18:43:41 +02:00
narpfel 91a2d58aa2 Make 2024 the default edition for Rust >= 1.85 (#7649)
Resolves #7472.
2025-05-23 03:01:26 +02:00
Rob Parolin a0b48fb7e0 Add Mojo compiler (#7692)
This PR adds support for the Mojo programming language.

Explicitly tested viewing the generated assembly, LLVM IR, and running
the generated executable.
2025-05-21 13:53:05 -05:00
Patrick Quist ac4642283c fix pascal execution (#7695)
Fixes #7224
2025-05-20 13:19:31 +02:00
narpfel 703b13ae01 Fix Rust edition argument parser (#7652)
* For `nightly` Rust (and 1.88+), the output format of `--help` was
changed in https://github.com/rust-lang/rust/pull/140152.
This PR changes the parser to parse the new format, so that edition
overrides are selectable for `nightly` Rust. Note the `<>`:
  ```
          --edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
                          stable edition is 2024.
  ```
* Rust <= 1.34 (and >= 1.31) support the 2018 edition, but the help
message only includes `--edition` in verbose mode.
2025-05-12 12:54:48 -05:00
Matt GodboltandClaude 2f892583ba Remove global handler_config variable (#7675)
The global handler_config was being used to allow compilers to find
other compilers. This change replaces that global with a proper method
on the CompilationEnvironment class, allowing compilers to find other
compilers through the environment instead of using a global variable.

🤖 PR description generated with [Claude Code](https://claude.ai/code) -
code by @mattgodbolt though :)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:47:58 -05:00
Matt Godbolt 9a7e0d4ed8 Fix up import order 2025-05-11 16:15:21 -05:00
Rucadi aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
Anton Baliasnikov e5c982e7d9 Add solx, new Solidity LLVM-based compiler (#7633) 2025-05-05 13:05:17 +02:00
Patrick Quist afdea17163 fix sway std path and build command (#7597) 2025-04-23 15:53:49 +02:00
narpfel 355d49ec63 [c2rust]: allow passing arguments to clang (#7583)
To pass arguments to `clang` (such as `-std=...`), `--` must be used to
separate these arguments from the arguments to `c2rust`:

```console
$ ./c2rust-transpile --help
transpile 0.20.0
[...]
USAGE:
    c2rust-transpile [OPTIONS] [COMPILE_COMMANDS]... [-- <EXTRA_CLANG_ARGS>...]
```

However, when doing this, the input file must be passed *before* the
`--`. Also, when libraries are enabled, the include and link flags must
be passed to `clang` (but duplicate `--` are not allowed).

Example for passing command line arguments:
https://godbolt.org/z/eqfa3T7WY
Example for activating a library: https://godbolt.org/z/srh55Y1hY
2025-04-22 13:55:17 -05:00
Matt Godbolt 6400235a18 Drop dependency on fs-extra (we removed it a while back) 2025-04-19 13:56:20 -05:00
Tim HuttandMatt Godbolt d1d0883a86 Add support for the Sail language (#7304)
This adds support for the [Sail
language](https://github.com/rems-project/sail) - a DSL for defining
ISAs.

It's not quite ready but I need some help. These are the main remaining
issues:

1. When you "link to binary" it does disassemble the binary properly,
but the syntax highlighting and line numbers are broken.


![image](https://github.com/user-attachments/assets/2f4fe12c-49b4-4b26-9cb0-7e1666a7b3a2)

2. If you try to execute the code without a `function main() -> unit =
...` then it gives this error in the compiler output:

```
Internal Compiler Explorer error: Error: spawn /tmp/compiler-explorer-compiler2025025-31052-c8gern.pf8t/model.c EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Compiler returned: -1
```

This is weird - it should give a linker with an undefined reference to
`zmain`.

3. Sail compiles to C, and then I added extra steps to compile that to
binary (if you select `Execute the code`), but as you can see I had to
move the binary back over the C file, so in this case `model.c` is
actually an ELF file. It works but that seems very weird. There is a
`getExecutableFilename()` method I could override, but doing that seems
to make it even more confused.

4. I also had to have a fake flag for `binary` because the `filters`
don't seem to get set correctly when passed to `runCompiler()`. E.g.
`buildExecutable()` doesn't pass them at all. Not sure what is going on
there. Seems to work though.

Any help appreciated!

PS: Sail is a cool language. It has lightweight dependent type for
integers and bit vectors, which I haven't demonstrated in the examples
yet, but they're neat.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 17:22:18 -05:00
Adrien Bertrand 9e7808b13c Add (e)z80-clang compilers. (#7546)
These clang + LLVM backends are not upstreamed but [a community
effort](https://github.com/CE-Programming/llvm-project/), so it's a bit
customized.

This requires https://github.com/compiler-explorer/infra/pull/1566

_Edit: tested locally, works fine._
2025-04-14 15:17:39 -05:00
Ofek 36715c9369 Support opt remarks for rustc-nightly (#7561)
Closes #7525.
2025-04-12 11:29:38 +03:00
Mats Jun Larsen 1e4f0cbb49 Revert noThisInStatic Biome rule for argument-parsers.ts (#7529) 2025-03-29 15:33:40 +01:00
Steve 948382018e .NET: Add multiple architectures support for NativeAOT (#7496)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/25
2025-03-27 13:52:41 -05:00
Matt Godbolt 90aee8f04d Implement a no-op parser for handling rust 2025-03-27 12:15:39 -05:00
Nicole LeGare 73196b9441 Turns out getOutputFilename was necessary 2025-03-18 13:46:24 -07:00
Nicole LeGare d0c91b07f8 Remove unnecessary function overrides 2025-03-18 13:46:24 -07:00