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

Fix Clang warning with __builtin_assume #1788

Merged

Conversation

iomaganaris
Copy link
Contributor

@iomaganaris iomaganaris commented Jun 19, 2024

Building the project with Clang generates the following warning:

the argument to '__builtin_assume' has side effects that will be discarded [-Wassume]

Seems like Clang doesn't handle the hint well unless we pass a const/pure attribute to the function call inside the assume. See: llvm/llvm-project#55636 and llvm/llvm-project#93077

With this change performance for the fn fused nabla examples is significantly improved on clang-cuda and is now much faster than (our old) nvcc, which doesn't have assume support.

@iomaganaris iomaganaris requested review from fthaler and havogt June 19, 2024 07:47
@gridtoolsjenkins
Copy link
Collaborator

Hi there, this is jenkins continuous integration...
Do you want me to verify this patch?

@iomaganaris
Copy link
Contributor Author

launch jenkins

@iomaganaris
Copy link
Contributor Author

launch perftests

@iomaganaris
Copy link
Contributor Author

launch jenkins

@iomaganaris
Copy link
Contributor Author

launch perftests

@iomaganaris
Copy link
Contributor Author

launch jenkins

1 similar comment
@havogt
Copy link
Contributor

havogt commented Jun 24, 2024

launch jenkins

@havogt
Copy link
Contributor

havogt commented Jun 24, 2024

does it have any effect on perftests? if not, we can merge.

@fthaler
Copy link
Contributor

fthaler commented Jun 24, 2024

does it have any effect on perftests? if not, we can merge.

Looks like: https://jenkins-mch.cscs.ch/job/GridTools/job/GridTools_perftest_PR/326/env=cray,label=daint-cn/Results/
But not sure if it is up to date with master references.

@fthaler
Copy link
Contributor

fthaler commented Jun 24, 2024

launch perftest

@havogt havogt merged commit f489c51 into GridTools:master Jun 24, 2024
67 checks passed
havogt pushed a commit that referenced this pull request Jun 26, 2024
Building the project with `Clang` generates the following warning:
```
the argument to '__builtin_assume' has side effects that will be discarded [-Wassume]
```

Seems like Clang doesn't handle the hint well unless we pass a
const/pure attribute to the function call inside the assume. See:
llvm/llvm-project#55636 and
llvm/llvm-project#93077

With this change performance for the fn fused nabla examples is
significantly improved on clang-cuda and is now much faster than (our
old) nvcc, which doesn't have `assume` support.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants