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

Make MemoryImage::new() failable + bound check #533

Merged
merged 2 commits into from
Apr 25, 2023
Merged

Conversation

mothran
Copy link
Contributor

@mothran mothran commented Apr 25, 2023

Fixes #531

@mothran mothran requested review from flaub and shkoo April 25, 2023 18:37
}
buf[addr..(WORD_SIZE + addr)].copy_from_slice(&bytes[..WORD_SIZE]);
Copy link
Member

@flaub flaub Apr 25, 2023

Choose a reason for hiding this comment

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

Suggested change
buf[addr..(WORD_SIZE + addr)].copy_from_slice(&bytes[..WORD_SIZE]);
buf.as_slice().get(addr..(WORD_SIZE + addr))?.copy_from_slice(&bytes[..WORD_SIZE]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call, we could drop the if + bail! then right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

err I guess that would remove the friendly Error string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Combined the two here: d610dc2

@github-actions
Copy link

Benchmark for Linux-cuda 54bb7ea

Click to hide benchmark
Test Base PR %
fib/100/proof 1791.8±98.74ms 1775.7±110.45ms -0.90%
fib/100/run 437.0±20.00ms 431.6±9.18ms -1.24%
fib/200/proof 1869.5±42.61ms 1778.0±117.55ms -4.89%
fib/200/run 439.2±6.92ms 436.2±9.72ms -0.68%

Benchmark for Linux-default 54bb7ea

Click to hide benchmark
Test Base PR %
fib/100/proof 6.3±0.05s 6.3±0.05s 0.00%
fib/100/run 1461.6±11.84ms 1448.8±3.87ms -0.88%
fib/200/proof 6.3±0.06s 6.3±0.04s 0.00%
fib/200/run 1465.6±4.57ms 1458.6±3.54ms -0.48%

Benchmark for macOS-default 54bb7ea

Click to hide benchmark
Test Base PR %
fib/100/proof 3.9±0.06s 3.9±0.05s 0.00%
fib/100/run 691.4±1.03ms 691.3±1.07ms -0.01%
fib/200/proof 3.9±0.03s 3.9±0.05s 0.00%
fib/200/run 694.2±1.53ms 693.7±1.39ms -0.07%

Benchmark for macOS-metal 54bb7ea

Click to hide benchmark
Test Base PR %
fib/100/proof 1486.7±7.11ms 1479.9±6.33ms -0.46%
fib/100/run 692.0±5.13ms 691.9±1.40ms -0.01%
fib/200/proof 1486.7±5.39ms 1483.0±5.91ms -0.25%
fib/200/run 694.9±1.48ms 694.1±3.15ms -0.12%

@mothran mothran merged commit 7a04a13 into main Apr 25, 2023
12 checks passed
@mothran mothran deleted the parker/memory-img-fault branch April 25, 2023 19:22
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.

[Bug] index out of bound panic while creating a MemoryImage from a riscV program
2 participants