Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Assertion failure on auto-tuning #2346

Closed
DerZc opened this issue Oct 30, 2022 · 2 comments · Fixed by #2421
Closed

Assertion failure on auto-tuning #2346

DerZc opened this issue Oct 30, 2022 · 2 comments · Fixed by #2421

Comments

@DerZc
Copy link

DerZc commented Oct 30, 2022

Hi,

I run the following program with auto-tuning and meets an assertion failure:

.decl pruz(A:float)
.decl pgii(A:float, B:float, C:float, D:float, E:float, F:float, G:float)
.decl gipw(A:float, B:float, C:float, D:float, E:float, F:float, G:float)
.decl zvrv(A:float)
.decl gytj(A:float, B:float, C:float, D:float, E:float, F:float)

pruz(7.406).

pgii(A, -A, A, -A, -A, A, A) :- pruz(A).
gipw(A, A, A, A, A, A, A) :- pruz(A).

zvrv(C) :- pgii(A, O, G, C, C, E, N), gipw(A, D, K, M, O, I, I), -6.453 = O, K = range(-75.284,942.4).
gytj(A, A, A, A, A, A) :- zvrv(A).

.output gytj

The command is souffle -w example.dl -p profile.txt --emit-statistics && souffle -w example.dl --auto-schedule=profile.txt -o binary2. The output message is:

Error: profile used for auto-scheduling doesn't match the provided program.
souffle: /tmp/souffle/src/include/souffle/utility/MiscUtil.h:217: void souffle::fatal(const char*, const Args& ...) [with Args = {}]: Assertion `false && "fatal error; see std err"' failed.

The version of Souffle is 29c5921.

@DerZc
Copy link
Author

DerZc commented Oct 31, 2022

This simpler test case also trigger the bug:

.decl pruz(A:float)
.decl pgii(A:float)
.decl gipw(A:float, B:float, C:float)
.decl zvrv(A:float)

pruz(1).

pgii(A) :- pruz(A).
gipw(A, A, A) :- pruz(A).

zvrv(K) :- pgii(A), gipw(A, K, O), 1 = O, K = range(1, 10).

.output zvrv

And can not remove any part of the program.

@fangyi-zhou
Copy link
Contributor

I performed a git bisect using the minimised example, and the first commit with the error is 43a4ce3

fangyi-zhou added a commit to fangyi-zhou/souffle that referenced this issue Jun 30, 2023
When using the auto-scheduler on certain inputs, the auto-scheduler may
throw an error stating:
"Error: profile used for auto-scheduling doesn't match the provided
program."
This was reported in Issue souffle-lang#2346 by another user, providing a small
example to test on.

Running a `git bisect` using the example reveals that the commit
43a4ce3 (Working refactor of SIP Graph, 2022-06-23)
was the first to introduce the error.

Inspecting the profiler output for that commit and the parent commit,
I noted that some new indices appear the join columns and they should
probably not be there.

After deep inspection of the refactor, I've noticed the following diff
potentially changes the program behaviour:

src/ast/analysis/JoinSize.cpp
in 43a4ce3 (Working refactor of SIP Graph, 2022-06-23)
```diff
-  auto& dependentVars = varToOtherVars.at(var->getName());
-  if (!dependentVars.empty() &&
-          std::includes(providedVars.begin(), providedVars.end(),
-                  dependentVars.begin(), dependentVars.end())) {
-      joinColumns.push_back(argIdx);
-      ++numBound;
-      continue;
```

src/ast/utility/SipGraph.cpp
in 55c3500 (Working SIPGraph for SelingerSIPS, 2022-06-23)
```
+  if (std::includes(groundedVars.begin(), groundedVars.end(), dependentVars.begin(),
+            dependentVars.end())) {
+    boundColumns.insert(argIdx);
+  }
```

This commit adds the empty check, and this change makes the error
disappear. While I am not certain about whether this is the correct fix,
the use of `std::includes` on an empty range could be a potential cause
of bugs.

I tested the join column output against the parent commit of the
43a4ce3 (Working refactor of SIP Graph, 2022-06-23),
and can confirm that the join columns in the profile output are the same.

Closes souffle-lang#2346
fangyi-zhou added a commit to fangyi-zhou/souffle that referenced this issue Jun 30, 2023
When using the auto-scheduler on certain inputs, the auto-scheduler may
throw an error stating:
"Error: profile used for auto-scheduling doesn't match the provided
program."
This was reported in Issue souffle-lang#2346 by another user, providing a small
example to test on.

Running a `git bisect` using the example reveals that the commit
43a4ce3 (Working refactor of SIP Graph, 2022-06-23)
was the first to introduce the error.

Inspecting the profiler output for that commit and the parent commit,
I noted that some new indices appear the join columns and they should
probably not be there.

After deep inspection of the refactor, I've noticed the following diff
potentially changes the program behaviour:

src/ast/analysis/JoinSize.cpp
in 43a4ce3 (Working refactor of SIP Graph, 2022-06-23)
```diff
-  auto& dependentVars = varToOtherVars.at(var->getName());
-  if (!dependentVars.empty() &&
-          std::includes(providedVars.begin(), providedVars.end(),
-                  dependentVars.begin(), dependentVars.end())) {
-      joinColumns.push_back(argIdx);
-      ++numBound;
-      continue;
```

src/ast/utility/SipGraph.cpp
in 55c3500 (Working SIPGraph for SelingerSIPS, 2022-06-23)
```diff
+  if (std::includes(groundedVars.begin(), groundedVars.end(), dependentVars.begin(),
+            dependentVars.end())) {
+    boundColumns.insert(argIdx);
+  }
```

This commit adds the empty check, and this change makes the error
disappear. While I am not certain about whether this is the correct fix,
the use of `std::includes` on an empty range could be a potential cause
of bugs.

I tested the join column output against the parent commit of the
43a4ce3 (Working refactor of SIP Graph, 2022-06-23),
and can confirm that the join columns in the profile output are the same.

Closes souffle-lang#2346
quentin pushed a commit that referenced this issue Jul 3, 2023
When using the auto-scheduler on certain inputs, the auto-scheduler may
throw an error stating:
"Error: profile used for auto-scheduling doesn't match the provided
program."
This was reported in Issue #2346 by another user, providing a small
example to test on.

Closes #2346
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants