chomsky-context 0.0.1

Context and environment management for Chomsky framework
Documentation
  • Coverage
  • 71.43%
    5 out of 7 items documented0 out of 6 items with examples
  • Size
  • Source code size: 14.88 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.65 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 32s Average build duration of successful builds.
  • all releases: 34s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fqq

chomsky-context

Context and environment management for the Chomsky framework.

Overview

chomsky-context handles the injection and management of execution contexts within the chomsky-uir E-Graph. It allows the compiler to explicitly reason about where and how a program fragment will run (e.g., on a GPU, asynchronously, or within a specific memory model).

Features

  • Context Injection: Utilities to wrap program fragments with specific contexts (WithContext).
  • Standard Contexts: First-class support for common contexts:
    • GPU: For data-parallel kernels.
    • CPU: For general-purpose execution.
    • Async: For non-blocking/concurrent tasks.
    • Spatial: For hardware-aware layout or placement.
  • E-Graph Aware: Designed to work directly with E-Graph Ids, facilitating seamless integration into the optimization pipeline.

Core Concepts

ContextInjector

A utility class providing static methods to inject context nodes into an E-Graph. It automatically adds the necessary Context node and wraps the target Id with a WithContext operator.

Usage

use chomsky_context::ContextInjector;
use chomsky_uir::EGraph;

let mut egraph = EGraph::new();
let my_code_id = egraph.add(/* ... */);

// Explicitly mark this fragment as running on GPU
let gpu_code_id = ContextInjector::inject_gpu(&egraph, my_code_id);