Skip to content

Commit

Permalink
Update calculator files, add calculator generated files to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
shkoo committed Dec 19, 2024
1 parent 68ce664 commit 659e82e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
check-generated-zirgen:
runs-on: [self-hosted, prod, Linux, cpu]
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [Linux]
env:
Expand All @@ -59,10 +59,13 @@ jobs:
- uses: risc0/risc0/.github/actions/sccache@1a373c71585766e4f6985b96c48389daaf69d528
with:
key: ${{ matrix.os }}-bootstrap
- name: fib generated files up to date
run: cargo bootstrap -- --check fib
# TODO: check generated fib files once they generate properly
# - name: fib generated files up to date
# run: cargo bootstrap -- --check fib
# continue-on-error: true
- name: calculator generated files up to date
run: cargo bootstrap -- --check calculator
continue-on-error: true

bazel:
runs-on: [self-hosted, prod, cpu, "${{ matrix.os }}"]
Expand Down
1 change: 0 additions & 1 deletion zirgen/bootstrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ impl Bootstrap {
self.output_or("zirgen/dsl/examples/calculator"),
&[Rule::copy("*.inc", ""), Rule::copy("*.rs", "")],
);
cargo_fmt_circuit("calculator", &self.args.output, &None);
}

fn copy_edsl_style(&'static self, circuit: &str, src_dir: &str) {
Expand Down
6 changes: 6 additions & 0 deletions zirgen/dsl/examples/calculator/defs.cu.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SET_FIELD(BabyBear);
constexpr size_t kRegCountAccum = 1;
constexpr size_t kRegCountCode = 1;
constexpr size_t kRegCountData = 7;
constexpr size_t kRegCountGlobal = 4;
constexpr size_t kRegCountMix = 4;
13 changes: 13 additions & 0 deletions zirgen/dsl/examples/calculator/layout.cu.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__device__ constexpr TopLayout kLayout_Top = TopLayout{
.op = NondetRegLayout{._super = /*offset=*/0},
.arg1 = NondetRegLayout{._super = /*offset=*/1},
.arg2 = NondetRegLayout{._super = /*offset=*/2},
.expected = NondetRegLayout{._super = /*offset=*/3},
._0 = OneHotLayout{._super =
NondetRegLayout2LayoutArray{NondetRegLayout{._super = /*offset=*/4},
NondetRegLayout{._super = /*offset=*/5}}},
.result = TopResultLayout{._super = NondetRegLayout{._super = /*offset=*/6},
.arm0 = NondetRegLayout{._super = /*offset=*/6},
.arm1 = NondetRegLayout{._super = /*offset=*/6}}};
__device__ constexpr _globalLayout kLayoutGlobal =
_globalLayout{.result = NondetRegLayout{._super = /*offset=*/0}};
33 changes: 33 additions & 0 deletions zirgen/dsl/examples/calculator/types.cuh.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
struct NondetRegLayout {
Reg _super;
};
using NondetRegLayout2LayoutArray = ::cuda::std::array<NondetRegLayout,2>;
struct OneHotLayout {
NondetRegLayout2LayoutArray _super;
};
struct TopResultLayout {
NondetRegLayout _super;
NondetRegLayout arm0;
NondetRegLayout arm1;
};
struct TopLayout {
NondetRegLayout op;
NondetRegLayout arg1;
NondetRegLayout arg2;
NondetRegLayout expected;
OneHotLayout _0;
TopResultLayout result;
};
struct _globalLayout {
NondetRegLayout result;
};
struct NondetRegStruct {
Val _super;
};
using Val2Array = ::cuda::std::array<Val,2>;
using NondetRegStruct2Array = ::cuda::std::array<NondetRegStruct,2>;
struct OneHotStruct {
NondetRegStruct2Array _super;
};
struct TopStruct {
};

0 comments on commit 659e82e

Please sign in to comment.