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

Spirv OpUndef #769

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Spirv OpUndef #769

merged 1 commit into from
Nov 6, 2024

Conversation

natgavrilenko
Copy link
Collaborator

No description provided.

public Expression visitOpUndef(SpirvParser.OpUndefContext ctx) {
String id = ctx.idResult().getText();
Type type = builder.getType(ctx.idResultType().getText());
Expression expression = builder.makeUndefinedValue(type);
Copy link
Owner

Choose a reason for hiding this comment

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

From the builder, this is calling program.newConstant(), which creates a single global variable that is shared when the code gets duplicated by say inlining or thread creation. I don't think this is the intention. Indeed, we solved a similar problem in #763

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, for non-det values in initial memory, you can use program.newConstant(), otherwise you should use EventFactory.Svcomp.newNonDetChoice (*) as event since this will ensure a fresh value per instance.
Depending on the idea of UndefValue, it would actually be fine to use the same value for all instance (in LLVM, undef values can be freely chosen by the compiler, and he can choose the same value for all instances!).

(*) We need to move that event into the core language like many other "Svcomp Events".

@hernanponcedeleon hernanponcedeleon merged commit 4d03388 into development Nov 6, 2024
1 check passed
@hernanponcedeleon hernanponcedeleon deleted the spirv-op-undef branch November 6, 2024 12:26
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