-
Notifications
You must be signed in to change notification settings - Fork 123
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 of parmap results in "not a word" error #1578
Comments
A smaller example of the issue:
This another instance of Cryptol improperly upholding the invariant that all finite sequences of cryptol/src/Cryptol/Eval/Generic.hs Lines 1878 to 1893 in 8bc638e
This code assumes that if diff --git a/src/Cryptol/Eval/Generic.hs b/src/Cryptol/Eval/Generic.hs
index 461c4bc2..001a46da 100644
--- a/src/Cryptol/Eval/Generic.hs
+++ b/src/Cryptol/Eval/Generic.hs
@@ -1877,7 +1877,7 @@ randomV sym ty seed =
parmapV :: Backend sym => sym -> Prim sym
parmapV sym =
PTyPoly \_a ->
- PTyPoly \_b ->
+ PTyPoly \b ->
PFinPoly \_n ->
PFun \f ->
PFun \xs ->
@@ -1889,8 +1889,9 @@ parmapV sym =
do let m = asBitsMap sym w
m' <- sparkParMap sym (\x -> f' (VBit <$> x)) n m
VWord n <$> (bitmapWordVal sym n (fromVBit <$> m'))
- VSeq n m ->
- VSeq n <$> sparkParMap sym f' n m
+ VSeq n m -> do
+ m' <- sparkParMap sym f' n m
+ mkSeq sym (Nat n) b m'
_ -> panic "parmapV" ["expected sequence!"] The |
Previously, `parmap` could incorrectly return a `VWord` when the element type was not `Bit`, and it could also return a `VSeq` when the element type was `Bit`. This changes the implementation of `parmap` to use the `mkSeq` smart constructor, which properly chooses what sort of `GenValue` to return depending on the element type. Fixes #1578.
Previously, `parmap` could incorrectly return a `VWord` when the element type was not `Bit`, and it could also return a `VSeq` when the element type was `Bit`. This changes the implementation of `parmap` to use the `mkSeq` smart constructor, which properly chooses what sort of `GenValue` to return depending on the element type. Fixes #1578.
I was trying out the experimental
parmap
function in a nightly Cryptol Docker image in the context of some recreational mathematics. Gist here:https://gist.github.com/jpziegler/a3f0e8867edf92727dbd1451e4513d0e
Note that on line 31 I have replaced
map
(which works fine) withparmap
.https://gist.github.com/jpziegler/a3f0e8867edf92727dbd1451e4513d0e#file-ramsey_bug-cry-L31
The following invocation demonstrates the crash. However, most any invocation of the
R
function exhibits this behavior.The text was updated successfully, but these errors were encountered: