Skip to content

v0.3.2

Latest

Choose a tag to compare

@lucialuka lucialuka released this 28 Nov 14:57
· 3 commits to main since this release
  ▐▓▓▓   ▐▓▓▓▓▓▓▄  ▐▓▓▓▓▓  ▐▓▓▓▓▄     ▐▓▓▓    ▐▓▓▓▓▓▓  ▐▓▓▓▓▓▓  ▐▓▓▓▓▓  ▐▓▓▓▓▓▓▓▓▄  ▐▓▓▓▓▓   ▐▓▓       ▐▓▓▓▓▓  ▐▓▓▓▓▓▓▄        ▐▓▓▓        ▐▓▓▓▓▓       ▐▓▓▓▓▓ 
 ▐▓▓▐▓▓  ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓ ▐▓▓   ▐▓▓▐▓▓  ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓  ▐▓▓      ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓       ▐▓▓▐▓▓      ▐▓▓  ▐▓▓     ▐▓▓  ▐▓▓
▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓      ▐▓▓  ▐▓▓      ▐▓▓  ▐▓▓          ▐▓▓     ▐▓▓  ▐▓▓
▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓      ▐▓▓  ▐▓▓      ▐▓▓▓ ▐▓▓          ▐▓▓     ▐▓▓  ▐▓▓
▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓      ▐▓▓      ▐▓▓ ▐▓▓ ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓      ▐▓▓      ▐▓▓  ▐▓▓      ▐▓▓▐▓▐▓▓          ▐▓▓          ▐▓▓
▐▓▓  ▐▓▓ ▐▓▓▓▓▓▓▀ ▐▓▓▓▓▓   ▐▓▓  ▐▓▓ ▐▓▓▓▓▓▓▓  ▐▓▓▓▓▓   ▐▓▓▓▓▓  ▐▓▓▓▓▓   ▐▓▓     ▐▓▓ ▐▓▓▐▓▓▓  ▐▓▓      ▐▓▓▓▓▓   ▐▓▓▓▓▓▓▀      ▐▓▓ ▐▓▓▓       ▐▓▓▓▓▓      ▐▓▓▓▓▓ 
▐▒▒  ▐▒▒ ▐▒▒      ▐▒▒      ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒      ▐▒▒      ▐▒▒ ▐▒▒      ▐▒▒     ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒      ▐▒▒      ▐▒▒  ▐▒▒      ▐▒▒  ▐▒▒          ▐▒▒     ▐▒▒     
▐░░  ▐░░ ▐░░      ▐░░      ▐░░  ▐░░ ▐░░  ▐░░ ▐░░  ▐░░ ▐░░  ▐░░ ▐░░      ▐░░     ▐░░ ▐░░  ▐░░ ▐░░      ▐░░      ▐░░  ▐░░      ▐░░  ▐░░          ▐░░     ▐░░  ▐░░
▐░░  ▐░░ ▐░░      ▐░░      ▐░░  ▐░░ ▐░░  ▐░░ ▐░░  ▐░░ ▐░░  ▐░░ ▐░░      ▐░░     ▐░░ ▐░░  ▐░░ ▐░░      ▐░░      ▐░░  ▐░░      ▐░░  ▐░░          ▐░░     ▐░░  ▐░░
 ▐▒▒▐▒▒  ▐▒▒      ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒     ▐▒▒ ▐▒▒ ▐▒▒  ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒ ▐▒▒  ▐▒▒       ▐▒▒▐▒▒      ▐▒▒  ▐▒▒     ▐▒▒  ▐▒▒
  ▐▓▓▓   ▐▓▓       ▐▓▓▓▓▓  ▐▓▓  ▐▓▓ ▐▓▓  ▐▓▓ ▐▓▓▓▓▓▓  ▐▓▓▓▓▓▓   ▐▓▓▓▓▓  ▐▓▓     ▐▓▓ ▐▓▓▓▒▒    ▐▓▓▓▓▓   ▐▓▓▓▓▓  ▐▓▓  ▐▓▓        ▐▓▓▓   ▐▓▓  ▐▓▓▓▓▓  ▐▓▓ ▐▓▓▓▓▓▓▓

OpenAssembler (refer to as 'OA') Updates Highlights

  • PTX entry discovery accepts bare, weak, and directive-prefixed entries, and it rejects inputs it cannot parse instead of dropping them.
  • Launch directives in PTX are enforced at launch time.
  • Two more exact FP16 GEMM shapes use a faster measured policy on A100.
  • Python model capture and training route through OpenAssembler's own kernels.

Compilation

PTX entry parsing uses a scanner that skips strings and comments, balances parameter lists, and separates prototypes from definitions. Bare .entry, .weak .entry, and entries with .maxntid before the body are now found. A mixed module compiles every entry it defines.

