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

Fix assembly backend #192

Merged
merged 6 commits into from
Jan 31, 2021
Merged

Fix assembly backend #192

merged 6 commits into from
Jan 31, 2021

Conversation

Pratyush
Copy link
Member

@Pratyush Pratyush commented Jan 30, 2021

Description

Fix assembly backend to actually reduce the result of squaring/multiplication. Depending on the available CI runner, also runs tests with the assembly backend.

The bug arises because the assembly backend (before this PR) did something like the following:

fn square_in_place(&mut self) {
	let mut a = (self.0).0; // `a` is a *copy* of the data in `self`.
	// do assembly stuff with `a`
	// this is where the bug arose: all assembly operations happened on `a`, 
	// but we didn't write the result back to `self`.
}

In this PR, we fix the above code so that operations do indeed happen in place.

fn square_in_place(&mut self) {
	let a = &mut (self.0).0; // Now `a` is a mutable reference to the contents of `self`.
	// do assembly stuff with `a`
}

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@Pratyush Pratyush changed the title Move curve tests here Fix assembly backend Jan 30, 2021
@Pratyush Pratyush marked this pull request as draft January 30, 2021 23:10
@Pratyush Pratyush marked this pull request as ready for review January 31, 2021 00:18
Copy link
Member

@weikengchen weikengchen left a comment

Choose a reason for hiding this comment

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

Looks good.

@Pratyush Pratyush merged commit 7a74313 into master Jan 31, 2021
@Pratyush Pratyush deleted the fix-asm-backend branch January 31, 2021 00:28
@jon-chuang
Copy link
Contributor

jon-chuang commented Jan 31, 2021

Possible alternate fix: ctx.add_declaration("a", "r", "a"); -> ctx.add_declaration("a", "r", "&mut a");

Not sure why this was changed but glad it's fixed

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.

3 participants