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

Add support for Parametric #733

Closed

Conversation

tonghaining
Copy link
Contributor

No description provided.

@hernanponcedeleon
Copy link
Owner

hernanponcedeleon commented Sep 11, 2024

@tonghaining as a test case for the PR, you can remove the hack we have for linux-kernel.cat and original code from here.

EDIT: you can also slightly improve spirv.cat by defining imm(r) as here.

@ThomasHaas
Copy link
Collaborator

I'm wondering if we even need semantic representations of these parametric calls in the Wmm class.
I feel like this feature can be implemented purely in the parser by inlining at parsing time.
I might try this later.

@ThomasHaas
Copy link
Collaborator

I think there is a question about semantics of parametric definitions: do they act like macros or like proper functions?
Consider this case:

let a = ...
let f(r) = r | a
let a = ...
let b = f(c) // Does f(c) use the new or the old definition of "a"?

If it acts like macros, then the parametric relation is evaluated in the current namespace (it sees updated definitions), if it acts like a function then the evaluation is wrt. the namespace at definition time of the function (it sees only the definitions that existed when the function was defined).

@hernanponcedeleon
Copy link
Owner

The correct answer is "what would herd7 do?"

For this memory model

let a = po
let f(r) = r | a
let a = 0
let b = f(0)

flag ~empty (b) as b-is-non-empty

It flags the execution


herd7 -model ~/git/Dat3M/cat/func.cat ~/git/Dat3M/litmus/C11/manual/example1.litmus
Test example1 Allowed
States 54
Ok
Witnesses
Positive: 1 Negative: 53
Flag b-is-non-empty
Condition exists (1:r1=1 /\ 1:r2=2 /\ 2:r3=0 /\ 3:r4=1)
Observation example1 Sometimes 1 53
Time example1 0.01
Hash=c66dd6b1853dd1bfb042d6c4c75f37c9

Moving let a = 0 before the function definition makes the flag msg disappear

@ThomasHaas
Copy link
Collaborator

This PR should be subsumed by #736

@hernanponcedeleon
Copy link
Owner

The implementation in #736 is working properly, thus I am closing this PR.

@tonghaining tonghaining deleted the parametric branch September 24, 2024 09:20
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