Standalone .cu sources can get __global__ from a local header. The static discovery pass follows quoted local includes, capped at 128 files and 8 MiB per source. It does not run the preprocessor. nvcc remains the authority, so a source that includes an unused qualifier can still be selected, and the build then fails if it produces no kernel.

OpenAssembler Architecture

Python model capture

Model capture traces a CPU nn.Module with torch.fx, then lowers each node to an OpenAssembler step. Each step names an OA kernel. The capture does not depend on Inductor or on vendor GPU kernels.

 nn.Module + example inputs (CPU; FP32, int64 index, or bool mask)
        │
        ▼
 deepcopy (the caller's model is not modified)
        │
        ▼
 torch.fx trace ──► node outside the operation list? reject, naming the source line
        │
        ▼
 ShapeProp: one CPU forward pass; verify weights and buffers are unchanged
        │
        ▼
 lower each node to OA steps (linear, conv2d, bmm, layernorm, softmax, ...)
        │
        ▼
 reverse the forward steps to build the backward pass,
 with explicit gradient sums where values are reused
        │
        ▼  optional: append_training (MSE loss, backward, SGD update)
        │
        ▼
 plan.json + weights.json (raw FP32) + native cubins
        │
        ▼
 run: OA kernels only; the model is not recaptured

Math modes:

  • fp32 (default): storage, arithmetic, and gradients are FP32.
  • f16_rne_f32_accum: each matrix product rounds its operands to FP16 with round-to-nearest-even. Storage, accumulation, and gradients stay FP32.

Runtime and CLI

Transport selection uses the same four forms everywhere it applies:

 openassembler run | cnr | compile
        │
        ▼
 transport: local | modal | user@host | ssh --host HOST
        │
        ▼
 runner: validates launch spec and budgets before submission
        │
        ▼
 GPU worker ──► CUDA driver loads the OA-owned cubin
        │
        ▼
 run.json + runs/*.json (output checks, smoke conditions, timing)

New or changed command behavior:

  • inspect --json prints the full coverage inventory.
  • run --verify-application checks a native model replay against its CPU reference, including outputs, gradients, parameters, and workspace guards.
  • gemm --autotune local|modal times admitted policies on an A100 and writes the result to --tuning-record. A policy replaces the reference only if it is at least 2% faster in every paired round.
  • --backend for gpu run accepts local, modal, or user@host. It does not accept ssh.

GEMM dispatch

 gemm --m --n --k --dtype f16|bf16
        │
        ├── explicit knobs, or --dispatch manual
        │       └──► the requested plan, reproducible as written
        │
        └── --dispatch auto (default)
                │
                ├── exact match in the installed table (44 contracts)?
                │       yes ──► measured policy
                │       no  ──► baseline tile (128x128 when M and N are
                │               multiples of 128, otherwise 64x64)
                │
                └── --autotune local|modal ──► compile, check, and time admitted policies

Automatic dispatch uses only exact recorded contracts. It does not extend a result to neighboring shapes.

Rowwise softmax and layernorm now have five exact contracts that select two or eight warps per CTA. --warps-per-cta overrides them.

Performance (A100-SXM4-80GB)

Two FP16 GEMM contracts are admitted with tile64_reuse_direct_early:

M×N×K Speedup over OA's previous baseline
128×512×1024 2.37 to 2.40×
256×768×1024 2.38 to 2.40×

The installed table now has 44 contracts: 36 tuned policies and 8 baseline retentions. The 1024×1024×1024 shape keeps its previous policy, because the alternative was not reliably 2% faster.

These numbers compare against OA's earlier kernel. They do not compare against cuBLAS or ptxas, and they do not measure end-to-end model training. The runner records no Nsight counters, so the gain cannot be assigned to a single cause.

Behavior changes

  • A PTX file with a header that cannot be parsed now fails the build. Earlier builds could drop the entry silently.
  • Kernels with unsupported parameter ABIs fail before code generation.
  • A kernel that needs more registers than .maxnreg allows now fails. Earlier builds did not check this.
  • --application and --app-arg are rejected. Their replacement is --verify-application for model bundles.
  • --fallback ptxas is rejected. Unsupported kernels must be implemented in OA.
  • --frontend triton and --frontend inductor are rejected.

Limitations

  • Standalone kernel parameters must be scalar 32- or 64-bit integer, bit, or floating-point values.
  • Model capture supports only the listed operations. For example, Dropout fails capture.
  • Model capture requires FP32 parameters and buffers on CPU.
  • Include discovery does not evaluate #if conditions, system include paths, or command-line macros. Use --compile-commands or --nvcc-flag when those matter.
  • Directive values for CTA residency are hints. OA does not promise the occupancy or register allocation that ptxas chooses.