Code Monkey home page Code Monkey logo

Comments (15)

bmwiedemann avatar bmwiedemann commented on May 31, 2024

longer diff: http://rb.zq1.de/compare.factory-20190405/rash-compare.out (showing first 200 lines of each file's diff)

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

Thanks! This looks like a problem more generally with Racket's build system, so I've added an issue to the Racket repository as well: racket/racket#2601

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

Or perhaps I'm wrong! I'll have to look through the implementation and see if/where I'm using some non-deterministic hash-table traversal or gensym...

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

I've removed some code that was likely the culprit (gensyms in macros that I was using for some reason). So if this were re-done using the master branch it would perhaps be reproducible now. I can't think of any other macros that could be doing anything non-reproducible.

from racket-rash.

samth avatar samth commented on May 31, 2024

@willghatch usually you can test this by compiling to zo on a few different machines (or with -j options to raco make) and seeing if you get the same contents.

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

@samth Thanks. After trying to think of a more convenient way and failing, I've been doing exactly that.

Which leads me to the bad news that it's still not reproducible. I think I've isolated it to a single file (git-info.rkt). But I haven't figured out what causes it yet. The only macro used there should be deterministic. It uses gensym at runtime to get a singleton value, but that shouldn't affect reproducible compilation (and removing it doesn't fix it). Anyway, I'll look at this some more after I eat some lunch.

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

So my last statement of isolation was way off, that was just an artifact of the way I first started re-kicking builds. At this point it seems that: Rash's main.rkt and its dependencies are reproducible. But any file using main.rkt via #lang rash that also uses begin-for-syntax, define-syntax, or otherwise directly has code at phase 1 is not reproducible (though using pre-defined Rash macros causes no problem). I'm confused as to how this is happening. My best guess is that it has something to do with how my #%module-begin macro is set up. But generally I'm mystified.

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

@samth Thanks for your help on this, by the way. Aside from gensym and hash-table traversals, are there any other features that come to mind? As far as I know, raco setup gets parallelism by using places, not by spawning new processes. If it were spawning new processes, I wouldn't expect gensym or hash-table traversals to cause non-reproducibility, but I'm not really sure how those things work in places where some things are shared. Even with places I find this slightly confusing, since each place has its own garbage collector and everything. But I've never really used places and I'm not sure what is shared besides the ability to send things over channels.

from racket-rash.

samth avatar samth commented on May 31, 2024

Both gensym and hash traversal order are affected by what order things happen in globally (for example, memory addresses or how many gensyms have been created). So lots of things can affect them.

from racket-rash.

samth avatar samth commented on May 31, 2024

Looking at the expansion of a simple rash module, here are a few things that might be an issue.

  1. It looks like there's an options hash that gets put into the module -- is the order that those keys appear deterministic?
  2. It looks like there are some gensyms in something about current-paramter-environment

I also noticed that a trivial #lang rash program expands to 360+ lines of code. Could some of that be moved into functions where you expand to a reference to that? That makes it less likely that the expansion could change non-deterministically while also making zo sizes smaller.

from racket-rash.

bmwiedemann avatar bmwiedemann commented on May 31, 2024

When having non-deterministic hashes in other languages, we usually sort when iterating over them.
https://github.com/bmwiedemann/theunreproduciblepackage/tree/master/hash has 2 examples.

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

from racket-rash.

willghatch avatar willghatch commented on May 31, 2024

@samth I really appreciate your help on this. Thanks!

from racket-rash.

bmwiedemann avatar bmwiedemann commented on May 31, 2024

Hi, were there patches done that I can test?

from racket-rash.

bmwiedemann avatar bmwiedemann commented on May 31, 2024

This is still a problem with
racket-8.11.1
rash-0.2

+++ new//usr/share/racket/pkgs/rash/rash/compiled/experimental_rkt.dep  2022-12-27 00:00:00.000000000 +0000
@@ -1 +1 @@
-("8.11.1" ta6le ("c766a8edc6824eb84469005591ebecfd6a74207e" . "010b0d6788990d0e951970461b12bdfa90d34464") (collects #"racket" #"base.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"rash" #"private" #"escapable-template.rkt") (collects #"rash" #"private" #"lang-funcs.rkt"))
+("8.11.1" ta6le ("c766a8edc6824eb84469005591ebecfd6a74207e" . "0d7d0978458e495d931d91cc1a50fb926f7dd956") (collects #"racket" #"base.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"rash" #"private" #"escapable-template.rkt") (collects #"rash" #"private" #"lang-funcs.rkt"))

from racket-rash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.