Skip to content

Document origins of the multiplication method being used here. #499

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

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

pnkfelix
Copy link
Member

@pnkfelix pnkfelix commented Oct 25, 2022

Many of us have been discussing the matter of where this riscv32.rs code originated.

I think it is fair to say that Rust leadership agrees that it is not correct development practice to cross-reference GPL'ed code while developing an algorithm.

But the question nonetheless arose: What do you do about code like riscv32.rs, where the code in question would come out much the same way regardless of whether you looked at GPL'ed source or not? Even if we threw it away, we would probably end up replacing it with something that looks nearly equivalent; so how would a copyright infringement argument play out in practice?

@wesleywiser and @pnkfelix met with a lawyer.

And then @pnkfelix did some follow-up reading on the Scènes à faire doctrine of copyright law.

It seems evident to us that a very important detail is that the algorithm defined in this code not only would be considered "stock" (i.e. not a original work) from the viewpoint of us discussing the matter today, but it would also have been considered "stock" at the time it was originally authored within GCC itself, since the method has been well known to ancient mathematicians in 1800 BC, and has been documented as a standard algorithm since (at least) the 1981 AD publication of Knuth TAOCP volume 2.

Therefore, I am taking the steps of:

  • Documenting the method being used
  • Providing the motivation for using this method (simplicity, and maybe code size, but certainly not overall efficiency)
  • Linking to external material (wikipedia and TAOCP) that establishes this method as a stock algorithm for many decades

I believe all of these things should be sufficient to:

Close #319

@pnkfelix
Copy link
Member Author

pnkfelix commented Oct 25, 2022

re Scènes à faire, I thought this article had some pretty good food for thought: https://www.jonesday.com/files/Publication/913ab9f5-4eaf-4ba7-a305-116b11e903b3/Presentation/PublicationAttachment/6809cb5e-fe96-4218-8486-202e7a45a25a/011-013-CW-May09-Feat.pdf

In particular, it was what gave me the idea that the relevant thing to be thinking about here is not whether this is considered a stock algorithm by today's standards (a mental model that fails to give due proper credit to innovative code), but rather whether it would have been a stock algorithm at the time the cross-referenced code was released under a GPL license

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

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

This matches my understanding as well.

@pnkfelix
Copy link
Member Author

pnkfelix commented Oct 25, 2022

Also, in case its not clear: I am fervently trying to avoid establishing any kind of precedent where developing code based on GPL sources would be considered in any way "acceptable" for the project.

It is not acceptable. Several people spent a significant amount of time due to the fallout from the aforementioned contribution. We've been arguing about #319 for years. The point being: Everyone would have been better off if the original contribution had been based on someone trying to figure out how to implement multiplication from scratch (or by looking up methods in TAOCP and translating them from MIX/MMIX assembly) rather than short-cutting by looking at what gcc does.

I want to set an incredibly high bar for establishing that a given piece of code corresponds to a "stock algorithm." Which is why I took so much time identifying relatively ancient cross-references in this case: It is not that I want others to try to copy what I did in on this Pull Request. Rather, I want everyone to recognize what an absurd task meeting this bar represents, and say "oh, that's just not worth it" and then opt out of taking the short-cuts at all.

@Amanieu
Copy link
Member

Amanieu commented Oct 25, 2022

Thanks a lot for this work! I'm glad to have this issue resolved.

@Amanieu Amanieu merged commit 54d00e1 into rust-lang:master Oct 25, 2022
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.

RISC-V implementation contains likely GPL-3 code
3 participants