Commit Graph
2753 Commits
Author SHA1 Message Date
Partouf b6234dcfb6 Merge remote-tracking branch 'origin/main' into feat/compilation-workers 2025-08-16 16:51:20 +02:00
Ofek 96103f044f Fix #8000: stop forcing dwarf 4 (#8036) 2025-08-16 17:39:09 +03:00
narpfel 5d1d7cf77b Fix demangling for symbols with dots in jump instructions (#8028)
For example Rust on AArch64: https://godbolt.org/z/e3q9Wv7zj
2025-08-14 10:09:02 -05:00
PartoufandClaude 303027ec0c Fix type signature for WebSocket send method to use CompilationResult
- Change send() method parameter from BasicExecutionResult to CompilationResult
- Update messageQueue type to match actual usage
- Remove unnecessary filenameTransform property addition
- Both EventsWsSender and PersistentEventsSender now correctly typed

The send methods were receiving CompilationResult objects but typed as
BasicExecutionResult, causing type mismatches. This fixes the actual
usage to match the type signatures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 05:29:33 +02:00
PartoufandClaude 1e81e3d103 Add s3Key property to compilation results for large result S3 storage
- Add optional s3Key property to CompilationResult interface
- Set s3Key = BaseCache.hash(key) in both compile() and cmake() functions
- Remove s3Key from API responses before sending to users
- Add size checking and logging for large results in compilation queue
- Update documentation with S3 storage integration details

This enables compilation workers to reference large results (>31KiB)
stored in S3 using the deterministic cache key hash, addressing
WebSocket disconnection issues with large compilation results.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 05:23:03 +02:00
Partouf 4ea0613b43 fix parsing of sqs compile messages 2025-08-12 22:34:12 +02:00
partouf e6c1d346f2 merge 2025-08-12 16:35:54 +02:00
partouf ac7d425f25 bugfix compiler execTime 2025-08-12 15:52:30 +02:00
narpfel 68db4ca482 Remove unused method AsmParser.labelFindFor (#8022)
`AsmParser.labelFindFor` was only called in tests.
2025-08-12 08:50:53 -05:00
partouf 423b92f8fb fix error message 2025-08-12 15:06:37 +02:00
partouf 519f764a8a Merge remote-tracking branch 'origin/main' into feat/compilation-workers 2025-08-12 14:55:08 +02:00
narpfel f289b79f1d Don’t filter .set directives that declare merged functions (#8021)
Resolves #2409.
2025-08-11 14:31:44 -05:00
narpfel 82407976d1 Accept multiple dots in symbol names for jump to label (#8018)
Some compilers emit symbol names with multiple dots, e. g. Clang for
static data (like string literals) or GCC for function clones (e. g. due
to interprocedural constant propagation).

Test cases: https://godbolt.org/z/dGbGncnh8,
https://godbolt.org/z/dhrGGqrjo
2025-08-11 14:28:06 -05: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
Matt Godbolt 56cf9859c3 Disable failed assertion 2025-08-09 14:27:40 -05:00
Ofek a85260bc27 Fix #8009: Allow quotes as part of labels (#8015) 2025-08-09 20:21:31 +02:00
Ofek fbfcd52dd5 Fix #8010: detection of jmp targets in python cfg (#8012) 2025-08-09 16:53:58 +03:00
PartoufandClaude 14eb75bab2 Add timing information to WebSocket success logging
Enhances both compilation and execution worker logging by including
the total processing time (from message receipt to result send) in
the WebSocket success logs. This provides better visibility into:

- End-to-end processing performance
- WebSocket delivery confirmation with timing context
- Debugging and monitoring capabilities for worker performance

Example logs:
- "Successfully sent compilation result for abc123 via WebSocket (total time: 1250ms)"
- "Successfully sent execution result for def456 via WebSocket (total time: 890ms)"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 01:53:38 +02:00
PartoufandClaude 39847a5a11 Apply persistent WebSocket connections to execution workers
Extends the PersistentEventsSender implementation to execution workers,
providing the same performance benefits as compilation workers:

- Single persistent WebSocket connection per worker instance
- Eliminates connection overhead for each execution result
- Shares connection health monitoring and reconnection logic
- Graceful shutdown handling for both worker threads

This completes the persistent WebSocket implementation across all
worker types for improved result delivery performance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 23:38:17 +02:00
PartoufandClaude 5dc36a874b Implement persistent WebSocket connections for compilation workers
Adds PersistentEventsSender class to maintain a single WebSocket connection
throughout the worker's lifetime, eliminating connection overhead for each
compilation result. Features include:

- Connection health monitoring with heartbeat (30s intervals)
- Automatic reconnection with exponential backoff (up to 5 attempts)
- Message buffering during connection interruptions
- Thread-safe operation for concurrent worker threads
- Graceful shutdown handling

This significantly reduces result delivery latency by avoiding WebSocket
handshake overhead for every compilation result.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 23:34:53 +02:00
Partouf ed87199480 update cp year 2025-08-07 16:50:25 +02:00
Partouf 558a73ac1d remove unused isCompilationWorker 2025-08-07 16:49:14 +02:00
Partouf 6e1f0ace48 only handle local compilation 2025-08-07 16:28:15 +02:00
Partouf 4e0c39f0af formatting 2025-08-07 15:47:35 +02:00
Partouf 130af6de12 Merge remote-tracking branch 'origin/main' into feat/compilation-workers 2025-08-07 15:46:20 +02:00
Matt GodboltandClaude c29ad46f3a [Not Live; disabled by default] Add Claude Explain feature for AI-powered assembly explanations (#7749)
Add Claude Explain feature for AI-powered code explanations

This PR introduces Claude Explain, a new feature that provides AI-powered explanations of compiler output directly within Compiler Explorer.

Key features:

Claude Explain functionality:
  - New explain view pane
  - Explains compiler output with full context of source code and compilation output
  - Configurable audience level and explanation type
  - Response caching to improve performance and reduce API calls
  - Usage statistics display showing requests used and token counts

User experience:
  - Consent flow on first use explaining data handling and privacy
  - AI disclaimer banner warning about potential LLM inaccuracies
  - Respects "no-ai" directive in source code for users who don't want AI processing

Privacy and security:
  - Data sent to Anthropic's Claude API as documented in privacy policy
  - No data used for model training
  - Clear consent required before first use
  - Support for opting out via "no-ai" directive

The feature is marked as beta and can be enabled via configuration.

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-05 09:31:48 -05:00
Iain Buclaw 1055430504 Add alias option for gcc tree/rtl viewer (#7985) (#7987)
This option is undocumented, but has been around since 2010 for GCC
4.6.0
2025-08-04 15:44:08 +02:00
Shawn Zhong 9c72429e08 Remove duplicates in SASS docs (#7991)
In PR https://github.com/compiler-explorer/compiler-explorer/pull/7976,
I forgot to handle the case where same instructions have different
descriptions. This PR fixes the script and removes the duplicates from
the generated file.

The SASS docs are extracted from multiple tables from
https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#instruction-set-reference.
For example,
- Table 4. Maxwell and Pascal Instruction Set
- ...
- Table 8. Hopper Instruction Set
- Table 8. Blackwell Instruction Set (wait...what? both tables are table
8? whatever...)

Previously, only the duplications for the (opcode, descriptions) pair
were removed. In this PR, we only check the duplications based on the
opcode and only keep the last one (based on the assumption that the
newer ones are better).

I manually went through the removed duplicates, and found that
- No instruction actually changed the meaning across generations (I
would be very surprised if they did so).
- Most of the changes are minor fixes like changing capitalization
(e.g., `generic Memory` -> `Generic Memory`) or fixing typo (e.g.,
`Local within Shared Memory Window` -> `Load within Shared Memory
Window`)
- A couple of the descriptions are for whatever reason simplified (e.g.,
`LOP3`: `3-input Logic Operation` -> `Logic Operation`), which is a bit
unfortunate.
2025-08-04 08:20:28 -05:00
Matt GodboltandClaude 0eee48a0fb Optimize logo file sizes to reduce webpack bundle size (#7979)
## Summary
- Optimized 13 logo files, reducing total size by ~560KB
- Converted hylo.svg (321KB) and nim.svg (126KB) to optimized PNGs
(27KB, 13KB)
- Resized oversized images to max 256×256 while preserving aspect ratios
- Optimized SVGs with SVGO where beneficial
- Fixed file permissions (removed execute bits from image files)
- Added comprehensive README.md with optimization guidelines

## Files Changed
- `lib/languages.ts`: Updated references from hylo.svg → hylo.png,
nim.svg → nim.png
- `public/logos/`: Optimized multiple logo files
- `public/logos/README.md`: New optimization guidelines for future logo
additions

## Size Reductions
- hylo.svg → hylo.png: 321KB → 27KB (92% reduction)
- nim.svg → nim.png: 126KB → 13KB (90% reduction)  
- scala.png: 79KB → 14KB (82% reduction)
- haskell.png: 19KB → 6.5KB (66% reduction)
- pony.svg: 53KB → 35KB (34% reduction)
- odin.png: 48KB → 27KB (44% reduction)
- nix.svg: 26KB → 5KB (81% reduction)
- gimple.svg: 21KB → 11KB (48% reduction)
- spice.png: 16KB → 9.3KB (42% reduction)
- hook.png: 14KB → 9.3KB (34% reduction)
- hook-dark.png: 13KB → 9.3KB (28% reduction)

## Test plan
- [x] Verify all logos display correctly in the language selection UI
- [x] Confirm no broken image references
- [x] Check that webpack bundle size warnings are reduced
- [x] Ensure visual quality is acceptable at small icon sizes

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-31 16:07:04 -05:00
Shawn Zhong 97c6ce61ec Update SASS docs and fix link (#7976)
- Change SASS instruction link from
`https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#id14` to
`https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#instruction-set-reference`.
In the former URL, the tag (`#id14`) no longer exists on the webpage.
- Run `etc/scripts/docenizers/docenizer-ptx-sass.py` and add some new
instructions from the website.
2025-07-31 08:21:27 -05:00
Shawn Zhong f92b6f388a Remove dangling empty braces in PTX (#7960)
After directive filtering, there will be dangling `{}` spanning two
lines. This PR attempts to remove them.

For example, 
```
.section    .debug_abbrev
{
.b8 1
}
.section    .debug_info
{
.b32 70
.b32 .debug_abbrev
}
```

The above assembly used to become the following text after filtering
directive

```
{
}
{
}
```
2025-07-30 10:40:00 -05:00
Shawn Zhong 227595d83e Fix PTX parsing with predicate (#7959)
Recogonize lines with predicate (e.g., `@%p1`, `@!%p1`) as instructions:
- `@%p1 ld.global.v4.b32 { %r9, %r10, %r11, %r12 }, [ %rd3 + 0 ];`
- `@%p2 bra $L__BB0_28;`
- `@!%p2 bra $L__BB0_28;`

| Before | After | 
| --- | --- |
| <img width="580" height="320" alt="image"
src="https://github.com/user-attachments/assets/c3913b09-ce04-44c5-a4c0-fa69805cf1d7"
/> | <img width="566" height="323" alt="image"
src="https://github.com/user-attachments/assets/08308b3d-df00-4cf1-8321-203c374c27c3"
/> |



From
https://docs.nvidia.com/cuda/parallel-thread-execution/#instruction-statements:

> Instructions have an optional guard predicate which controls
conditional execution. The guard predicate follows the optional label
and precedes the opcode, and is written as @p, where p is a predicate
register. The guard predicate may be optionally negated, written as @!p.

Implementation-wise, added `(@!?%\w+\s+)?` to existing default
`hasOpcodeRe` (`/^\s*(%[$.A-Z_a-z][\w$.]*\s*=\s*)?[A-Za-z]/`)
2025-07-30 10:34:59 -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 c7056b31eb Fix llvm-mca tool preprocessing of debug directives (#7964)
This PR fixes the "unassigned file number" error in llvm-mca when
processing GCC-generated assembly with debug information #6795 .

**Problem**: GCC with `-g` flag generates `.loc` and `.file` debug
directives that cause llvm-mca to fail with "unassigned file number"
errors.

**Solution**: Filter out `.loc` and `.file` directives during assembly
preprocessing, similar to how other problematic directives are already
handled.

**Changes**:
- Add regex filtering for `.loc` and `.file` directives in
`rewriteAsm()`
- Make `rewriteAsm()` method public for testability
- Add comprehensive test coverage for debug directive removal

The fix is minimal, targeted, and follows the existing pattern of
directive filtering.
2025-07-30 10:00:09 -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
Partouf 00ff276698 readonly prop 2025-07-29 01:25:31 +02:00
PartoufandClaude e496502830 Add SQS queue time tracking to compilation results
Track the time messages spend in the SQS queue by retrieving the SentTimestamp
attribute and calculating the difference with current UTC time. This queue time
is now included as a queueTime property (in milliseconds) in all CompilationResult
objects for both successful and failed compilations.

Changes:
- Request SentTimestamp attribute when receiving SQS messages
- Calculate queue time from SentTimestamp to current time
- Add queueTime property to CompilationResult interface
- Include queue time in all compilation results (success/error cases)
- Handle queue time for both local and remote compilations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 01:22:25 +02: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
Partouf 818d2b50c4 more extensions 2025-07-27 19:40:26 +02:00
Partouf 6b2b3a8925 add cuda extension 2025-07-27 19:35:06 +02:00
Quinton Miller 33f433cb1f Crystal: support Intel assembly output syntax (#7940) 2025-07-27 14:44:02 +02:00
Patrick Quist 477eec3e70 apply waittimeseconds (#7868) 2025-07-27 14:42:44 +02:00
Apurva Modak 20ef5784cf Add RGA compiler support for HLSL (#7941) 2025-07-27 14:40:41 +02:00
Jacob Panov 534e1428fa Update AVR instruction documentation for 2024 manual (#7947) 2025-07-27 13:53:03 +02:00
Patrick Quist f70ab79be4 Add new /api/tools/<language> API endpoint (#7950) 2025-07-27 13:47:06 +02:00
partoufandClaude 905301ad85 Add remote compiler support to compilation workers
- Workers now automatically detect and proxy requests to remote compilers
- HTTP requests are made to remote compiler endpoints with proper formatting
- Error handling ensures Lambda never waits endlessly via comprehensive WebSocket responses
- Timeout handling with 35-second abort controller for network issues
- Sentry error capture for worker thread exceptions
- Updated documentation to reflect remote compiler support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 23:43:40 +02:00
Ofek 556fa1e29c Fix #7539: llvm-mca falls back to autodetected arch if fails to use compilation switches 2025-07-21 20:35:35 +03:00
Jacob Panov d9a124fe8d Fix to ensure labels are not mistaken for comments (#7926)
Ensured labels are not mistaken for comments by skipping comment
filtering when the line matches a label definition

Added a regression test verifying that labels starting with “@” remain
visible even when comment filtering is enabled

Fixes #7889 

Tested with 
npm run lint
npm run ts-check
npm run test-min
npm run check-frontend-imports
make check
2025-07-21 12:06:49 +03:00
Ofek 14af70abb2 Fix #6886: Add cfg support for Xtensa ISA (#7933) 2025-07-19 21:01:14 +03:00