for https://github.com/compiler-explorer/compiler-explorer/issues/2331
Hey, so I am currently trying to improve the SPIR-V ecosystem, in-charge
of the [SPIR-V Guide](https://github.com/KhronosGroup/SPIRV-Guide), and
part of the SPIR-V Working Group. We talked at our last Face-2-Face
gathering about getting more support for GPU tooling in something like
Compiler Explorer because you have all made this such an amazing tool!
I have enjoyed working in this codebase and happy to help keep improving
the SPIR-V as people find issues or want enhancements (I was already
about to spend time rebuilding Compiler Explorer, so happy to donate my
time to a single tool's effort)
(For those who haven't spent last few years staring at SPIR-V)
- SPIR-V is a an IR (very much like LLVM IR) but for GPUs
- SPIR-V can be used for Graphics and Compute
- Compute:
- Can be tied to things like clang, llvm, mlir, OpenCL, etc
- One could take `spirv` as a language and compile it to something like
x86
- (Future PRs for this realm of things)
- Graphics:
- Much harder to actually "compile" to any ISA because other graphics
pipeline information is missing that will effect the final ISA
- Microsoft has even now planned to move to [SPIR-V for DirectX
soon](https://devblogs.microsoft.com/directx/directx-adopting-spir-v/)
- Both:
- There are many tools that run on SPIR-V regardless (hence why they
share the same IR)
- Being able to do tooling in compiler explorer would be AMAZING
This PR adds `SPIR-V` as a language and a new `SPIRV-Tools` compiler as
an initial compiler for it the language (since we already have the
SPIRV-Tools repo being pulled in on the infra side!)
I personally use `spirv-opt` and `spirv-val` the most and have been
testing this locally for a few days and feel it is ready to go. I plan
to slowly add more tools (ex. `spirv-fuzz`, `spirv-cross`,
`spirv-reflect`, etc)
Cheers!
(some screenshots of course)


This includes among others:
- Proper tsification of various tools code,
- Elimination of the `CompilationInfo2` type,
- Use of `CompilationInfo` instead of `Record<any, any>` in some places
- These lines in CompilationResult:
```
// Temp hack until we get all code to agree on type of asm
asm?: ResultLine[] | string;
```
The next task would be to get all code to agree on the type of
CompilationResult.asm, thereby enabling fixing of most the remaining
TSification.
Hi dear godbolt team,
> Before opening the PR, please make sure that the tests & linter pass
their checks,
> by running `make check`.
With this pr i added support for the ylc compiler.
Infra-PR: https://github.com/compiler-explorer/infra/pull/1441
Godbolt caches the compiler instance so that the version string won't be
recalculated if there's an update to the compiler image.
Do not cache that information, instead reevaluate them whenever we do
the compilation.
After this PR, compilers will be invoked directly instead of relying on
the built-in `dotnet build` command which involves restore and many
other expensive resolution operations.
This should speed up the compilation process a lot.
Still mostly mindless numb work, one rename that touched many files
(`getArgumentParser` -> `getArgumentParserCls`), and a few real
improvements.
The goal is to be able to turn on `noImplicitAny` for the project, to
enforce higher code quality. 600 violations to go.
Supersedes #6842
- We now have the upstream issue of `JitDisasmAssemblies` fixed. Enable
it for net9.0+.
- Update asm-parser to support CoreCLR and NativeAOT (Fixes#6833)
- Adding support for IL language
- Adding support for IL disassembler
- Fixes#6629
Currently the clangir compiler is implemented by a special clang variant
whose compilation options list gets appended with `-Xclang -fclangir
-Xclang -emit-cir`. This introduces a problem: we no longer gets access
to its LLVM IR output and assembly output because `-emit-cir` is an
exclusive option.
This patch resolves this problem by introducing a new ClangIR pane,
similar to the LLVM IR pane or Rust MIR pane. A new output kind named
`ClangIR` is added to the "Add new..." drop down menu and it toggles the
ClangIR pane. This patch then removes `-Xclang -emit-cir` from the
options list of the clangir compiler. The clangir compiler will then
output assembly code just like other clang compilers. The removed
options will be added back when compiled from the ClangIR pane.
Adding support for mono and NativeAOT.
As for NativeAOT, we have some upstream issues need to be resolved
before we can use `JitDisasmAssemblies` to print disasm for the
specified assembly only, where it would fail with:
```
Unhandled exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]<Module>..cctor()'
---> System.NotImplementedException: getClassModule
at Internal.JitInterface.CorInfoImpl.getClassModule(CORINFO_CLASS_STRUCT_*) + 0x2b
at Internal.JitInterface.CorInfoImpl._getClassModule(IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*) + 0x39
--- End of inner exception stack trace ---
at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x273
at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x63
at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0x97
at ILCompiler.RyuJitCompilation.CompileSingleThreaded(List`1) + 0xee
at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1) + 0x173
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x159
at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x26
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x5d
at ILCompiler.Program.Run() + 0x2a55
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult) + 0x6f
```
For now, workaround with removing `JitDisasmAssemblies` and print disasm
for all assemblies instead. (see the second commit)
/cc: @MichalStrehovsky We need to implement `getClassModule`,
`getModuleAssembly` and `getAssemblyName` in ilc to make
`JitDisasmAssemblies` work correctly.
Closes#5668
R8 is a whole-program optimizer that converts Java byte code to
optimized dex code. It can be run with the same general steps (and JAR)
as the existing D8 compiler.
This change adds R8Compiler and the R8 keep-annotation library it relies
on, makes this lib + Android API stubs default libraries for Android
Java/Kotlin, and includes a small update to allow older versions of
dex2oat (33.10) to run.
https://r8.googlesource.com/r8
This change moves the dex2oat profiles for Android Java and Kotlin from
the inline comments (included as part of the default code example) to
being included as a separate file. Templates have been added for this.
Depends on https://github.com/compiler-explorer/infra/pull/1312.
I'm considering to unify all old compiler versions per dotnet minor
version as patch upgrade in dotnet doesn't change the codegen. New patch
versions come with quality updates like bug and security fixes, we only
need the latest version per minor dotnet version instead. Here a version
is consisting of `major.minor.patch`, such as `7.0.3` and `8.0.5`.
i.e.
- `dotnet6030csharp:dotnet6018csharp:dotnet6014csharp:dotnet6011csharp`
-> `dotnet60csharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030fsharp:dotnet6018fsharp:dotnet6014fsharp:dotnet6011fsharp`
-> `dotnet60fsharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030vb:dotnet6018vb:dotnet6014vb:dotnet6011vb` -> `dotnet60vb`,
and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`, `6.0.14` and
`6.0.11` are all `6.0`
- `dotnet7019csharp:dotnet707csharp:dotnet703csharp:dotnet701csharp` ->
`dotnet70csharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019fsharp:dotnet707fsharp:dotnet703fsharp:dotnet701fsharp` ->
`dotnet70fsharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019vb:dotnet707vb:dotnet703vb:dotnet701vb` -> `dotnet70vb`,
and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`, `7.0.3` and `7.0.1`
are all `7.0`
I'm keeping the minor version (ie. `.0`) in the name as there may be
updates like `.NET Core 3.1` to `.NET Core 3.0` which does change the
codegen.
The compiler structure now is:
```
group: dotnetcoreclr
.NET (main)
.NET 8
.NET 7
group: dotnetcrossgen2
.NET (main)
.NET 8
.NET 7
.NET 6
group: dotnetlegacy
existing compilers for backward compact
```
---------
Co-authored-by: Patrick Quist <partouf@gmail.com>
<!-- 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!
-->