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

Compile DALI with Clang #2416

Merged
merged 14 commits into from
Nov 30, 2020
Merged

Compile DALI with Clang #2416

merged 14 commits into from
Nov 30, 2020

Conversation

klecki
Copy link
Contributor

@klecki klecki commented Oct 29, 2020

For developement purposes, allow DALI to be compiled only
with CLANG.

CMake adjustments: .cu files marked as CXX files to force
CMake to compile them with Clang. Clang compiles those files
as CUDA based on the .cu extension.

Some additional host/device attributes and overloads
for Clang.

Enable support for CMAKE_CUDA_ARCHITECTURES.

Why we need this PR?

Additional development tools

What happened in this PR?

  • What solution was applied:

CMake adjustments: .cu files marked as CXX files to force
CMake to compile them with Clang. Clang compiles those files
as CUDA based on the .cu extension.

Some additional host/device attributes and overloads
for Clang.

  • Affected modules and functionalities:

  • Key points relevant for the review:
    [ Describe here what is the most important part that reviewers should focus on. ]

  • Validation and testing:
    [ Describe here if and how this PR is tested. ]

  • Documentation (including examples):
    [ Describe here if documentation and examples were updated. ]

JIRA TASK: [Use DALI-XXXX or NA]

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1746115]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1746115]: BUILD FAILED

Comment on lines +72 to +91
#if defined(__clang__) && defined(__CUDA__)

template <typename T>
__host__ const T& hostdev_max(const T& l, const T& r) {
return std::max(l, r);
}

template <typename T>
__device__ const T hostdev_max(const T& l, const T& r) {
return ::max(l, r);
}

#else

template <typename T>
__host__ __device__ const T hostdev_max(const T& l, const T& r) {
return ::max(l, r);
}

#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

We have cuda_min/cuda_max. Currently they return reference, but that could be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

last time we didn't want to do that.

@klecki klecki changed the title Clang only squash 01 Compile DALI with Clang Oct 30, 2020
template <int N>
__device__ vec<N> floor(const vec<N> &a) {
constexpr DALI_DEVICE vec<N> floor(const vec<N> &a) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see no particular benefit of using DALI_DEVICE over device. It's compiled only in CUDA and therefore the keyword will always be available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I guess DALI_HOST_DEV was introduced just to save several characters?
Maybe we should just go one way or the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see the point now, we need DALI_HOST_DEV and DALI_HOST (or provide __host__ and __device__ without CUDA headers on our own). So the DALI_DEVICE is more or less for completeness.

Copy link
Contributor

Choose a reason for hiding this comment

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

So the DALI_DEVICE is more or less for completeness.

That's right.

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749225]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749293]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749445]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749293]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749531]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749532]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749559]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749565]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749580]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749752]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749757]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749565]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749580]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749752]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1749757]: BUILD PASSED

@klecki
Copy link
Contributor Author

klecki commented Nov 10, 2020

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1784829]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1784829]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1802731]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1802800]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1810423]: BUILD STARTED

@klecki klecki marked this pull request as ready for review November 18, 2020 15:13
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839388]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839388]: BUILD FAILED

Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839662]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839736]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839872]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839872]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839902]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839912]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1839912]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1840012]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1840012]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1843855]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1843855]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1845099]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1845099]: BUILD PASSED

@klecki klecki merged commit 8799b10 into NVIDIA:master Nov 30, 2020
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.

None yet

4 participants