Commit Graph

49 Commits

Author SHA1 Message Date
Matt Godbolt (bot acct)
20505fba5a Filter NVCC fatbinData label from assembly output (#8506)
*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)*

Closes #5178

## Problem

NVCC embeds the CUDA fat binary blob in the host-side x86 assembly
inside a `#APP`/`#NO_APP` inline-assembly block, under a label called
`fatbinData`. In a realistic kernel this can be 100+ lines of `.quad`
hex values — a wall of noise before any user-readable code.

Example: https://godbolt.org/z/W3YMcq8oY

## Fix

Per-compiler pre-processing step in `NvccCompiler.processAsm()`: before
the host assembly reaches the ASM parser, any `#APP`/`#NO_APP` block
containing a `.nv_fatbin` section is stripped out entirely.

- Only `.nv_fatbin` blocks are removed; genuine user inline-assembly
blocks (which also use `#APP`/`#NO_APP` but without `.nv_fatbin`) are
left intact.
- Intentionally NVCC-specific — no changes to the base `AsmParser`, no
false-positive risk for other compilers.
- Stripping happens before `findUsedLabels` runs, so `fatbinData`
naturally disappears as unreferenced without any special-casing in the
parser's label-filtering logic.
- Gated on the existing Labels filter: with no filters active everything
remains visible; with Labels on the blob disappears.

## Testing

**New compiler unit tests** (`test/compilers/nvcc-tests.ts`):
- Strips `#APP`/`#NO_APP` blocks containing `.nv_fatbin`
- Preserves `#APP`/`#NO_APP` blocks without `.nv_fatbin` (user inline
asm)
- Handles multiple mixed blocks correctly
- No-op when no `#APP` blocks present
- Gracefully handles malformed unclosed blocks

**New parser filter-case**
(`test/filters-cases/nvcc-x86-host-example.asm`): representative NVCC
12.0 host assembly (real 15-line fat binary, boilerplate functions,
`.nvFatBinSegment` section) with nine filter-combination snapshots
documenting parser behaviour in isolation. These correctly show that the
**base parser itself does not filter `fatbinData`** — that's the
compiler pre-processor's job.

All 767 tests pass.

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-02-22 19:46:36 -06:00
Matt Godbolt
53c7dd328b Configure Biome import organiser with grouped imports (#8431)
Enable Biome's `organizeImports` with groups matching the original
ESLint `import/order` configuration:

1. **Node builtins** (`node:fs`, `path`, etc.)
2. *(blank line)*
3. **Third-party packages** (`express`, `@sentry/node`, etc.)
4. *(blank line)*
5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases)

This resolves the inconsistency where Biome wasn't enforcing import
grouping, meaning new files would lose the blank-line separation that
the old ESLint config enforced.

### Impact
- **354 files** updated out of 738 checked (~48%)
- **+188 / -240 lines** (net -52) — almost entirely single blank line
additions/removals between import groups
- No import reordering; purely group separator consistency

