feat: Export Rust structs representing the trace layout
- Lenguaje dominante
- Rust
- Estrellas
- 96
- Forks
- 39
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
While AirScript provides a simple interface for defining constraints that can be reused in various contexts, it lacks the ability to define a witness generator for filling the trace. This often usually required a hand-made implementation since the trace Is derived from structured data (e.g. a processor trace), and can be optimized for better performance.
In parallel, we are exploring in the VM the benefits of treating the trace as a row-major matrix for better memory access patterns when filling each row (either followed by a transposition for use with Winterfell, but also aligned with plonky3's architecture).
Concretely, it would be practical for AirScript to generate the following type of trace description
```rust
struct Trace {
col_name_0: T,
col_name_1: T,
// ...
}
```
This would ensure consistency between witness generation and trace layout, but can also be enhanced by implementing the `Borrow{Mut}` that allow casting from a slice to the trace structure
```rust
let trace_row: &[T] = ...;
let trace: &mut Trace = trace_row.borrow_mut();
// Fill witness for the row by modifying `trace`
```
The implementation of this trait can be found in many plonky3 chips (e.g. [keccak-air](https://github.com/Plonky3/Plonky3/blob/f77e399ebec3791e8a2c314bfef2734b9b3898df/keccak-air/src/columns.rs#L128-L148)).
Guía de contribución
Línea de trabajo
El issue trata sobre generar structs de Rust a partir de definiciones de AirScript para representar diseños de trazas. Examine el código base existente de AirScript para ver cómo genera actualmente las restricciones. Examine el archivo columns.rs de keccak-air enlazado en Plonky3 para ver un ejemplo del struct deseado y la implementación de BorrowMut. El trabajo implica modificar la generación de código del compilador de AirScript para producir estos structs. Una prueba implicaría definir un programa simple de AirScript y verificar que el código Rust generado se compile y pueda usarse como se describe.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100