Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generated layout to determine location of registers in rv32im circuit #476

Merged
merged 2 commits into from
Apr 5, 2023

Conversation

shkoo
Copy link
Contributor

@shkoo shkoo commented Mar 28, 2023

  • Refactor layout to minimize duplicate code between risczero/rv32im
  • Add a buffer pretty-printer to dump a buffer based on a layout
  • rv32im-verify no longer has a brittle dependency on the specific layout of the "out" buffer

@shkoo shkoo force-pushed the nils/rv32im-layout branch 2 times, most recently from 2faa9bb to ed12a7d Compare March 28, 2023 19:54
…cuit

* Refactor layout to minimize duplicate code between risczero/rv32im
* Add a buffer pretty-printer to dump a buffer based on a layout
* rv32im-verify no longer has a brittle dependency on the specific layout of the "out" buffer
@shkoo shkoo marked this pull request as ready for review March 28, 2023 20:54
@shkoo shkoo requested review from flaub and jbruestle March 28, 2023 20:54
@github-actions
Copy link

Benchmark for Linux-cuda b54243f

Click to hide benchmark
Test Base PR %
fib/100/proof 640.5±7.59ms 634.1±18.85ms -1.00%
fib/100/run 293.2±4.69ms 291.1±4.63ms -0.72%
fib/200/proof 652.4±10.88ms 645.7±5.62ms -1.03%
fib/200/run 297.0±5.77ms 296.9±5.23ms -0.03%

Benchmark for Linux-default b54243f

Click to hide benchmark
Test Base PR %
fib/100/proof 2.3±0.02s 2.3±0.02s 0.00%
fib/100/run 335.9±5.09ms 321.1±2.13ms -4.41%
fib/200/proof 2.3±0.01s 2.3±0.01s 0.00%
fib/200/run 337.4±3.43ms 324.7±6.80ms -3.76%

Benchmark for macOS-default b54243f

Click to hide benchmark
Test Base PR %
fib/100/proof 1603.1±20.58ms 1598.5±17.38ms -0.29%
fib/100/run 111.6±0.60ms 111.1±0.63ms -0.45%
fib/200/proof 1600.7±11.57ms 1593.8±7.59ms -0.43%
fib/200/run 113.4±0.37ms 112.8±0.63ms -0.53%

Benchmark for macOS-metal b54243f

Click to hide benchmark
Test Base PR %
fib/100/proof 469.6±7.25ms 466.3±5.38ms -0.70%
fib/100/run 115.8±0.41ms 112.6±0.47ms -2.76%
fib/200/proof 469.0±6.02ms 466.8±3.64ms -0.47%
fib/200/run 114.8±0.63ms 114.7±0.47ms -0.09%

@flaub
Copy link
Member

flaub commented Mar 29, 2023

I was planning to go in the direction of a serde codec that knows how to encode/decode the global structure. At that point, I think zirgen would generate a struct with serde attributes.

Copy link
Member

@flaub flaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might try the serde approach in the future, but I guess this is OK for now.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Benchmark for Linux-cuda 41ad48f

Click to hide benchmark
Test Base PR %
fib/100/proof 867.1±52.96ms 809.9±50.65ms -6.60%
fib/100/run 337.5±11.54ms 334.7±9.81ms -0.83%
fib/200/proof 878.7±40.59ms 827.9±56.19ms -5.78%
fib/200/run 339.4±8.38ms 338.4±8.57ms -0.29%

Benchmark for Linux-default 41ad48f

Click to hide benchmark
Test Base PR %
fib/100/proof 2.3±0.02s 2.3±0.02s 0.00%
fib/100/run 323.2±0.53ms 318.7±7.02ms -1.39%
fib/200/proof 2.3±0.03s 2.3±0.02s 0.00%
fib/200/run 327.4±2.02ms 319.6±2.14ms -2.38%

Benchmark for macOS-default 41ad48f

Click to hide benchmark
Test Base PR %
fib/100/proof 1599.0±8.89ms 1594.8±10.82ms -0.26%
fib/100/run 111.0±0.35ms 110.6±0.68ms -0.36%
fib/200/proof 1602.0±25.99ms 1592.5±6.56ms -0.59%
fib/200/run 112.9±0.35ms 112.5±0.35ms -0.35%

Benchmark for macOS-metal 41ad48f

Click to hide benchmark
Test Base PR %
fib/100/proof 465.0±4.95ms 462.8±3.11ms -0.47%
fib/100/run 113.9±0.28ms 112.5±0.38ms -1.23%
fib/200/proof 468.1±6.21ms 465.8±5.38ms -0.49%
fib/200/run 115.8±0.48ms 114.4±0.72ms -1.21%