Fixes #7373

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-01 20:50:46 -06:00
Ofek
00ee2fc8b0 Initial support for binary/binary-obj in msvc (#8165) 2025-10-06 18:00:53 +03:00
Matt Godbolt
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
narpfel
6f128e4b97 Add missing awaits in Rust argument parser tests (#7862)
Resolves #7826.
2025-06-29 12:47:52 +00: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
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
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Partouf
42607b4afa add test for msvc charset args 2024-12-16 16:02:04 +01:00
Ofek
c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Ofek
2df8d32758 Tsify #6 (#6941)
Another tsification batch. 347 to go and I'm running out of easy fixes
:(
2024-10-22 21:41:44 +03:00
Ofek
05dfb2034e tsify argument-parsers.ts (#6929)
470 ts violations to go.
2024-10-07 22:24:18 +03:00
Patrick Quist
43323b7b6c fix part of the windows tests (#6351) 2024-04-15 03:57:24 +02:00
Matt Godbolt
fd3dd917f5 Vitest (#6219)
Port to vitest. Port everything to typescript. Remove chai, mocha and
chai-as-promised. Adds some docs.
2024-03-08 22:25:09 -06:00
David Spickett
971889e5d7 LLVM TableGen: Add actions to Overrides menu (#5699) 2023-11-04 20:54:43 +01:00
Jeremy Rifkin
10851a1dda LLVM IR pane improvements (#5078)
This PR will add filtering and other output options to the LLVM IR pane


![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/ffc865ea-b3fa-441f-b501-4ec4b68e261f)

![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/936be326-b55e-40cd-ba47-22b121c1acfb)


Closes #5062
Related to #5045
2023-06-11 17:00:53 -04:00
Patrick Quist
079d495757 Compiler overrides (#5001) 2023-05-16 03:53:57 +02:00
Mats Jun Larsen
633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Matt Godbolt
49d9a24552 Fix up hoom_home for interpreting (#4651) 2023-01-29 16:46:18 -06:00
Fábio de Souza Villaça Medeiros
b3a4d27b07 Fix module loading in Hook compiler (#4639) 2023-01-28 17:25:08 +01:00
Fábio de Souza Villaça Medeiros
d9cd9e0301 Ignore trim filter for Hook (#4604) 2023-01-20 11:29:07 +01:00
Fábio de Souza Villaça Medeiros
b94325e3d2 Add Line Mapping Support to Hook (#4580) 2023-01-13 17:25:35 +01:00
Matt Godbolt
f2c1e0bd31 The Grand Reformat (#3643)
* The Grand Reformat

- everything made prettier...literally
- some tweaks to include a few more files, including documentation
- minor changes to format style
- some tiny `// prettier-ignore` changes to keep a few things the way we like them
- a couple of super minor tweaks to embedded document types to ensure they format correctly
2022-05-09 23:13:50 -05:00
Matt Godbolt
ca017bac31 Add support for heterogeneous compute (#2836)
* Extract device code from assembly files.

This commit by itself does not actually add any viewing panes for the
extracted device code, nor does it provide any means to provide
device-specific postprocessing steps.

* Add a rudimentary device view.

This doesn't handle multiple device outputs correctly at the moment, and
it provides no opportunity to view device code differently from
non-device code for now.

* Lint issues

* Some more WIP getting it working.

* Add device extraction code

* More fixes, and keep state

Co-authored-by: Joshua Cranmer <joshua.cranmer@intel.com>
Co-authored-by: Patrick Quist <partouf@gmail.com>
2021-08-14 12:53:22 -05:00
Matt Godbolt
f68198af9e Reassign copyright to Compiler Explorer Authors (#2233) 2020-09-26 17:50:40 -05:00
Austin Morton
044dcfbf88 Use ES6 Modules (#2132) 2020-09-26 16:59:26 -04:00
Rubén Rincón Blanco
ccff4b9ee5 Add new eslint rules (#2121)
The largest changes here are:
- enforcing single quotes for strings
- enforcing trailing commas where possible

In addition to those we have enabled several eslint plugins:
- plugin:requirejs/recommended, to enforce some conventions in require statements
- plugin:node/recommended, to enforce correct usage of various node.js APIs
- plugin:unicorn/recommended, which contains a pretty mixed bag of useful rules

This PR attempts to not change code behavior when possible.  In cases where fixing
existing code would change semantics, a linting exclusion has been placed in the 
code base to silence the error.  You can find these by searching for `eslint-disable-next-line`.

Co-authored-by: Austin Morton <austinpmorton@gmail.com>
2020-08-04 16:39:02 -04:00
Austin Morton
cadbdf59ff Switch to p-queue package, implement compilationEnvTimeoutMs, and improve temp cleanup logging (#1877)
These changes are an attempt to help diagnose a queue halting issue that decreases parallelism and prevents temp dir cleanup.

see #1875
2020-03-07 01:50:49 -05:00
Austin Morton
1b7fe24990 Perform some general maintenance on the test suite (#1840) 2020-02-18 00:03:15 -05:00
Matt Godbolt
03a3fb3bda Argument parser asyncs 2020-01-14 22:37:58 -06:00
Austin Morton
bf23550d9e Allow caching of compiler version and argument information to improve startup time 2019-05-29 04:18:19 -04:00
asynts
661acfcdef oops, extending the existing test instead 2019-02-19 23:33:11 +01:00
asynts
0e16f4fc25 updating the test name 2019-02-19 21:43:27 +01:00
asynts
ec211707dd adding tests for c440b50d, ...
* test that "-fno-crash-diagnostics" is added when supported
* and also check for "-fcolor-diagnostics" since it's basically the same
2019-02-19 21:40:25 +01:00
Partouf
16bae63b33 bugfix arguments with assignment 2019-01-12 22:10:00 +01:00
Partouf
064ded5f56 unittest for CompilerArguments + able to exclude certain arguments 2019-01-12 21:42:00 +01:00
Partouf
96e8d722fb fix unittests, add VC argument parser, refactoring 2018-11-10 01:05:11 +01:00
Rubén
1a33902997 Merge compilerProps functions to a general case one (#956)
* Merge both compilerProps functions to general case

* Move compilerProps to lib/properties.js

It's now its own class, which takes a languages object + the ceProps
function to calMove compilerProps to lib/properties.js

* Add compilerProps behvaiour tests

* Add unknown language test
2018-06-19 10:09:44 +02:00
RabsRincon
968ce50f67 Add superfluous base argument parser test 2018-04-07 17:51:51 +02:00
RabsRincon
e3de4914ef Fix #892 2018-04-03 13:49:01 +02:00
RabsRincon
6ef87b5ef9 Fix copyright dates and normalize text 2018-02-27 14:58:21 +01:00
RabsRincon
9cb7251750 ES6fy CompilationEnv. Fixed some tests cornercases 2018-01-18 20:22:22 +01:00
RabsRincon
d493dfb7cc Format code 2018-01-18 19:46:02 +01:00
RabsRincon
a54faefb4c ES6fy compilers inheritance 2018-01-18 19:43:10 +01:00
partouf
e1202905ef set defaults in Compile class, test with actual Compile class, only test what should be changed from the default 2018-01-03 23:19:25 +01:00
partouf
ae1780f442 testcase and fix for #738 2018-01-03 22:47:45 +01:00
RabsRincon
fc75208dac New year, new date 2018-01-01 16:44:04 +01:00
Matt Godbolt
6e7e30bf49 Parse out colourisation options and default them on. Add tests. See #687 2017-12-19 10:15:28 -06:00