Skip to content

ILGPU v2.0: AOT + Cross-Platform Native SDK Support#1578

Open
m4rs-mt wants to merge 30 commits into
masterfrom
new_compiler_bindings
Open

ILGPU v2.0: AOT + Cross-Platform Native SDK Support#1578
m4rs-mt wants to merge 30 commits into
masterfrom
new_compiler_bindings

Conversation

@m4rs-mt
Copy link
Copy Markdown
Owner

@m4rs-mt m4rs-mt commented Apr 19, 2026

This PR introduces the bridge between the new AOT compiler and the vendor-specific native toolchains (CUDA's nvcc, Apple's metal, AMD's hipcc, Intel's ocloc, clang), plus a remote compilation service that exposes the compiler over HTTP so CI jobs and developers without local GPU toolchains can offload PTX/Metal-IR/HIP generation.

This PR is intentionally kept small: Docker images, test suite, CI redesign, and samples all land in the follow-up PRs so that reviewers of this PR can focus on the backend-infrastructure code itself.

The first two commits are PR placeholders (for the runtime-library PR and the AOT-compiler PR); once those land on master they collapse into real merge commits.

A note on authorship - AI warning

Some bits of the compiler-service work in this PR was done with AI-assistant pair programming (Claude via Claude Code).

What's in this PR

Native compiler bindings (Src/ILGPUC.Compilers/, 17 files)

Thin managed wrappers around the vendor toolchains. Each wrapper handles tool discovery, argument construction, subprocess invocation, and result parsing so ILGPUC can invoke them with a uniform API:

  • MetalCompiler — wraps Apple's xcrun metal.
  • NvccCompiler — wraps NVIDIA's nvcc.
  • HipccCompiler — wraps AMD's hipcc.
  • OclocCompiler — wraps Intel's OpenCL offline compiler.
  • ClangOpenCLCompiler — wraps clang -x cl for OpenCL-on-anything fallback.

Around them: CompilerBase, CompilerManager, CompilerOptions, CompileRequest, CompilationResult, CompilationTarget, CompilationCapabilities, ICompiler, ICompilerManager, OutputType, ToolchainComponent.

Remote compilation service (Src/ILGPUC.CompilerService/, 16 files)

An ASP.NET Core service that exposes the compiler over HTTP:

  • Program.cs — host bootstrap and service wiring.
  • ControllersCompileController (fire-and-forget compile), JobsController (async compile queue), CapabilitiesController (report which backends this host supports), StatusController (health / readiness), BaseApiController.
  • JobsCompilationJob, IJobQueue, JobQueue for async queued compilation.
  • CachingCompilationCache, ICache so identical kernels don't get recompiled across requests.
  • ModelsJobEnqueueResponse, StatusResponse, ErrorResponse DTOs.
  • appsettings.json — default configuration.

CompilerService tests (Src/ILGPUC.CompilerService.Tests/, 11 files)

Integration-level coverage for every endpoint:

  • FixturesMockServiceFixture spins up the service in-process for xUnit; Mocks/MockCompilerManager lets tests run without the actual native toolchains installed.
  • Endpoint testsCompileEndpointTests, JobEndpointTests, StatusEndpointTests, CapabilitiesEndpointTests, CompileErrorTests.
  • Scenario testsCachingTests (cache hit/miss behaviour), RemoteCompilerIntegrationTests (full round-trip through the async job queue).
  • ILGPUC.CompilerService.Tests.csproj, GlobalUsings.cs.

Solution and shared-config wiring

  • Src/ILGPU.sln registers the three new projects (ILGPUC.Compilers, ILGPUC.CompilerService, ILGPUC.CompilerService.Tests).
  • Src/.editorconfig, Src/Directory.Build.props, global.json, .gitignore are synchronized with the ILGPUC tooling target framework.

Scope boundary

No changes to Src/docker/, Src/scripts/, any GitHub workflow file, Src/ILGPUC.Tests/, .gitmodules, Src/CLAUDE.md, or Samples/. Those land in follow-up PRs.

Depends on

PR #1577

Fixes

Closes #1542.

m4rs-mt and others added 30 commits December 15, 2025 19:16
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…ry point.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…obEnqueueResponse) (part 1/2).

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…(part 1/2).

Co-Authored-By: Claude <noreply@anthropic.com>
…(part 2/2).

Co-Authored-By: Claude <noreply@anthropic.com>
…l usings.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…tests (part 1/2).

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…ration tests (part 1/2).

Co-Authored-By: Claude <noreply@anthropic.com>
…ration tests (part 2/2).

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
… framework.

Co-Authored-By: Claude <noreply@anthropic.com>
…and ILGPUC.Tests projects in the solution file.

Co-Authored-By: Claude <noreply@anthropic.com>
…ation.

Co-Authored-By: Claude <noreply@anthropic.com>
@m4rs-mt m4rs-mt added this to the v2.0 milestone Apr 19, 2026
m4rs-mt added a commit that referenced this pull request Apr 19, 2026
@m4rs-mt m4rs-mt force-pushed the new_compiler_bindings branch from a5c17ef to 7dfa449 Compare April 19, 2026 23:54
m4rs-mt added a commit that referenced this pull request Apr 20, 2026
m4rs-mt added a commit that referenced this pull request Apr 20, 2026
m4rs-mt added a commit that referenced this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QUESTION]: Is it available to compile a Dynamic Method with ILGPU?

1 participant