@shkoo shkoo enabled auto-merge (squash) April 5, 2023 21:26
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Benchmark for Linux-cuda 19784de

Click to hide benchmark
Test Base PR %
fib/100/proof 781.0±69.94ms 753.6±48.61ms -3.51%
fib/100/run 340.6±11.65ms 321.3±15.70ms -5.67%
fib/200/proof 763.0±24.04ms 761.6±52.47ms -0.18%
fib/200/run 330.6±15.13ms 325.1±14.79ms -1.66%

Benchmark for Linux-default 19784de

Click to hide benchmark
Test Base PR %
fib/100/proof 2.3±0.02s 2.3±0.02s 0.00%
fib/100/run 330.8±5.66ms 328.3±5.80ms -0.76%
fib/200/proof 2.3±0.01s 2.3±0.02s 0.00%
fib/200/run 336.9±6.25ms 334.3±3.83ms -0.77%

Benchmark for macOS-default 19784de

Click to hide benchmark
Test Base PR %
fib/100/proof 1617.5±33.06ms 1593.8±9.45ms -1.47%
fib/100/run 111.2±0.51ms 110.4±0.84ms -0.72%
fib/200/proof 1599.3±7.65ms 1596.4±8.05ms -0.18%
fib/200/run 113.2±0.77ms 111.7±0.50ms -1.33%

Benchmark for macOS-metal 19784de

Click to hide benchmark
Test Base PR %
fib/100/proof 466.1±6.62ms 464.0±4.53ms -0.45%
fib/100/run 113.5±0.84ms 113.4±0.56ms -0.09%
fib/200/proof 469.6±6.16ms 467.2±6.63ms -0.51%
fib/200/run 115.3±0.56ms 115.3±0.56ms 0.00%

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Benchmark for Linux-cuda ded4ab6

Click to hide benchmark
Test Base PR %
fib/100/proof 864.2±57.20ms 845.1±43.42ms -2.21%
fib/100/run 336.9±9.26ms 335.9±7.75ms -0.30%
fib/200/proof 891.0±36.23ms 871.4±44.14ms -2.20%
fib/200/run 338.8±9.98ms 332.7±7.73ms -1.80%

Benchmark for Linux-default ded4ab6

Click to hide benchmark
Test Base PR %
fib/100/proof 2.3±0.03s 2.3±0.02s 0.00%
fib/100/run 330.1±5.55ms 325.6±3.18ms -1.36%
fib/200/proof 2.3±0.01s 2.3±0.02s 0.00%
fib/200/run 332.1±7.71ms 329.9±1.48ms -0.66%

Benchmark for macOS-default ded4ab6

Click to hide benchmark
Test Base PR %
fib/100/proof 1608.2±30.80ms 1597.5±23.86ms -0.67%
fib/100/run 112.8±0.32ms 111.0±0.84ms -1.60%
fib/200/proof 1605.5±33.46ms 1599.4±9.08ms -0.38%
fib/200/run 115.1±0.45ms 112.5±0.55ms -2.26%

Benchmark for macOS-metal ded4ab6

Click to hide benchmark
Test Base PR %
fib/100/proof 467.6±5.32ms 464.3±4.65ms -0.71%
fib/100/run 113.6±0.39ms 113.4±0.35ms -0.18%
fib/200/proof 468.9±7.48ms 466.5±5.80ms -0.51%
fib/200/run 115.4±0.93ms 115.2±0.23ms -0.17%

@shkoo shkoo merged commit 0b7a203 into main Apr 5, 2023
10 checks passed
@shkoo shkoo deleted the nils/rv32im-layout branch April 5, 2023 21:48
@@ -695,7 +695,7 @@ fn pause_continue() {
#[cfg_attr(feature = "insecure_skip_seal", ignore)]
#[cfg_attr(feature = "cuda", serial)]
fn continuation() {
let segment_limit_po2 = 16; // 64k cycles
let segment_limit_po2 = 17; // 128k cycles
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would layout changes require us to bump this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it was related to changes in risczero-wip that hadn't been propagated to risc0 (or vice versa), since it tested fine until I merged in main.

risczero-wip also needed some work to work with the new hash api. :(

I wonder if there's a way to keep risc0 and risczero-wip in sync automatically

@shkoo shkoo restored the nils/rv32im-layout branch April 5, 2023 23:04
@flaub flaub deleted the nils/rv32im-layout branch April 5, 2023 23:50
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.

None yet

2 participants