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

Core evaluator should handle underflow/overflow for times #529

Open
tranma opened this issue May 19, 2017 · 4 comments
Open

Core evaluator should handle underflow/overflow for times #529

tranma opened this issue May 19, 2017 · 4 comments

Comments

@tranma
Copy link
Contributor

tranma commented May 19, 2017

=== prop_psv_fission from test/Icicle/Test/Sea/PsvFission.hs:53 ===
*** Failed! (after 4 tests): 
Exception:
  Expected:
  maggie|gonzo|269369-01-07T07:41:19Z
  maggie|kermit|false
  marge|gonzo|269369-01-07T07:41:19Z
  marge|kermit|false
  
  Got:
  maggie|gonzo|17442-11-20T00:00:00
  maggie|kermit|false
  marge|gonzo|17442-11-20T00:00:00
  marge|kermit|false
  
  CallStack (from HasCallStack):
    error, called at test/Icicle/Test/Sea/PsvFission.hs:146:11 in main:Icicle.Test.Sea.PsvFission
InputType {unInputType = SumT ErrorT StringT}
well-typed:
  entities  = [maggie,marge]
  attribute = windy
  fact type = (Sum Error String)
  facts     = [AsAt {atFact = VRight (VString "maggie"), atTime = Time (1858 11 17 0 0 0s)},AsAt {atFact = VLeft (VError ExceptTombstone), atTime = Time (1858 11 18 0 0 0s)},AsAt {atFact = VLeft (VError ExceptTombstone), atTime = Time (1858 11 19 0 0 0s)}]
  time      = Time (1858 11 20 0 0 0s)
  core      =
    Program (gou virus0 : (Sum Error String), gou virus1 : FactIdentifier, gou virus2 : Time, gou virus3 : SNAPSHOT_TIME)
    Precomputations:
      camelpox0            = sub# (-0.2919623782963758) (0.26637770530658755)
    
    Streams:
      STREAM_FOLD (rotavirus0 : Bool)
        INIT:
          ge# (True) (True)
        KONS:
          True
      
    
    Postcomputations:
      chickenpox0          = fst# (((), 0))
    
    Returning:
      gonzo                = Time_minusMonths# gou virus3 (Time_secondsJulianEpoch# (2006-11-05T00:00:00Z))
    
  avalanche =
    gou virus3 = TIME
    let camelpox0 = sub# (-0.2919623782963758) (0.26637770530658755);
    init acc0$rotavirus0 = ge# (True) (True);
    load_resumable acc0$rotavirus0;
    
    for_facts (gou virus2, gou virus1, gou virus0) in new
    {
      write acc0$rotavirus0 = True;
    }
    save_resumable acc0$rotavirus0;
    
    read rotavirus0 = acc0$rotavirus0 [Bool];
    let chickenpox0 = fst# (((), 0));
    output gonzo (Time_minusMonths# gou virus3 (Time_secondsJulianEpoch# (2006-11-05T00:00:00Z)));
  flat      =
    gou virus3 = TIME
    for_facts (gou virus2, gou virus1, gou virus0$simp1, gou virus0$simp2, gou virus0$simp3) in new
    {
      
    }
    output gonzo (Time_minusMonths# gou virus3 (12833596800));
well-typed:
  entities  = [moe]
  attribute = freezing
  fact type = (Sum Error String)
  facts     = [AsAt {atFact = VRight (VString "lisa"), atTime = Time (1858 11 16 0 0 0s)},AsAt {atFact = VLeft (VError ExceptTombstone), atTime = Time (1858 11 17 0 0 0s)}]
  time      = Time (1858 11 17 0 0 0s)
  core      =
    Program (monkeypox0 : (Sum Error String), monkeypox1 : FactIdentifier, monkeypox2 : Time, monkeypox3 : SNAPSHOT_TIME)
    Precomputations:
      gou virus1           = sub# (-1) (1)
    
    Streams:
      
      STREAM_FILTER
        PREDICATE: 
          True
        STREAMS:
          
    
    Postcomputations:
      equine morbillivirus0
                           = round# (0.9227049013159824)
    
    Returning:
      kermit               = eq# (2030-12-15T00:00:00Z) (2014-12-16T00:00:00Z)
    
  avalanche =
    monkeypox3 = TIME
    let gou virus1 = sub# (-1) (1);
    
    for_facts (monkeypox2, monkeypox1, monkeypox0) in new
    {
      if (True)
      {
        
      }
    }
    
    let equine morbillivirus0 = round# (0.9227049013159824);
    output kermit (eq# (2030-12-15T00:00:00Z) (2014-12-16T00:00:00Z));
  flat      =
    monkeypox3 = TIME
    for_facts (monkeypox2, monkeypox1, monkeypox0$simp0, monkeypox0$simp1, monkeypox0$simp2) in new
    {
      
    }
    output kermit (False);
PsvConstants {psvMaxRowCount = 4, psvInputBufferSize = 35, psvOutputBufferSize = 35, psvFactsLimit = 4}

@amosr
Copy link
Contributor

amosr commented May 19, 2017

program boils down to

(Time_minusMonths# (1858 11 20 0 0 0s) (12833596800))

ie subtract an insane number of months from some 19th century date

which is going to underflow regardless. it's a bogus program. I don't know what we can do about this

@tranma
Copy link
Contributor Author

tranma commented May 19, 2017

yeah, this isn't our problem -- there is nothing to do here.

@tranma tranma closed this as completed May 19, 2017
@jacobstanley jacobstanley reopened this May 19, 2017
@jacobstanley
Copy link
Contributor

We need to somehow make it so this doesn't fail intermittently.

Discussed IRL making the core evaluator detect this situation so we can discard the test.

@amosr amosr changed the title prop_psv_fission failed (!!!) Core evaluator should handle underflow/overflow for times Jun 1, 2017
@amosr
Copy link
Contributor

amosr commented Aug 1, 2017

For now I have modified the Core prim generator so it does not generate PrimTimeMinusMonths. It doesn't take many months to underflow a date, which means then the evaluators don't agree.

But a better solution might be using a consistent time representation between C and Core

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

No branches or pull requests

3 participants